var ieCampaignStopPosition = -37;
function showUpgrade() {
        var slidingDiv = document.getElementById("upgrade");
        if (ieCampaignStopPosition < 37 ) {
                ieCampaignStopPosition = ieCampaignStopPosition + 1;
                slidingDiv.style.top = ieCampaignStopPosition + "px";
                setTimeout("showUpgrade()", 30);
        } else {
                setTimeout("slideIt()", 7000);
        }
}
function slideIt() {
        var slidingDiv = document.getElementById("upgrade");
        if (ieCampaignStopPosition > -30 ) {
                ieCampaignStopPosition = ieCampaignStopPosition - 1;
                slidingDiv.style.top = ieCampaignStopPosition + "px";
                setTimeout(slideIt, 30);
        }
}
function displayCampaign(name) {
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent) ){ //for MSIE x.x;
                var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
                if (ieversion < 7) {
                        var cookieDomain = document.domain;
                        if(document.domain.indexOf('wemade.com') >= 0) {
                                cookieDomain=".wemade.com";
                        } else if(document.domain.indexOf('mir2.co.kr') >= 0) {
                                cookieDomain="mir2.co.kr";
                        } else if(document.domain.indexOf('mir3.co.kr') >= 0) {
                                cookieDomain="mir3.co.kr";
                        } else if(document.domain.indexOf('mirx.co.kr') >= 0) {
                                cookieDomain="mirx.co.kr";
                        }
                        var cookies = document.cookie.split(";");
                        for(i = 0; i < cookies.length; i++) {
                                if(cookies[i].indexOf(name+"=") >= 0) {
                                        return false;
                          }
                        }
                        document.getElementById('upgrade').style.display='block';
                        showUpgrade();
                        setCookie(name, 'ok', cookieDomain);
                        return false;
                }
        }
}
function setCookie(name, value, cookieDomain) {
        var today = new Date();
        var exp = new Date(today.getTime() + 24 * 60 * 60 * 1000); //Expire Time : 1 Day
    var cookies = document.cookie.split(";");
    for(i = 0; i < cookies.length; i++) {
        if(cookies[i].indexOf(name+"=") >= 0) {
                break;
        }
    }
    document.cookie = name + "=" + value + ";path=/;Domain=" + cookieDomain + ";expires=" + exp.toGMTString();
}
function showGnbSubLayerNew(intT){
	var objGnbSubIcon = document.getElementById("gameList");
	var objGameListTop = document.getElementById("gameListTop");

	if (objGnbSubIcon != undefined){
		if (intT == 0){
			objGnbSubIcon.style.display = "none";
			objGameListTop.style.display = "none";
		}else{
			objGnbSubIcon.style.display = "";
			objGameListTop.style.display = "";
		}
	}
}

// go Member Join
function goMemberJoinGnb(winTarget){
	var url = document.location.hostname.toString();
	var rUrl = document.location.pathname + document.location.search; // document.location.href.toString();
	var tUrl = 'http://cs.wemade.com/JoinNew/JoinStep00.aspx?url='+escape(url);  // 20091216
	if (rUrl.indexOf('#') > 0){ 
		rUrl = rUrl.substring(0,rUrl.indexOf('#'));
	}
	top.document.location.href = tUrl;
}

function chgMemLayer(str){
	var obj = document.getElementById("posLayer");
	obj.style.display = str;
}

// We Cash Billing
function goWeCashBillingWinGNB(){
	var strParams = ''; var arrPageLog = document.getElementsByName('txtPageLogVal');
	for (var i = 0; i < arrPageLog.length ; i++ ){if (arrPageLog[i] != undefined){if (i > 0) strParams += '&';strParams += arrPageLog[i].id + '=' + arrPageLog[i].value;}}
	var myAjax = new net.ContentLoader('/sitelib/get_billingurl.asp', goWeCashBillingWinGNBAfter, null, 'POST', strParams);
}

function goWeCashBillingWinGNBAfter(myAjax) {
	if(this.req.readyState == 4) {if(this.req.status == 200) {
		var strResult = this.req.responseText; if (strResult.indexOf("/member/") == -1){
			 if (strResult.indexOf("onestop") == -1){
				window.open(strResult, 'winWeCashBilling', 'width=460px,height=570px,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')
			 }else{
				goChargeHwan();
			}
		}else{
			goMemberLogin();
		}
	}}
}


function openBillingWinGNB(){
	var script = document.createElement('script');
	script.setAttribute("type", "text/javascript");
	script.setAttribute('src', "http://www.wemade.com/gnb/get_billingurl.asp");
	var hh = document.getElementsByTagName('head')[0];
	hh.appendChild(script);
}



function openChargePayWinGnb(){
	var strDomain = document.location.hostname;
	if (strDomain.indexOf('.wemade.com') == -1 || strDomain == 'onestop.wemade.com'){
		goWeCashBillingWinGNB();
	}else{
		openBillingWinGNB();

//		if (strDomain == 'skysword.wemade.com'){
//			openBillingWinGNB();
//		}else{
//			goWeCashBillingWin();
//		}

	}
}

function goChargeHwan(){
	var frm = document.frmMemInfo;
	if ( frm != undefined && frm.txtEncUID != undefined ){
		if(frm.txtEncUID.value.length > 10){
			var wUrl, winChgHwan;
			wUrl = 'http://onestop.wemade.com/pay/settlement/chkUserMirID.asp';
			var strPos = ',left='+(screenWidth-360)/2+',top='+(screenHeight-500)/2;
			winChgHwan = window.open('about:blank', 'chargeHwan','width=360px,height=500px,status=no,toolbar=no,menubar=no,location=no,scrollbars=no'+strPos);
			if( winChgHwan != undefined ){
				frm.action = wUrl;
				frm.target = "chargeHwan";
				frm.submit();
				winChgHwan.focus();
			}
		}else{
			alert('Please login again.'); return false;
		}
	}else{
		alert('Please login again.'); return false;
	}
}

function showGnbSubLayer(intT){
	var objGnbSubIcon = document.getElementById("gameSubList");
	if (objGnbSubIcon != undefined){
		if (intT == 0){
			objGnbSubIcon.style.display = "none";
		}else{
			objGnbSubIcon.style.display = "";
		}
	}
}

function showGnbCsCenter(intT){
	var objGnbCsCenter = document.getElementById("customer");
	if (objGnbCsCenter != undefined){
		if (intT == 0){
			objGnbCsCenter.style.display = "none";
		}else{
			objGnbCsCenter.style.display = "";
		}
	}
}

function GnxFlashActivateGnb( strFlashUrl , n4Witdh , n4Height , strWmode , strId , strClassName , strFlashvar, strFullScreen ){

	if (n4Witdh != 0) {
		objSize_attribute = " width='"+ n4Witdh +"' height='"+ n4Height +"'";
	} else {
		objSize_attribute = "";
	}

	if (strId != 0) {
		objId_attribute = " id='" + strId + "'";
		objId_IE_attribute = " id='" + strId + "'";
	} else {
		objId_attribute = "";
		objId_IE_attribute = "";
	}

	if (strClassName != 0) {
		className_attribute = " class='" + strClassName + "'";
	} else {
		className_attribute = "";
	}

	if (strWmode != 0) {
		wmode_param = "<param name='wmode' value='" + strWmode + "' />";
		wmode_attribute = " wmode='" + strWmode + "'";
	} else {
		wmode_param = "";
		wmode_attribute = "";
	}

	if (strFlashvar != 0) {
		Flashvar_param = "<param name='flashvars' value='" + strFlashvar + "' />";
		Flashvar_attribute = " Flashvars='" + strFlashvar + "'";
	} else {
		Flashvar_param = "";
		Flashvar_attribute = "";
	}

	if (strFullScreen != undefined){
		FullScreen_param = "<param name='allowFullScreen' value='" + strFullScreen + "' />";
		FullScreen_attribute = " allowFullScreen='" + strFullScreen + "'";
	}else{
		FullScreen_param = "";
		FullScreen_attribute = "";
	}
	document.writeln( "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' " + 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='name' value='pdsMovie' />" );
	document.writeln( "<param name='allowScriptAccess' value='always' />" );
	document.writeln( "<param name='scale' value='noscale' />" );
	document.writeln( "<param name='salign' value='t' />" );
	document.writeln( wmode_param );
	document.writeln( Flashvar_param );
	document.writeln( FullScreen_param );
	document.writeln( "<!-- Hixie method -->" );
	document.writeln( "<!--[if !IE]> <-->" );
	document.writeln( "<object type='application/x-shockwave-flash' showLiveConnect='true' allowScriptAccess='always' data='"+ strFlashUrl +"'" + Flashvar_attribute + objSize_attribute + objId_attribute + wmode_attribute + className_attribute + FullScreen_attribute + "></object>" );
	document.writeln( "<!--> <![endif]-->" );
	document.writeln( "</object>" );
}
document.write("\
<style type=\"text/css\">\
#gnbAll{position:relative; width:100%; height:37px; left:0px; top:0px; background:url(\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_bar_bg.gif\") repeat-x; z-index:9000; margin:0; padding:0; text-align:left;}\
#gnbL{position:relative; float:left; margin:3px 0 0 0;background-color:#FFFFFF; z-index:9210; width:540px; overflow-x:hidden;}\
#gnbMenu{position:relative;  float:left; margin:7px 0 0 20px; height:18px; width:420px; background-color:#FFFFFF;}\
#gameListTop{position:absolute; left:97px; top:9px; margin:0; padding:0; z-index:10001;}\
#gameList{position:absolute; left:79px; top:30px; width:408px; overflow:hidden; z-index:10000;  }\
#gameList #listCon{padding:7px 0 0 7px; width:401px; overflow:hidden;background:url(\"http://wemade-image.gscdn.com/global/100520_gnb/bg_gameList.gif\") no-repeat top;}\
#gameList #listCon ul{padding:1px 0px 0px 1px; background-color:#c3c3c3; overflow:hidden; margin:0; width:393px; float:left; list-style:none;}\
#gameList #listCon ul li { float:left; margin-right:1px; margin-left:0px; }\
#gameList #listCon ul li img{float:left;padding-bottom:1px;}\
#gnbR{position: absolute; right:15px; top:0px; float:right; margin:3px 15px 0 0; z-index:10; height:37px; width:385px;}\
#gnbMember{position:absolute;  margin:7px 2px 0 0; width:190px; left:180px; z-index:9200; padding:0;}\
#customer{position: absolute; width:76px; top:9px;left:292px;} \
#iconGnbLayer01 { position:absolute; height:11px; z-index:900; left: 98px; top: 0px; z-index:9400; margin:0; padding:0;}\
img {border:none 0px;}\
.mT3 {margin-top:3px;}\
.mT7 {margin-top:7px;}\
.mL2 {margin-left:2px;}\
.mL3 {margin-left:3px;}\
.mL7 {margin-left:7px;}\
.mR7 {margin-right:7px;}\
.mR20 {margin-right:20px;}\
.fL{float:left;}\
.fR{float:right;}\
.tC{text-align:center;}\
.curP{cursor:pointer;}\
#btn_join{position:absolute; left:72px; top:190px;}\
#no_view{position:absolute; left:20px; top:277px;}\
#no_view input{ vertical-align:middle;}\
#btn_close{ position:absolute; left:310px; top:278px;}\
</style>\
");
document.write("\
<div id=\"gnbAll\">\
    <div id=\"gnbL\">\
		<div style=\"width:15px;float:left;\">&nbsp;</div>\
        <a href=\"http://www.wemade.com\" target=\"_top\" onfocus=\"this.blur()\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_bar_logo.gif\" width=\"71px\" height=\"32px\" class=\"vT fL \" alt=\"Wemade logo\"></a>\
        <div id=\"gnbMenu\">\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_game_02.gif\" class=\"fL\" onMouseOver=\"showGnbSubLayerNew(1);\" style=\"cursor:pointer;\" >\
			<img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mR7 fL\"  >\
			 <a href=\"http://guild.wemade.com\" target=\"_top\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_guild.gif\" class=\"fL\"></a>\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mL7 mR7 fL\">\
            <a href=\"http://comic.wemade.com\" target=\"_top\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_comic.gif\" class=\"fL\"></a>\
			<img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mL7 mR7 fL\"  >\
            <a href=\"http://glog.wemade.com\" target=\"_top\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_glog_new.gif\" class=\"fL\" alt=\"G-Log\"></a>\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mL7 mR7 fL\"  >\
            <a href=\"http://next.wemade.com\" target=\"_top\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_next.gif\" class=\"fL\"></a>\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mL7 mR7 fL\"  >\
            <a href=\"http://www.wemade.com/voice_chat/voice_chat_info.asp\" target=\"_top\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_voice.gif\" class=\"fL\"></a>\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_mn_bar.gif\" class=\"mL7 mR7 fL\"  >\
            <a href=\"http://fox.wemade.com\" target=\"_blank\" onFocus=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_fox.gif\" class=\"fL\"></a>\
        </div>\
    </div>\
    <div id=\"gameListTop\" onMouseOver=\"showGnbSubLayerNew(1);\" onMouseOut=\"showGnbSubLayerNew(0);\"  style=\"display:none;\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/img_gameListTop.gif\" /></div>\
    <div id=\"gameList\" onMouseOver=\"showGnbSubLayerNew(1);\" onMouseOut=\"showGnbSubLayerNew(0);\"  style=\"display:none;\">\
    	<div id=\"listCon\">\
			<ul>\
            	<li><a href=\"http://changchun.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game01.gif\"></a></li>\
                <li><a href=\"http://avalon.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game06.gif\"></a></li>\
                <li><a href=\"http://skysword.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game11.gif\"></a></li>\
                <li><a href=\"http://changchun2.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game02.gif\"></a></li>\
                <li><a href=\"http://gf.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game07.gif\"></a></li>\
                <li><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game00.gif\"></li>\
                <li><a href=\"http://www.mir2.co.kr\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game03.gif\"></a></li>\
                <li><a href=\"http://zwei.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game08.gif\"></a></li>\
                <li><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game00.gif\"></li>\
                <li><a href=\"http://www.mir3.co.kr\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game04.gif\"></a></li>\
                <li><a href=\"http://tartaros.wemade.com\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game09.gif\"></a></li>\
                <li><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game00.gif\"></li>\
                <li><a href=\"http://www.mirx.co.kr\" target=\"_top\" onClick=\"this.blur();\"><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game05.gif\"></a></li>\
                <li><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game00.gif\"></li>\
                <li><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/ico_game00.gif\"></li>\
            </ul> \
        </div>\
        <p><img src=\"http://wemade-image.gscdn.com/global/100520_gnb/bg_gameListBottom.gif\"></p>\
    </div>\
	");
document.write("\
    <div id=\"gnbR\">\
		<div id=\"FlashBanner\" class=\"fL\">\
");
GnxFlashActivateGnb('http://wemade-image.gscdn.com/global/data/bannerLoader_v4.swf','168','32','transparent','gnbRollingBan','gnbRollingBan','tPath=http://www.wemade.com/_flashdata/&fPath=get_gnb_banner_info.asp&aColor=47342b&bColor=d7c993&cColor=d4d4d4&aalpha=0&balpha=0&calpha=0&btnColor=8c6446&btnrColor=d75000&padT=5&padR=0');
document.write("\
		</div>\
        <div id=\"gnbMember\">\
            <img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_member_l.gif\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_join.gif\"  onClick=\"goMemberJoinGnb();\" style=\"cursor:pointer;\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_member_hline.gif\" ><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_refill.gif\"  onClick=\"openChargePayWinGnb();\" style=\"cursor:pointer;\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_member_r.gif\" ><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_customer01.gif\" width=\"76px\" height=\"18px\" border=\"0\" class=\"mL2 \"  onMouseOver=\"showGnbCsCenter(1);\" onMouseOut=\"showGnbCsCenter(0);\"></div>\
		<div id=\"customer\" style=\"display:none;\" onMouseOver=\"showGnbCsCenter(1);\" onMouseOut=\"showGnbCsCenter(0);\">\
                <p style=\"margin:0; padding:0;\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/gnb_customer02.gif\" width=\"76px\" height=\"18px\" border=\"0\"></p>\
                <p style=\"margin:0; padding:0;\"><a href=\"http://cs.wemade.com\" onFocus=\"this.blur();\" target=\"_top\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_customer_01.gif\" width=\"76px\" height=\"18px\" border=\"0\"></a></p>\
                <p style=\"margin:0; padding:0;\"><a href=\"http://onestop.wemade.com\" onFocus=\"this.blur();\" target=\"_top\" onFocus=\"this.blur();\" target=\"_top\"><img src=\"http://wemade-image.gscdn.com/global/080517_gnb/btn_customer_02_new.gif\" width=\"76px\" height=\"18px\" border=\"0\"></a></p>\
		</div>\
    </div>\
</div>\
");

document.write( "\
	<style type=\"text/css\">\
	#upgrade{width:100%; height:65px; position:absolute; top:37px; left:0px; background:url(http://wemade-image.gscdn.com/wemade/campaign/bg_ie8.gif) no-repeat center; background-color:#fff; z-index:8000;}\
	#upgrade .down{position:absolute; width:200px; height:45px; left:50%; margin-left:160px; top:10px;}\
	#upgrade .close{position:absolute; width:15px; height:15px; left:50%; margin-left:380px; top:10px;}\
	</style>\
");
		
document.write("\
<div id=\"upgrade\" style=\"display:none;\">\
<a target=\"blank\" href=\"http://www.microsoft.com/korea/windows/internet-explorer/default.aspx\" class=\"down\">\
<img src=\"http://wemade-image.gscdn.com/wemade/campaign/btn_down.gif\" alt=\"Download\" /></a>\
<a href=\"#\" onclick=\"javascript:slideIt();\" class=\"close\">\
<img src=\"http://wemade-image.gscdn.com/wemade/campaign/btn_close.gif\" alt=\"Close\"/>\
</a></div>");

setTimeout("displayCampaign('iecampaign')", 5000);
