// È­¸é°¡¿îµ¥ Ã¢¶ì¿ì±â
function opwc(name, url, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	opw(name, url, winl, wint, width, height, toolbar, menubar, statusbar, scrollbar, resizable);
}

// ÀÏ¹Ý Ã¢¶ì¿ì±â
function opw(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
    toolbar_str = toolbar ? 'yes' : 'no';
    menubar_str = menubar ? 'yes' : 'no';
    statusbar_str = statusbar ? 'yes' : 'no';
    scrollbar_str = scrollbar ? 'yes' : 'no';
    resizable_str = resizable ? 'yes' : 'no';
    window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

// ·¹ÀÌ¾î ¼û±èº¸ÀÓ
function show(iobject){
	iobject.style.visibility="visible";
}

function hide(iobject){
	iobject.style.visibility="hidden";
}

//
function previews(a, b) {
	var xx = eval(a);
	if(b == 1) {
		xx.style.left = event.clientX + 16;
		xx.style.top = event.clientY;
		xx.style.visibility = 'visible';
	} else {
		xx.style.visibility = 'hidden';
	}
}

// ÀÌ¹ÌÁö ¹Ì¸®º¸±â
function preview_img(frm, pre) {
	if(frm) {
		pre.src = frm;
	}
}

// textArea¿¡ ¿øÇÏ´Â °ª ³Ö±â
function saveCurrentPos(objTextArea) {
	if(objTextArea.createTextRange) objTextArea.currentPos = document.selection.createRange().duplicate();
}

function insertText(objTextArea, text) {
	if(objTextArea.createTextRange && objTextArea.currentPos) {
		var currentPos = objTextArea.currentPos;
		currentPos.text = currentPos.text.charAt(currentPos.text.length - 1) == ' ' ? text + ' ' : text;
   } else {
         objTextArea.value  = text;
   }
}

function imgView(src, name) {
	ti = new Image();
	ti.src = src;

	s = "";
	s += "<html><head><title>" + name + "</title>\n";
	s += "<sc"+"ript>\n";
	s += "function resize() {\n";
	s += "	pic = document.myimg;\n";
	s += "	if(eval(pic).height) {\n";
	s += "		var name = navigator.appName\n";
	s += "		if (name == 'Microsoft Internet Explorer') {\n";

	if(ti.width > screen.width || ti.height > screen.height) {
		var imgwin = window.open("",'name','scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,top=5000,left=5000,width=1,height=1');
		s += "			myHeight = screen.availHeight - 50; myWidth = screen.availWidth - 50;\n";
		s += "		} else {\n";
		s += "			myHeight = screen.availHeight - 50; myWidth = screen.availWidth - 50;\n";
	} else {
		var imgwin = window.open("",'name','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,top=5000,left=5000,width=1,height=1');
		s += "			myHeight = eval(pic).height + 30; myWidth = eval(pic).width + 12;\n";
		s += "		} else {\n";
		s += "			myWidth = eval(pic).height + 9; myWidth = eval(pic).width;\n";
	}
	imgwin.focus();
	imgwin.document.open();

	s += "		}\n";
	s += "		clearTimeout();\n";
	s += "		var height = screen.height;\n";
	s += "		var width = screen.width;\n";
	s += "		var leftpos = width / 2 - myWidth / 2;\n";
	s += "		var toppos = height / 2 - myHeight / 2; \n";
	s += "		self.moveTo(leftpos, toppos);\n";
	s += "		self.resizeTo(myWidth, myHeight);\n";
	s += "	} else {\n";
	s += "		setTimeOut(resize(), 100);\n";
	s += "	}\n";
	s += "}\n";
	s += "</sc"+"ript>\n";
	s += "</head>\n";
	s += "<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n";
	s += "<img border=0 src=" + src + " alt='Å¬¸¯ ´Ý±â' name=myimg onclick='self.close();' onload='resize();'>\n";
	s += "</body></html>\n";

	imgwin.document.write(s);
	imgwin.document.close();
}

// ÄíÅ° »ý¼º
function setCookie(name, value, expiredays) {
  var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// Äí±â °ª ¹Þ±â
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if(endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// ÄíÅ° Ã£±â
function getCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

// delete the cookie
function deleteCookie(name,path,domain)
{
	if (getCookie(name))
	{
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

// ÀÚµ¿ ¸µÅ© by °ÅÄ£¸¶·ç
function autolink(id) {
	var container = document.getElementById(id);
	var doc = container.innerHTML;
	var regSRC = new RegExp("(src|href)=(\'|\")(http|https|ftp|telnet|news|irc)://([-/.a-zA-Z0-9_~#%$?&=:200-377();|°¡-ÆR]+)","gi");
	var regURL = new RegExp("(http|https|ftp|telnet|news|irc)://([-/.a-zA-Z0-9_~#%$?&=:200-377();|°¡-ÆR]+)","gi");
	var regEmail = new RegExp("([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+\.[a-z0-9-]+)","gi");

	container.innerHTML = doc.replace(regSRC,"$1=$2srchref://$4");
	container.innerHTML = container.innerHTML.replace(regURL,"<a href='$1://$2' target='_blank'>$1://$2</a>").replace(regEmail,"<a href='mailto:$1'>$1</a>");
	container.innerHTML = container.innerHTML.replace( /srchref/gi, 'http' );
}

///////////////////////////////////////// Àü¿ë ½ºÅ©¸³Æ®

//document.write("<script id=menuCounterLoad></script>");
function menuCounter(mname) {
	menuCounterLoad.src = "/include/menuCount.php?menuName=" + mname;
}

function menuAction(m) {
	var localpath = '/2006/';
	menuCounter(m);

	if(m == "Main") {
		hf = localpath + 'main/';
	} else if (m == "Search") {
		hf = localpath + 'search/';
	} else if (m == "Festival") {
		hf = localpath + 'festival/';
	} else if (m == "Exp") {
		hf = localpath + 'exp/';
	} else if (m == "Sports") {
		hf = localpath + 'sports/';
	} else if (m == "Area") {
		hf = localpath + 'area/';
	} else if (m == "Enter") {
		hf = localpath + 'enter/';
	} else {
		hf = localpath + 'main/';
	}
	location.href = hf;
	return;
}

/*
ÀÛ¼ºÀÏ  : 2006-02-21
ÃÖÁ¾¼öÁ¤ÀÏ : 2006-02-22
ÀÛ¼ºÀÚ  : exmemory(ÇÏ´Ã³ôÀÌ)
¼Ò¼ÓÄ«Æä : http://cafe.naver.com/firstgroup(¿ì¸®³¢¸® °øºÎÇÏ´Â ITÄ«Æä)

»ç¿ë¿¹
viewMediaPlayer("¹Ìµð¾îÆÄÀÏÁÖ¼Ò","_MediaPlayer","width=320,height=240,enableContextMenu=yes,autoStart=yes,uiMode=none,Volume=80");
viewFlash("FLASH ÆÄÀÏÁÖ¼Ò","_FLASH","width=320,height=240,align=middle,allowScriptAccess=sameDomain,bgcolor=#FFFFFF,menu=false,quality=high");
*/

function viewMediaPlayer(sURL, sName, sFeatures) {
	//¹Ìµð¾î ÇÃ·¹ÀÌ¾î ¹öÀüÀº 7~10 ¹öÀü¿¡ È£È¯µÇ´Â ¿ÀºêÁ§Æ®ID¸¦ »ç¿ëÇÕ´Ï´Ù.
	var WMPCID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";
	var sFeature;
	var sWidth = "100%";
	var sHeight = "100%";
	var pmBoolean;
	var sTempArray;
	var sParamTag = "";

	sFeature = sFeatures.split(/\s*,\s*/);
	for(var i = 0;i < sFeature.length;i++) {
		sTempArray = sFeature[i].split(/\s*=\s*/);
		if(sTempArray[0].toLowerCase() == "width") {
			sWidth = sTempArray[1]; //³ÐÀÌ
		} else if(sTempArray[0].toLowerCase() == "height") {
			sHeight = sTempArray[1]; //³ôÀÌ
		} else {
			//±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸®
			if(sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true") {
				pmBoolean = "true";
			} else if(sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false") {
				pmBoolean = "false";
			} else {
				pmBoolean = sTempArray[1];
			}
			sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag;
		}
	}
	document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+WMPCID+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' >");
	document.write("<PARAM NAME='URL'VALUE='" + sURL + "'>");
	document.write(sParamTag);
	document.write("</OBJECT>");
}

function viewFlash(sURL, sName, sFeatures) {
	var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
	var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000";
	var FLASHVER = "8,0,0,0";
	var sFeature;
	var sWidth  = "100%";
	var sHeight  = "100%";
	var pmBoolean = "false";
	var sTempArray;
	var sParamTag = "";

	sFeature = sFeatures.split(/\s*,\s*/);
	for(var i = 0;i < sFeature.length;i++) {
		sTempArray = sFeature[i].split(/\s*=\s*/);
		if(sTempArray[0].toLowerCase() == "width") {
			sWidth = sTempArray[1]; //³ÐÀÌ
		} else if(sTempArray[0].toLowerCase() == "height") {
			sHeight = sTempArray[1]; //³ôÀÌ
		} else {
			//±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸®
			if(sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true") {
				pmBoolean = "true";
			} else if(sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false") {
				pmBoolean = "false";
			} else {
				pmBoolean = sTempArray[1];
			}
			sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag;
		}
	}
	document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>");
	document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>");
	document.write(sParamTag);
	document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />")
	document.write("</OBJECT>");
}

function viewMedia(url, w, h) {
	s = '<object id="mplayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" standby="Loading Microsoft Windows Media Player..." width="' + w + '" height="' + h + '">';
	s = s + '<param name="AutoSize" value="false">';
	s = s + '<param name="AutoStart" value="1">';
	s = s + '<param name="AnimationAtStart" value="1">';
	s = s + '<param name="FileName" value="' + url + '">';
	s = s + '<param name="PLUGINSPAGE" value="http://www.microsoft.com/korea/windows/windowsmedia/">';
	s = s + '<param name="ShowControls" value="false">';
	s = s + '<param name="ShowStatusBar" value="false">';
	s = s + '<param name="ShowTracker" value="1">';
	s = s + '<param name="ShowPositionControls" value="0">';
	s = s + '</object>';

	document.write(s);
}

function newin(width,height,url,name) {
msgWindow=window.open(url,name,'statusbar=no ,scrollbars=no ,status=no,resizable=no,width='+width+',height='+height)
}

