
// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå)
function flashWrite(url,w,h,id,bg,vars,win){
	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quali' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src'"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);
}

/*
Braunston
±è½ÂÈ¯ ( myzizzy@braunston.co.kr )
Flash Activate JS code
*/
function GnxFlashActivate ( strFlashUrl , n4Witdh , n4Height , strWmode , strId , strClassName , strFlashvar ) {
	//width,height ¿©ºÎ & ¹­À½ (width,height°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (n4Witdh != 0) {
		objSize_attribute = " width='"+ n4Witdh +"' height='"+ n4Height +"'";
	} else {
		objSize_attribute = "";
	}
	//id ¿©ºÎ (ID ¼¿·º·ºÅÍ°¡ ¾øÀ»°æ¿ì 0À¸·Î¼±¾ð)
	if (strId != 0) {
		objId_attribute = " id='" + strId + "'";
		objId_IE_attribute = " id='" + strId + "'";
	} else {
		objId_attribute = "";
		objId_IE_attribute = "";
	}
	//class ¿©ºÎ (class°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strClassName != 0) {
		className_attribute = " class='" + strClassName + "'";
	} else {
		className_attribute = "";
	}
	//wmode ¿©ºÎ (wmode°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strWmode != 0) {
		wmode_param = "<param name='wmode' value='" + strWmode + "' />";
		wmode_attribute = " wmode='" + strWmode + "'";
	} else {
		wmode_param = "";
		wmode_attribute = "";
	}
	//Flashvar ¿©ºÎ (wmode°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strFlashvar != 0) {
		Flashvar_param = "<param name='flashvars' value='" + strFlashvar + "' />";
		Flashvar_attribute = " Flashvars='" + strFlashvar + "'";
	} else {
		Flashvar_param = "";
		Flashvar_attribute = "";
	}
	document.writeln( "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,42,34' " + objSize_attribute + objId_IE_attribute + className_attribute + ">" );
	document.writeln( "<param name='movie' value='"+ strFlashUrl +"' />" );
	document.writeln( "<param name='quality' value='high' />" );
	document.writeln( "<param name='menu' value='0' />" );
	document.writeln( "<param name='allowScriptAccess' value='always' />" );
	document.writeln( wmode_param );
	document.writeln( Flashvar_param );
	document.writeln( "<!-- Hixie method -->" );
	document.writeln( "<!--[if !IE]> <-->" );
	document.writeln( "<object type='application/x-shockwave-flash' data='"+ strFlashUrl +"'" + Flashvar_attribute + objSize_attribute + objId_attribute + wmode_attribute + className_attribute + "></object>" );
	document.writeln( "<!--> <![endif]-->" );
	document.writeln( "</object>" );
}

/* »ç¿ë¹ý
<script type="text/javascript" language="JavaScript">
// <![CDATA[
	GnxFlashActivate('./sub_nav.swf',890,175,'opaque','TopNavi','TopNavi','Flashvars');
// ]]>
</script>
*/


function GnxMovieActivate ( strMovieUrl , n4Width , n4Height , strId , n4AutoStart , n4ShowControls ) {
	//width,height ¿©ºÎ & ¹­À½ (width,height°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (n4Width != 0) {
		if (n4ShowControls == 0) {
			Realn4Height = n4Height;	
		} else {
			Realn4Height = n4Height + 45;
		}
		objSize_attribute = " width='"+ n4Width +"' height='"+ Realn4Height +"'";
	} else {
		objSize_attribute = "";
	}
	//id ¿©ºÎ (ID ¼¿·ºÅÍ°¡ ¾øÀ»°æ¿ì 0À¸·Î ¼±¾ð ¹Ýµå½Ã ¼±¾ðµÇ¾î¾ßÇÔ)
	if (strId != 0) {
		objId_attribute = " id='" + strId + "'";
		objId_IE_attribute = " id='" + strId + "IE'";
	} else {
		objId_attribute = "";
		objId_IE_attribute = "";
	}

	//ShowControls ¿©ºÎ (ÄÁÆ®·ÑÈ­¸éÀ»°¡¸®°í ½ÍÀ»¶§´Â 0, º¸ÀÌ°í ½ÍÀ»¶§´Â 1)
	if (n4ShowControls == 0) {
		ShowControls_param = "<param name='showcontrols' value='false' />";
		ShowControls_attribute = " showcontrols='0'";
	} else if (n4ShowControls == 1){
		ShowControls_param = "<param name='showcontrols' value='true' />";
		ShowControls_attribute = " showcontrols='1'";
	}

	//AutoStart ¿©ºÎ (ÄÁÆ®·ÑÈ­¸éÀ»°¡¸®°í ½ÍÀ»¶§´Â 0, º¸ÀÌ°í ½ÍÀ»¶§´Â 1)
	if (n4AutoStart == 0) {
		AutoStart_param = "<param name='autostart' value='false' />";
		AutoStart_attribute = " autostart='0'";
	} else if (n4AutoStart == 1){
		AutoStart_param = "<param name='autostart' value='true' />";
		AutoStart_attribute = " autostart='1'";
	}

	document.writeln( "<object id='objWMPlayer' name='objWMPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'" + objId_IE_attribute + objSize_attribute +" codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'>");
	document.writeln( "	<param name='AudioStream' value='-1' />");
	document.writeln( "	<param name='AutoSize' value='false' />");
	document.writeln( "	<param name='AnimationAtStart' value='true' />");
	document.writeln( "	<param name='AllowChangeDisplaySize' value='true' />");
	document.writeln( "	<param name='BufferingTime' value='5' />");
	document.writeln( "	<param name='Enabled' value='true' />");
	document.writeln( "	<param name='EnableContextMenu' value='true' />");
	document.writeln( "	<param name='EnableTracker' value='true' />");
	document.writeln( "	<param name='PlayCount' value='1' />");
	document.writeln( "	<param name='Rate' value='1' />");

	document.writeln( "	<param name='ShowCaptioning' value='false' /> <!-- ÀÚ¸· -->");
	document.writeln( "	<param name='ShowAudioControls' value='true' /> <!-- º¼·ýÁ¶Àý -->");
	document.writeln( "	<param name='ShowDisplay' value='false' /> <!-- ¹Ìµð¾îÁ¤º¸ -->");
	document.writeln( "	<param name='ShowPositionControls' value='true' /> <!-- Forward,Rewind -->");
	document.writeln( "	<param name='ShowStatusBar' value='false' /> <!-- »óÅÂ¹Ù -->");
	document.writeln( "	<param name='ShowTracker' value='true' /> <!-- Å½»ö¹Ù -->");
	
	document.writeln( "	<param name='Mute' value='false' />");
	document.writeln( AutoStart_param );
	document.writeln( ShowControls_param );
	document.writeln( "	<param name='FileName' value='" + strMovieUrl + "'>");

	document.writeln( "	<!-- Hixie method -->");
	document.writeln( "	<!--[if !IE]> <-->");
	document.writeln( "		<object id='objWMPlayer' name='objWMPlayer' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' data='" + strMovieUrl + "' " + objSize_attribute + objId_attribute + AutoStart_attribute + ShowControls_attribute + ">");
	document.writeln( "	<!--> <![endif]-->");

	document.writeln( "</object>");

}

/* »ç¿ë¹ý
<script type="text/javascript" language="JavaScript">
// <![CDATA[
	GnxMovieActivate ( 'http://party.paran.com/hp/wmv/[MV]20050511_Side-B_JustDoIt(500k).wmv' , 320 , 240 , 'movie01' , 1 , 1 )
// ]]>
</script>
*/

	function setCookie(name, value){
		var cookieStr = name + "=" + escape(value) + ";ages = -1";
		cookieStr += "; path=/";
		document.cookie = cookieStr; 
	}

	function getCookieVal(offset){
		var endstr = document.cookie.indexOf(";", offset);
		if (endstr == -1)
		endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}
	// ÇØ´ç ÄíÅ° º¯¼ö¿¡ ÇØ´çÇÏ´Â °ªÀ» getCookieVal¸¦ ÅëÇØ¼­ ¸®ÅÏÇÑ´Ù.

	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;
	}


	function errMsg(thisfield, msg) {
		alert (msg);
		thisfield.focus();
	}

	function createForm(fName, fMethod, fAction, fTarget){
		var objForm = document.createElement("form");
		objForm.name=fName;
		objForm.method=fMethod;
		objForm.action=fAction;
		objForm.target=fTarget;
		return objForm;
	}

	function addHidden(objF, iptName, iptValue){
		var objInput = document.createElement("input");
		objInput.type="hidden";
		objInput.name=iptName;
		objInput.value=iptValue;
		objF.insertBefore(objInput);
		return objF;
	}

	// var for tab menu 
	var tmpImgSrc;

	function tabMenuMOver(objImg){
		tmpImgSrc = objImg.src;
		if (objImg.src.indexOf("_rol") == -1){
			objImg.src = objImg.src.replace(/.gif/gi, '_rol.gif');
		}
	}

	function tabMenuMOut(objImg){
		if (tmpImgSrc.length > 4){
			objImg.src = tmpImgSrc;
		}
	}

	function tabMenuMClick(objImg){
		var arrTabMenu = document.getElementsByName("imgTabMenu");
		for (var i = 0; i < arrTabMenu.length ; i++){
			if (arrTabMenu[i] == objImg){
				if (tmpImgSrc.length > 4){
					if (tmpImgSrc.indexOf("_rol") == -1){
						objImg.src = tmpImgSrc.replace(/.gif/gi, '_rol.gif');
						tmpImgSrc = objImg.src
					}
				}
			}else{
				arrTabMenu[i].src = arrTabMenu[i].src.replace(/_rol/gi, '');
			}
		}
	}

	function viewBigImage(imgUrl){
		var winBigImg;
		winBigImg = window.open('/sitelib/viewimg_common.asp?img='+escape(imgUrl), 'viewBig', 'width=300,height=300,scrollbar=no');
		if (winBigImg != undefined){
			winBigImg.focus();
		}
	}


	function setWindowResize(){
		document.body.style.overflow='hidden';
		var clintAgent = navigator.userAgent;
		var w = document.body.scrollWidth;
		var h = document.body.scrollHeight;
		if ( clintAgent.indexOf("MSIE") != -1 ){
			// IE
			window.resizeBy(w-document.body.clientWidth, h-document.body.clientHeight);
		}else{
			window.resizeBy(w-window.innerWidth, h-window.innerHeight);
		}
	}

	// scrollLayer [top]
	function scrollLayer(objID, pageGap, getTopPoint){ 
		var topPoint, sPoint, ePoint, timer; 
		var objLayer   = document.getElementById(objID);  // ·¹ÀÌ¾î ¿ÀºêÁ§Æ®

		topPoint   = objLayer.style.top;
		sPoint = parseInt(topPoint, 10); 
		ePoint   = (parseInt(document.body.clientHeight) - pageGap) + parseInt(document.body.scrollTop); 
		intLimitPoint = parseInt(document.body.scrollHeight) - parseInt(objLayer.offsetHeight) -10; 

		if ( ePoint > intLimitPoint )  ePoint = intLimitPoint; 
		if ( ePoint < getTopPoint)	ePoint = getTopPoint;
		if ( ePoint < topPoint )    ePoint = topPoint; 
		if ( sPoint != ePoint ){ 
			scrollValue = Math.ceil( Math.abs( ePoint - sPoint ) / 15 ); 
			objLayer.style.top = parseInt(topPoint, 10) + ( ( ePoint < sPoint ) ? -scrollValue : scrollValue ); 
		} 
		timer = setTimeout ("scrollLayer('" + objID + "', " + pageGap + ", " + getTopPoint +");", 5); 
	} 

	function gotoBodyTop(){
		document.body.scrollTop=0;
	}


	// game info
	function setViewGInfo(){
		var imgFlag = false;
		var arrTabMenu = document.getElementsByName("imgTabMenu");
		var arrSpnGInfo = document.getElementsByName("spnGameInfo");
		if (arrTabMenu.length == arrSpnGInfo.length){
			for (var i = 0; i < arrTabMenu.length ; i++ ){
				if (arrTabMenu[i].src.indexOf("_rol") > 0){
					arrSpnGInfo[i].style.display = 'block';
					imgFlag = true;
				}else{
					arrSpnGInfo[i].style.display = 'none';
				}
			}
		}
		if (imgFlag == false){
			arrSpnGInfo[0].style.display = 'block';
		}
	}

	function goViewGInfo(objImg){
		var arrString;
		var objSWFMovie = document.getElementById("game_movie");
		if (objSWFMovie != undefined && objSWFMovie.IsPlaying() == false){
			if (objSWFMovie.movie.lastIndexOf("=1") >0 ){
				objSWFMovie.movie = objSWFMovie.movie.replace(/mode=1/gi, 'mode=0');
			}else{
				objSWFMovie.movie = objSWFMovie.movie.replace(/mode=0/gi, 'mode=1');
			}
		}
		tabMenuMClick(objImg);
		setViewGInfo();
	}
	// -- game info

	// inside info
	function setViewInside(){
		var imgFlag = false;
		var arrTabMenu = document.getElementsByName("imgTabMenu");
		var arrSpnInside = document.getElementsByName("spnInsideInfo");
		if (arrTabMenu.length == arrSpnInside.length){
			for (var i = 0; i < arrTabMenu.length ; i++ ){
				if (arrTabMenu[i].src.indexOf("_rol") > 0){
					arrSpnInside[i].style.display = 'block';
					imgFlag = true;
				}else{
					arrSpnInside[i].style.display = 'none';
				}
			}
		}
		if (imgFlag == false){
			arrSpnInside[0].style.display = 'block';
		}
	}

	function goViewInside(objImg){
		var arrString;
		tabMenuMClick(objImg);
		setViewInside();
	}
	// -- inside info


	// HTTP --> HTTPS
	function urlRedirectAction(){
		if (document.location.protocol == 'http:' && document.location.protocol != 'https:'){
			top.document.location.href = 'https://'+top.document.location.hostname+top.document.location.pathname;
		}
	}

	// HTTPS --> HTTP
	function urlRedirectAction2(){
		if (document.location.protocol == 'https:' && document.location.protocol != 'http:'){
			top.document.location.href = 'http://'+top.document.location.hostname+top.document.location.pathname;
		}
	}

	// ÇÏ´Ü ¸Þ´º¿¡¼­ »ç¿ë
	// ÇÊÅÍ Àû¿ë ÇÔ¼ö
	function trans(id,after){
	eval('document.getElementById("'+id+'").filters.blendTrans.stop();');
	eval('document.getElementById("'+id+'").filters.blendTrans.Apply();');
	eval('document.getElementById("'+id+'").src="'+after+'";');
	eval('document.getElementById("'+id+'").filters.blendTrans.Play();');
	}
	function Find_Obj(n, d) {
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=Find_Obj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	// ºÎ¸Þ´º ·¹ÀÌ¾î ¼û±è/º¸ÀÌ±â ÇÔ¼ö
	function Show_Hide() {
	  var i,p,v,obj,args=Show_Hide.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=Find_Obj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
	}
	// ÇÏ´Ü¸Þ´º¿¡¼­ »ç¿ëÇÔ. -- ¿©±â±îÁö

	function goEnglishHome(){
		blank.location.href="http://www.wemade.com/eng/game/01.asp";
	}


	function popwindow(pop,width,height){
		var url = pop;  
		var wd = width;
		var he = height;
		nWin = window.open(url,"newWin","toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd +",height=" + he + ";");
		if (nWin != undefined){
			nWin.focus();
		}else{
			alert('ÆË¾÷ Â÷´ÜÀ» ÇØÁ¦ÇØ ÁÖ½Ã°í ´Ù½Ã ½ÃµµÇØ ÁÖ¼¼¿ä.');
		}
	}


	function chgUpEvtView(obj){
		var objTab = document.getElementsByName("objUpTabName");
		for(var i=0;i<objTab.length;i++){
			if(obj == objTab[i]){
				document.getElementById("objLineP" + i).style.display = "block";
			}else{
				document.getElementById("objLineP" + i).style.display = "none";
			}
			objTab[i].src = objTab[i].src.replace("on","off");
		}
		chkUpRollOver = obj;
		obj.src = obj.src.replace("off","on");
	}