function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// MenuBuilder 4.0
function load1(form) {
//   form.Llist_1.options[form.Llist_1.selectedIndex].style.backgroundColor = "orange";
     var url = form.Llist_1.options[form.Llist_1.selectedIndex].value;
     if (url != '') open(url);
     return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function view(what) { 
	var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=1,height=1'); 
	imgwin.focus(); 
	imgwin.document.open(); 
	imgwin.document.write("<html>\n"); 
	imgwin.document.write("<head>\n"); 
	imgwin.document.write("<title>Click Image to Close</title>\n"); //오픈창 타이틀 이름 지정하는 부분 

	imgwin.document.write("<sc"+"ript>\n"); 
	imgwin.document.write("function resize() {\n"); 
	imgwin.document.write("pic = document.il;\n"); 
	//imgwin.document.write("alert(eval(pic).height);\n"); 
	imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
	imgwin.document.write(" if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 0; myWidth = eval(pic).width + 0;\n"); 
	imgwin.document.write(" } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n"); 
	imgwin.document.write(" clearTimeout();\n"); 
	imgwin.document.write(" var height = screen.height;\n"); 
	imgwin.document.write(" var width = screen.width;\n"); 
	imgwin.document.write(" var leftpos = width / 2 - myWidth / 2;\n"); 
	imgwin.document.write(" var toppos = height / 2 - myHeight / 2; \n"); 
	imgwin.document.write(" self.moveTo(leftpos, toppos);\n"); 
	imgwin.document.write(" self.resizeTo(myWidth+10, myHeight+48);\n"); 
	imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
	imgwin.document.write("</sc"+"ript>\n"); 

	imgwin.document.write("</head>\n"); 
	imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n'); 

	imgwin.document.write("<center><img border=0 src="+what+" xwidth=100 xheight=9 name=il onClick='self.close();' onload='resize();'></center>\n"); 
	imgwin.document.write("</body>\n"); 
	imgwin.document.close(); 
}

function ingevent() {
  document.location.href="/tempst_bbs/event/board_list.php?tbname=kor_event&category=1";
}

function endevent() {
  document.location.href="/tempst_bbs/event/board_list.php?tbname=kor_event&category=2";
}

var viewtime
var rankstate = 'r';
function rankview(str) {
	if(str=="r") {
		rank.style.display = "inline";
		hall.style.display = "none";
		rankimg.src = "/images/main/rank_img_01.gif";
		hallimg.src = "/images/main/rank_hall.gif";
		rankstate = "h"
	}
	else {
		rank.style.display = "none";
		hall.style.display = "inline";
		rankimg.src = "/images/main/rank_img.gif";
		hallimg.src = "/images/main/rank_hall_01.gif";
		rankstate = "r"
	}
}

function auto_rankview() {
	if (rankstate=="r") {
		rankview('r');
		viewtime=setTimeout("auto_rankview()",5000);
	}
	else {
		rankview('h');
		viewtime=setTimeout("auto_rankview()",5000);
	}
}

function auto_rankview_stop() {
	window.clearTimeout(viewtime);
}

function virtual() {
	document.location.href="/tempst_bbs/event/board_list.php?category=&cntr=&cate=&tbname=kor_event_87"
}

function newmemo() {
	window.open('http://piugame.com/memo_read.html','memo','width=417,height=410,toolbar=no,scrollbars=yes')
}

//***********************************************************************************************
//************************************   IE 패치   **********************************************
//***********************************************************************************************
function  viewMediaPlayer(sURL, sName, sFeatures){ 

 //미디어 플레이어 오브젝트를 뿌려줍니다. 
 //미디어 플레이어 버전은 7~10 버전에 호환되는 오브젝트ID를 사용합니다. 
 var WMPCID = "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"; 

 var sFeature; 
 var sWidth  = "100%"; 
 var sHeight  = "100%"; 
 var pmBoolean; 
 var sTempArray; 
 var sParamTag = ""; 
 var sParamTag_FF;
 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; 
  sParamTag_FF = sTempArray[0]+"='"+pmBoolean+"' "+sParamTag_FF;
  } 
 } 

 document.writeln("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+WMPCID+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' >"); 
 document.writeln("<PARAM NAME='FileName' VALUE='" + sURL + "'>"); 
 document.writeln(sParamTag); 
 document.writeln("<embed src='" + sURL + "' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' "+sParamTag_FF+" pluginspage='http://www.microsoft.com/windows/windowsmedia/download/'>"); 
 document.writeln("</OBJECT>"); 
} 

function  viewFlash(sURL, sName, sFeatures, sFlag){ 

 //플래시 ActiveX 오브젝트를 뿌려줍니다. 
 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 = ""; 
 var sParamTag_FF = "";
 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; 
  sParamTag_FF = sTempArray[0]+"='"+pmBoolean+"' "+sParamTag_FF;
  } 
 } 

 if(sFlag) {
 document.writeln("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>"); 
 document.writeln("<PARAM NAME='movie' VALUE='" + sURL + "'>"); 
 document.writeln(sParamTag); 
 document.writeln("<EMBED SRC='"+sURL+"' ID='"+sName+"' NAME='"+sName+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' "+sParamTag_FF+" TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />") 
 document.writeln("</OBJECT>"); 
 }
} 


function territory_ch(no) {
	document.location.href = "/index.html?territory=" + no
}

function world_layerAction(name,status) {
    var obj=document.all[name]
    if(status=='visible') {
        if(select_obj) {
            select_obj.style.visibility='hidden';
            select_obj=null;
        }
        select_obj=obj;
    }else{
        select_obj=null;
    }
    obj.style.visibility=status;
}

document.writeln("<iframe name='menu' id='menu' width='0' height='0' style='display:none'></iframe>");
function menu_exceed() {
	menu.location.href="/gotopage.html?menu=exceed";
}

function menu_zero() {
	menu.location.href="/gotopage.html?menu=zero";
}

function menu_comm() {
	menu.location.href="/gotopage.html?menu=community";
}

function menu_supp() {
	menu.location.href="/gotopage.html?menu=support";
}

function menu_event() {
	menu.location.href="/gotopage.html?menu=event";
}

function Mypage() {
	menu.location.href="/gotopage.html?menu=mypage";
}

//############ 새창띄우기 페이지경로, 창이름, 가로, 세로, 스크롤유무
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
	  settings +='directories=no';
	  settings +='titlebar=no';
	  settings +='toolbar=no';
	  settings +='location=no';
	  settings +='menubar=no';
  win=window.open(mypage,myname,settings);
//  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

var b=false;	

function bit() {
	f = document.login_frm
	if ( b ) 
		return;

	f.txtid.style.backgroundImage="";
	b=true;
}	

var c=false;	

function bit2() {
	f = document.login_frm
	if ( c ) 
		return;

	f.txtpwd.style.backgroundImage="";
	c=true;
}				

function NewDialog(mypage,myname,w,h,c,t,title,query) {
	//window.showModelessDialog("SMLD_target.htm","Dialog Box Arguments # 3","dialogHeight: 500px; dialogWidth: 500px; dialogTop: 300px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
	window.showModelessDialog("/showdialog.php?showpage="+mypage+"&title="+title+"&query="+query,myname,"dialogwidth:"+w+"px;dialogheight:"+h+"px;status:No;help:No;center:"+c+";resizable:No;dialogtop:"+t+"px");
	//window.showModelessDialog(mypage,myname,"dialogwidth:"+w+"px;dialogheight:"+h+"px;status:No;help:No;center:"+c+";resizable:No;dialogtop:"+t+"px");
}

function pumbihelp_ko() {
	NewWindow("/help/usb/index.php","pumbihelp",600,700,1)

}

function pumbihelp_en() {
	NewWindow("/help/usb/en/index.php","pumbihelp",600,700,1)

}

function pumbihelp_sp() {
	NewWindow("/help/usb/sp/index.php","pumbihelp",600,700,1)

}

function pumbihelp_pt() {
	NewWindow("/help/usb/pt/index.php","pumbihelp",600,700,1)

}

function pumbihelp_cn() {
	NewWindow("/help/usb/cn/index.php","pumbihelp",600,700,1)

}

function piu_order(no) {
	switch (no)	{
		case "1":
			window.open("http://www.piugame.com/sales_mail_01.html?code=01","order","width=550,height=470");
			break;	
		case "2":
			window.open("http://andamiro.com/kor/support/as.html?tbname=as&divpage=0&mode=write");
			break;	
		case "3":
			window.open("http://www.piugame.com/sales_mail_01.html?code=03","order","width=550,height=470");
			break;	
		case "4":
			window.open("http://www.piugame.com/sales_mail_01.html?code=04","order","width=550,height=470");
			break;	
	}
}

function piu_order_en(no) {
	switch (no)	{
		case "1":
			window.open("http://andamiro.com/en/support/contact.html","order");
			break;	
		case "2":
			window.open("http://andamiro.com/en/support/contact.html","order");
			break;	
		case "3":
			window.open("http://piugame.com/web_mail.htm","web","width=330,height=600");
			break;	
		case "4":
			window.open("http://piugame.com/web_mail.htm","web","width=330,height=600");
			break;	
	}
}

// png 파일 표시 스크립트
function setPng24(obj) { 
  obj.width=obj.height=1; 
  obj.className=obj.className.replace(/\bpng24\b/i,''); 
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
  obj.src='';  
  return ''; 
}

function Mypage() {
	document.location.href="http://my.piugame.com/regedit_ko.html";
}

function zero() {
	window.open("http://www.piugame.com/zero/ko/zero.html","zero","width=930,height=730")
}

function menu_nx() {
	window.open("http://www.piugame.com/nx/kor/main.htm","nx","width=930,height=689")
}

function menu_nx2() {
	window.open("http://www.piugame.com/piunx2/ko/index.html","nx2","width=800,height=600,fullscreen")
}

function menu_nx2_pro() {
	window.open("http://www.piugame.com/nx2/promotion/nx2.html","nx2","width=800,height=600,fullscreen")
}

function menu_nxa() {
	window.open("http://www.piugame.com/next_p/","nxa","width=800,height=600,fullscreen")
}



function piu_navi01() {
	top.location.href="http://club.piugame.com"
}

function piu_navi02() {
	top.location.href="http://www.piugame.com/ranking/index.html"
}

function piu_navi03() {
	top.location.href="/"
}

function piu_navi04() {
	top.location.href="http://www.piugame.com/mall/"
}

function piu_navi05() {
	top.location.href="http://www.piugame.com/tempst_bbs/event_main/board_list.php"
}

function home() {
	top.location.href="http://www.piugame.com/new/main.html";
}

function nx2pro(){
    window.open("http://www.piugame.com/nx2/promotion/nx2.html","full", "channelmode=yes,fullscreen,scrollbars=0")
}

function locations_ko() {
	top.location.href="/tempst_bbs/location/board_list.php?tbname=loca"
}

function pumbi_down() {
	top.location.href="/ranking/download.html"
}

function pumbiv2_down() {
	top.location.href="/ranking/download_v2.html"
}


function character() {
	top.location.href="http://my.piugame.com/avatar_list.html";
}

function my_info() {
	top.location.href="http://my.piugame.com/regedit_en.html";
}

function my_point() {
	top.location.href="http://my.piugame.com/mypoint.html";
}

function my_post() {
	top.location.href="http://my.piugame.com/memo/memo_list.html"
}

function my_rank() {
	top.location.href="http://www.piugame.com/ranking/myranking.html?game_type=9"
}

function my_out() {
    top.location.href='http://www.piugame.com/login/logout.php'
}

function my_club() {
}

function q_world() {
	top.location.href="http://www.piugame.com"
}

function q_mypage() {
	document.location.href="http://my.piugame.com/regedit_en.html";
}

function q_club() {
	top.location.href="http://club.piugame.com"
}

function q_mall() {
	top.location.href="http://www.piugame.com/mall/"
}

function piuban(m1) {
	switch (m1)	{
		case "1":
			window.open("http://www.piugame.com/nxa/pro")
			break;		
		case "2":
			piunavi('1','1')
			break;		
		case "3":
			q_mall()
			break;		
		case "4":
			piu_navi02()
			break;		
		case "5":
			piunavi('1','1')
			break;		
		case "6":
			piunavi('1','1')
			break;		
		case "7":
			top.location.href="/tempst_bbs/board/board_list.php?tbname=kor_notice&no=279"
			break;		
	}
}

function event_lotto1() {

	var lotto = window.open("/usb2/lotto.html","lotto","width=500,height=300")

}


