function openFormWindow(pUrl, pTarget, pWidth, pHeight, pScroll, pToolbar, pResizable, pStatus){	
 	var pLeftPos	= (screen.width - pWidth) / 2;
	var pTopPos		= (screen.height - pHeight) / 2;
	pToolbar	= pToolbar?pToolbar:"no";
	pResizable	= pResizable?pResizable:"no";
	pStatus		= pStatus?pStatus:"no";
	pScroll		= pScroll?pScroll:"yes";
	var pWinStyle = "width="+pWidth+",height="+pHeight+",location=no,directories=no,menubar=no,toolbar="+pToolbar+",status="+pStatus+",scrollbars="+pScroll+",resizable="+pResizable+",top="+pTopPos+",left="+pLeftPos;
	var showWindow = window.open(pUrl, pTarget, pWinStyle);
	showWindow.focus();
}

// JavaScript Document
function new_win(filename,p_name,s_width,s_height,s_scrol){
	var x = screen.width;
	var y = screen.height;
	var wid = (x / 2) - (s_width / 2);
	var hei = (y / 2) - (s_height / 2);

	window.open(filename, p_name, "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=" + s_scrol + ",width=" + s_width + ",height=" + s_height + ",top=" + hei + ",left=" + wid + ",scrolbar=no"); 
}

function check_email(str){
emailStr = str.value
if(emailStr != "") {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var firstChars=validChars
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom="(" + firstChars + validChars + "*" + ")"
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("E-mail ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		str.focus();
		return false;
		}
	}
}

// ¿µ¹®°ú ¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÏ°Ô ÇÏ´Â ½ºÅ©¸³Æ®..
function onlyEng(objtext1) {
	var inText = objtext1.value;
	var ret;

	for (var i = 0; i < inText.length; i++) {
		ret = inText.charCodeAt(i);
		if ((ret > 122) || (ret < 48) || (ret > 57 && ret < 65) || (ret > 90 && ret < 97)) {
			alert("¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸À» ÀÔ·ÂÇÏ¼¼¿ä");objtext1.value = "";objtext1.focus();return false;
		}
	}
	return true;
}

// ¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÏ°Ô ÇÏ´Â ½ºÅ©¸³Æ®..
function onlynum(objtext1){
	var inText = objtext1.value;
	var ret;

	for (var i = 0; i < inText.length; i++) {
    ret = inText.charCodeAt(i);
		if (!((ret > 47) && (ret < 58))){
			alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");objtext1.value = "";objtext1.focus();return false;
		}
	}
	return true;
}

//µ¿¿µ»ó
		function changeSize(mode)
		{	var width=320, height=312, mWidth=620, mheight=390;
			
			if (mode)  width=520, height=552, mWidth=800, mheight=800

			MPlay2.style.pixelWidth  = width
			MPlay2.style.pixelHeight = height

			window.focus()
			return false
		}
		function Repeat()
		{
			var count=MPlay2.PlayCount
			count=1-count
			document.all.bottom.style.backgroundColor=(count)? "white":"red";
			MPlay2.PlayCount=count
		}

//Áñ°ÜÃ£±âÃß°¡
function bookmark(link,title){
window.external.AddFavorite('link','title')
}

// 2011.02.28, ±èÀÎÈ£, SNS°ü·Ã Ã³¸®
function sendTwitter(title) {
    var url = '';
    url = window.location;
    title = title.replace('&', '');

    var postBody = '';
    postBody = title;
    postBody += ' ';
    postBody += url;
    postBody = encodeURIComponent(postBody);

    var sURL = '';
    sURL = 'http://twitter.com/home';
    sURL += '?status=';
    sURL += postBody;

    window.open(sURL);

    return false;
}

function sendMe2day(title) {
    var url = '';
    url = window.location;

    var newPostBody = '';
    newPostBody = '"';
    newPostBody += title;
    newPostBody += '":';
    newPostBody += url;
    newPostBody += '&sns=me2day';
    newPostBody = encodeURIComponent(newPostBody);

    var newPostTags = '';
    newPostTags = '´ë±¸±¤¿ª½Ã';
    newPostTags = encodeURIComponent(newPostTags);

    var sURL = '';
    sURL = 'http://me2day.net/posts/new';
    sURL += '?new_post[body]=';
    sURL += newPostBody;
    sURL += '&new_post[tags]=';
    sURL += newPostTags;

    window.open(sURL);

    return false;
}

function sendFacebook(title) {
    var url = '';
    url = window.location;

    var pTitle = '';
    pTitle = title;
    pTitle = encodeURIComponent(pTitle);

    var pUrl = '';
    pUrl = url;
    pUrl += '&sns=facebook';
    pUrl = encodeURIComponent(pUrl);

    var sURL = '';
    sURL = 'http://www.facebook.com/sharer.php';
    sURL += '?s=100';
    sURL += '&p[title]=';
    sURL += pTitle;
    sURL += '&p[url]=';
    sURL += pUrl;

    window.open(sURL);

    return false;
}

function sendYozm(title) {
    var url = '';
    url = window.location + '';
    
    url = url.replace('&section_id=', '&amp;section_id=');

    var m = '';
    m = title;
    m += ' ';
    m += url;
    m += '&sns=yozm';
    m = encodeURIComponent(m);

    var sURL = '';
    sURL = 'http://yozm.daum.net/home';
    sURL += '?m=';
    sURL += m;

    window.open(sURL);

    return false;
}

function sendClog(title) {
    var url = window.location + '';
    url += "&sns=clog";

    var sURL = '';
    sURL += 'http://csp.cyworld.com/bi/bi_recommend_pop.php';
    sURL += '?url=' + encodeURIComponent(url);
    sURL += '&writer=';
    sURL += '&title=' + encodeURIComponent(title);    
    sURL += '&summary=';
	
    window.open(sURL,'recom_icon_pop', 'width=400,height=364,scrollbars=no,resizable=no');

    return false;
}
