﻿// JScript 文件
function to(id)
{
    var objForm =  document.getElementById( id );
	return objForm;
}
function emailCheck(obj)
{
  var str = obj.value;
  var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
  var flag = reg.test(str);
  return flag;
}
function isChinese(name){ 
	if(name.length == 0)
		return false;
	for(i = 0; i < name.length; i++) {
		if(name.charCodeAt(i) > 128)
	 		return true;
	}
	return false;
}

function checkInputChar(str){
	var reg = /^(\w|[\u4E00-\u9FA5])*$/; 

	if(str.match(reg)) 
	 { 
	   return true;
	 }else 
	 { 
	   return false;
	 }  
}
function Filter_SQL_key(strData)
{
	var strFilter="admin,fuck,Nextgame,管理员,系统消息,管理员,邓小平,胡锦涛,共产党,国民党,妈的,毛主席,毛泽东,panda,官方消息,系统公告,客服,官方,政府,消息,公告,pm";
	var blnFlag
	strFilter=strFilter.split(',');
	for(var i=0;i<=strFilter.length-1;i++)
	{
		if(strData.indexOf(strFilter[i])>-1)
		{
			return false;
		}
	}
	return true;
}
function WriteHeader()
{
    type = "n";
   if(null != document.getElementById("headDiv2"))
   {
        type = "i";
   }

   $.post("/ajaxrequests/Loginajax.aspx",{type:type},function(xml){
     var index = xml.indexOf("&");
    if( index>0){
       if(null != document.getElementById("headDiv"))
       {
         document.getElementById("headDiv").innerHTML = xml.substr(index+1);
       }
       if(null != document.getElementById("headDiv2"))
       {
         document.getElementById("headDiv2").innerHTML = xml.substr(index+1);
       }

    }
    });
}
function WriteFooter()
{

  var footer ='<div class="fd"  id="webDiv"><div>';
      footer+='<a href=" http://www.wo173.com/" target="_blank" title="wo173网页游戏"><img src="http://img.nextwar.cn/images/wo173.gif" width="88" height="31"/></a>';
    footer+='<a href="http://www.ufojoy.com/" target="_blank" title="星碟网络"><img src="http://img.nextwar.cn/images/ufojoy.gif" width="88" height="31"/></a>';
    footer+='<a href="http://www.57yx.com/ " target="_blank" title="我的游戏"><img src="http://img.nextwar.cn/images/57yx.gif" width="88" height="31"/></a>';
    footer+='<a href="http://www.175w.com/" target="_blank" title="便利商店"><img src="http://img.nextwar.cn/images/175u.jpg" width="88" height="31"/></a>';
    footer+='<a href="http://www.2u.com.cn/" target="_blank" title="兔友网"><img src="http://img.nextwar.cn/images/2tu.jpg" width="88" height="31"/></a>';
    footer+='<a href="http://www.wandodo.com/" target="_blank" title="玩多多"><img src="http://img.nextwar.cn/images/wanduoduo.gif" width="88" height="31"/></a>';
    footer+='<a href="http://www.51netu.com/" target="_blank" title="耐游"><img src="http://img.nextwar.cn/images/naiyou.gif" width="88" height="31"/></a>';
    footer+='<a href="http://www.9v8v.com " target="_blank" title="9v8v"><img src="http://img.nextwar.cn/images/9v8v.gif" width="88" height="31"/></a>';

  
  footer+='<a href="http://www.wangye2.com/" target="_blank" title="WangYe2"><img src="http://img.nextwar.cn/images/wangye2.gif" width="88" height="31"/></a>';
  footer+='<a href="http://www.173eg.com/" target="_blank" title="东游网"><img src="http://img.nextwar.cn/images/173eg.jpg" width="88" height="31"/></a><a href="http://www.wowowang.com" target="_blank" title="窝窝网"><img src="http://img.nextwar.cn/images/wowowang.gif" width="88" height="31"/></a><a href="http://www.07073.com/" target="_blank" title="07073"><img src="http://img.nextwar.cn/images/07073.jpg" width="88" height="31"/></a><a href="http://www.com92.com/" target="_blank" title="久玩网络"><img src="http://img.nextwar.cn/images/com92.jpg" width="88" height="31"/></a><a href="http://www.116wy.com/" target="_blank" title="116wy"><img src="http://img.nextwar.cn/images/116wy.gif" width="88" height="31"/></a><a href="http://www.ledao.cn/" target="_blank" title="265G"><img src="http://img.nextwar.cn/images/ledao.jpg" width="88" height="31"/></a><a href="http://www.gamecheng.com/" target="_blank" title="265G"><img src="http://img.nextwar.cn/images/gamecity.gif" width="88" height="31"/></a><a href="http://www.265g.com/" target="_blank" title="265G"><img src="http://img.nextwar.cn/images/Mt-265g.gif" width="88" height="31"/></a><a href="http://www.52pk.com/" target="_blank" title="52PK"><img src="http://img.nextwar.cn/images/Mt-52pk.jpg" width="88" height="31" /></a><a target="_blank" href="http://www.5617.com/" title="5617"><img src="http://img.nextwar.cn/images/Mt-5617.jpg" width="88" height="31" /></a><a target="_blank" href="http://www.86wan.com/" title="86Wan"><img src="http://img.nextwar.cn/images/Mt-86wan.gif" width="88" height="31" /></a><a target="_blank" href="http://www.popwan.com/" title="泡泡玩"><img src="http://img.nextwar.cn/images/Mt_popwan.gif" width="88" height="31" /></a><a target="_blank" href="http://www.xunlei.com/" title="迅雷"><img src="http://img.nextwar.cn/images/Mt-xunlei.JPG" width="88" height="31" /></a><a href="http://www.zol.com.cn/" target="_blank" title="中关村在线"><img src="http://img.nextwar.cn/images/Mt-zol.jpg" width="88" height="31" /></a><a target="_blank" href="http://www.duowan.com/" title="多玩"><img src="http://img.nextwar.cn/images/Mt_duowan.jpg" width="88" height="31" /></a></div></div><div class="xuanchuan">抵制不良游戏　拒绝盗版游戏　注意自我保护　谨防受骗上当 适度游戏益脑　沉迷游戏伤身　合理安排时间　享受健康生活</div><div class="copyright" ><a href="/AboutUS.html">关于我们</a>| <a href="/Law.html">法律声明</a>| <a href="/Help.html">帮助中心</a>| <a href="/Job.html">招贤纳士</a>| <a href="/Rules.html">游戏规则</a><br/>欢动（北京）科技有限公司   文网文[2009]107号<br/>@2009 现代战争 <a href="http://www.miibeian.gov.cn" target="_blank">京ICP备09039662号</a> <a href="http://www.miibeian.gov.cn/" target="_blank">京ICP证：100047</a><br/> ISBN 978-7-900763-88-4</div>';
  document.getElementById("footer").innerHTML = footer;
}
function WriteLeft()
{
        var type = "n";
        if(document.getElementById("sLeft") != null)
        {
            type = "s";
        }
        if(document.getElementById("indexLog") != null)
        {
            InitIndexLoginLeft();
        }         
       if(null != document.getElementById("fightDiv"))
       {
            type = "f";
       }
    $.post("/ajaxrequests/LoginLeftAjax.aspx",{type:type},function(xml){
        if(document.getElementById("nLeft") != null)
        {
            document.getElementById("nLeft").innerHTML = xml;
        }
        if(document.getElementById("sLeft") != null)
        {
            document.getElementById("sLeft").innerHTML = xml;
        }
       if(null != document.getElementById("fightDiv"))
       {
          document.getElementById("fightDiv").innerHTML = xml;
       }
    });

    
}
function InitPage()
{
    WriteHeader();
    WriteFooter();
    WriteLeft();
       $("#webDiv").jMarquee({
    visible:9,
    step:1,
    direction:"left"
    });
}

function InitIndexPage()
{
    WriteFooter();
     $("#webDiv").jMarquee({
    visible:9,
    step:1,
    direction:"left"
    });   
}
function InitIndexHearder()
{
    WriteHeader();
}
function InitIndexLoginLeft()
{
    $.post("/ajaxrequests/LoginIndex.aspx",null,function(xml){ 
            if (xml.length != 0)
            {      
                document.getElementById("indexLog").innerHTML = xml; 
                $("#part_div").attr("class","part_02"); 
            }       
    }); 
}

function checkUserName(target,type)
{
  if(to(target).value !="")
    {
        if(!emailCheck(to(target)))
        {
           to("regErrorDiv").style.display = "";
            showErrorImg("userName",type);
           to("regErrorMessage").innerHTML = "Email不正确！请填写正确的邮箱地址！";
            
            return false;
        }
    }
   else
    {
       to("regErrorDiv").style.display = "";
       showErrorImg("userName",type);
       to("regErrorMessage").innerHTML = "Email不正确！请填写正确的邮箱地址！";
       return false;
    } 
    
    return true;
}
function checkPassword(target,type)
{
 if(to(target).value.length < 6 || to(target).value.length > 12){
     to("regErrorDiv").style.display = "";
     showErrorImg("password",type);
     to("regErrorMessage").innerHTML = "密码长度不正确！须由6～12位数字或字母组成！";
		return false;
	}
	else
	{
	    if (isChinese(to(target).value)){
            to("regErrorDiv").style.display = "";
            showErrorImg("password",type);
            to("regErrorMessage").innerHTML = "登录密码中不能包含中文，须由6～12位数字或字母组成！";             
		    return false;
	    }
	}
    to("regErrorDiv").style.display = "none";
    to("regErrorMessage").innerHTML = "";   
	showErrorImg("",type);
	return true;
}

function checkRegist(userName,password,confirmPassword,nickName,agreeMent,type)
{
   if(!checkUserName(userName,type))
   {
     return false; 
   } 
   if(!chekcNickName(nickName,type))
   {
     return false; 
   }
   if(!checkPassword(password,type))
   {
       return false; 
   }
   if(!checkConfirmPassword(password,confirmPassword,type))
   {
    return false; 
   }
   
    if(to(agreeMent).checked == false)
    {
       to("regErrorDiv").style.display = "";
       showErrorImg("",type);
       to("regErrorMessage").innerHTML = "请仔细阅读并接受“服务协议”！";  
	     return false ;
    }
   if(type == "index")
   {
        $.post("/ajaxrequests/RegisteAjax.aspx",{userName:to(userName).value,password:to(password).value,nickName:to(nickName).value},function(xml){
        if(xml=="1")
        {
            to("regDiv").style.display = "none";
            messageInfo("注册失败！","该Email和用户昵称都已被使用！","index");
            return;
        }
        else if(xml =="2")
        {
             to("regDiv").style.display = "none";
            messageInfo("注册失败！","该Email地址已被使用！","index");
            return ;
        }
        else if(xml =="3")
        {
         to("regDiv").style.display = "none";
            messageInfo("注册失败！","该用户昵称已被使用！","index");
            return;
        }
        else if(xml == "4")
        {
            to("regDiv").style.display = "none";
            messageInfo("注册失败！","密码长度不正确！","index");
            return;
        }
        else if(xml == "5")
        {
            to("regDiv").style.display = "none";
            messageInfo("注册失败！","您输入的昵称含有非法字符！","index");
            return;
        }
        else
        {
            WriteHeader();
            WriteLeft();
            var lastNum =  xml.substr(4);
            $.post("/ajaxrequests/RegisteSuccessAjax.aspx",{type:"registeSuccess"},function(data){
            to("regDiv").style.display = "none";
            to("messageDiv").style.display = "";       
to("messageDiv").innerHTML  = '<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr><td align="right" height="50"><a href="javascript:closeDivs()"><img src="http://img.nextwar.cn/images/close.gif" border="0" style="margin-right:20px;margin-top:16px;" /></a></td></tr></table><table width="98%" height="10" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td></td> </tr></table><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="top" class="reg_c5">&nbsp;</td></tr></table><table width="85%" height="81" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;"><tr><td valign="top" class="reg_c6"> 欢迎您加入《现代战争》，请前往战区立即投入战斗！</td></tr></table><table width="100%" height="60" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td width="20%" align="center">&nbsp;</td><td width="38%" align="left"><a target="_blank"  href="/interface/R3Login.aspx?si=4"><img src="http://img.nextwar.cn/images/index15.gif" width="164" height="43" /></a></td></tr></table>';
            to("messageDiv").className = "reg_div_2";
            to("alert_filter").style.display = "";
            });
           
        }
    
 });
   }
    return true;
 
}
function checkConfirmPassword(password,confirmPassword,type)
{
    if (to(password).value !=to(confirmPassword).value )
	{
	     to("regErrorDiv").style.display = "";
	     showErrorImg("confirm",type);
         to("regErrorMessage").innerHTML = "确认密码与登录密码不符！请重新输入！";  
		 return false; 
	}
	else
	{
	     to("regErrorDiv").style.display = "none";
         to("regErrorMessage").innerHTML = ""; 
         showErrorImg("",type);
	}
	return true;
}
function chekcNickName(nickName,type)
{
 if (to(nickName).value != "" ) {
			    if (!(checkInputChar(to(nickName).value))){
			        
	                to("regErrorDiv").style.display = "";
	                if(type == "reg")
	                {
	                    to("errRegNickName").style.display = "";
	                }
                    to("regErrorMessage").innerHTML = "用户昵称须由数字,字母或汉字组成！";  
				   return false; 
			    }else{
		               var strlength=0;
                       for (j=0;(j<to(nickName).value.length);j++)
                      {
                        if (isChinese(to(nickName).value.charAt(j))==true)
                            strlength=strlength + 2;
                        else
                            strlength=strlength + 1;
                      }			    
			         if (strlength < 4 || strlength >16){
			                to("regErrorDiv").style.display = "";
			            showErrorImg("nickName",type);
                        to("regErrorMessage").innerHTML = "用户昵称长度不正确！须由4-16位字符组成！";  
     
			            return false; 
		            }
			        if(!(Filter_SQL_key(to(nickName).value))){
		                to("regErrorDiv").style.display = "";
		                 showErrorImg("nickName",type);
                        to("regErrorMessage").innerHTML = "用户昵称包含非法信息！请重新填写！";  
				        return false; 
			        }
			        else
			        {
			            showErrorImg("",type);
			        }
			        
			    }
		}else{
                 to("regErrorDiv").style.display = "";
                  showErrorImg("nickName",type);
                 to("regErrorMessage").innerHTML = "请填写用户昵称！";  
				 return false ;
		}
		return true;
}
function showErrorImg(target,type)
{
    var userNameError = "none";
    var passwordError = "none";
    var confirmError = "none";
    var nickNameError = "none";
    
    switch(target)
    {
            case "userName":
                userNameError ="";
             break;
             case "password":
             passwordError ="";
            break;
             case "confirm":
             confirmError ="";
            break;
             case "nickName":
             nickNameError ="";
            break; 
                
    }
    if(type == "reg")
    {
        to("errRegUserName").style.display = userNameError;
        to("errRegPassword").style.display = passwordError;
        to("errRegConfirmPassword").style.display = confirmError;
        to("errRegNickName").style.display = nickNameError;
    }
    else
    {
        to("errIndexUserName").style.display = userNameError;
        to("errIndexPassword").style.display = passwordError;
        to("errIndexConfirm").style.display = confirmError;
        to("errIndexNickName").style.display = nickNameError;
    }
       
}
function checkRegistName(nameType,target,type)
{
    var name ="";
    if(nameType == "userName")
    {
        name = to(target).value;
        if(checkUserName(target,type))
        {
            $.post("/ajaxrequests/CheckRegistInfo.aspx",{type:"userName",name:name},function(xml){
                if(xml == "1"){
                        to("regErrorDiv").style.display = "";
                        to("regErrorMessage").innerHTML = "很遗憾！该用户名已被使用！";  
                        showErrorImg("userName",type);                      
                        
                }
                else{
                     to("regErrorDiv").style.display = "none";
                     to("regErrorMessage").innerHTML = "";  
                     showErrorImg("",type);
                }
            });
        }
    }
    else if(nameType == "nickName"){
        name = to(target).value;
        if(chekcNickName(target,type)){
            $.post("/ajaxrequests/CheckRegistInfo.aspx",{type:"nickName",name:name},function(xml){
                if(xml == "1"){
                    to("regErrorDiv").style.display = "";
                    showErrorImg("nickName",type);
                    to("regErrorMessage").innerHTML = "很遗憾！该用户昵称已被使用！";  
                }else{
                     to("regErrorDiv").style.display = "none";
                       to("regErrorMessage").innerHTML = "";  
                     showErrorImg("",type);
                }
            });
        }
    }
}

function gamea()
{
		window.open ('/game/game.html', '轰炸天堂岛', 'height=580, width=430, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')  
}
function gameb()
{
	    window.open ('/game/tank.html', '坦克大战', 'height=413, width=580, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')  

}
function gamepalya()
{
		window.open ('game/game.html', '轰炸天堂岛', 'height=580, width=430, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')  
}
function resetRegForm(userName,password,confirmPassword,nickName,type)
{
        to(userName).value = "";
        to(password).value = "";
        to(confirmPassword).value = "";
        to(nickName).value = "";
        to("regErrorDiv").style.display = "none";
        to("regErrorMessage").innerHTML = "";    
        showErrorImg("",type);
    
}
function showOrHidDiv(target)
{
    if( to(target).style.display == "none")
    {
        to(target).style.display = "block"
        to("webdiv1").style.display = "none";
        to("colseLink").className = "close"
       
    }
    else
    {
        to(target).style.display = "none"
         $("#webdiv1").show();
        //to("webdiv1").style.display = "block";
         to("colseLink").className = "open"
    }
}


function userLogin(userName,password,passwordKeepOn)
{
    var isKeepOn = false;
    if(to(userName).value == "" ||to(password).value =="")
    {
        messageInfo("登录失败！","登录信息不完整！请继续填写！");
    }
    else
    {
            if(!emailCheck(to(userName)))
            {
                messageInfo("登录失败！","登录邮箱格式不正确！");
            }
            else
            {
                if(passwordKeepOn != undefined)
                {
                    isKeepOn = to(passwordKeepOn).checked;
                }

               $.post("/ajaxrequests/loginajax.aspx",{loginName:to(userName).value,loginPassword:to(password).value,isKeepOnPassword:isKeepOn},function (xml)
            {
                if(xml.indexOf("&") >0)
                {
                   var result = xml.substr(0,xml.indexOf("&"));
                   if(result == 1){
                       messageInfo("登录失败！","登录邮箱或密码不正确！");
                   }
                   else if(result == 3)
                   {
                      messageInfo("登录失败！","您的账号已被禁用！请及时联系网站管理人员！");
                   }
                   else
                   {
                      WriteHeader();
                      WriteLeft();
                   }
                  
                }
            });
          }
    }
}
function ShowRegisteForm()
{
    to("regDiv").style.display = "";
    to("messageDiv").style.display = "none";
    to("alert_filter").style.display="";
    var registeContent = '<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr><td align="right" height="50"><a href="javascript:closeDivs()"><img src="http://img.nextwar.cn/images/close.gif" border="0" style="margin-right:20px;margin-top:16px;" /></a></td> </tr></table><table width="98%" height="50" border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="http://img.nextwar.cn/images/reg_01.gif" align="absmiddle" class="imgs"  style="display:none"  id="regErrorDiv"/><font class="fCCFF00"  id="regErrorMessage"></font></td> </tr></table><table width="98%"  border="0"  cellpadding="0" cellspacing="0"> <tr> <td width="110" height="35"align="right" valign="top" class="reg_c2">E-mail</td> <td width="151" height="35" valign="top"><input name="indexUserName" maxLength="30"  id="indexUserName"  onblur="checkRegistName(\'userName\',\'indexUserName\',\'index\');" type="text" class="reg_input" /></td>   <td width="27" height="35" valign="top"><img src="http://img.nextwar.cn/images/reg_02.gif" id="errIndexUserName"  style="display:none" /></td>   <td  height="35" valign="top" class="reg_c3">·为保证帐号的安全性，请填写真实有效的邮箱地址</td> </tr><tr><td width="110" height="35" align="right" valign="top" class="reg_c2">用户昵称</td><td width="151" height="35" valign="top"><input id="indexNickName" maxlength="16"  onblur="checkRegistName(\'nickName\',\'indexNickName\',\'index\');" type="text" class="reg_input" /></td> <td width="27" height="35" valign="top"><img id="errIndexNickName"  style="display:none"  src="http://img.nextwar.cn/images/reg_02.gif"/></td> <td height="35" valign="top" class="reg_c3">·请输入您在游戏中所使用的昵称，长度4-16位字符、不含特殊符、一个汉字占两字符</td></tr><tr>  <td width="110" height="35" align="right" valign="top" class="reg_c2">密码</td><td width="151" height="35" valign="top"><input  name="indexPassword" id="indexPassword"  maxLength="12" onblur="checkPassword(\'indexPassword\',\'index\')"  type="password" class="reg_input" /></td> <td width="27" height="35" valign="top"><img id="errIndexPassword"  style="display:none"  src="http://img.nextwar.cn/images/reg_02.gif" /></td>   <td  height="35" valign="top" class="reg_c3">·密码长度6～12位字符、字母区分大小写</td></tr><tr> <td width="110" height="35" align="right" valign="top" class="reg_c2">确认密码</td> <td width="151" height="35" valign="top"><input name="indexConfirm" maxLength="12" onblur="checkConfirmPassword(\'indexPassword\',\'indexConfirm\',\'index\')" id="indexConfirm" type="password" class="reg_input" /></td>   <td width="27" height="35" valign="top"><img id="errIndexConfirm"  style="display:none"  src="http://img.nextwar.cn/images/reg_02.gif" /></td>  <td  height="35" valign="top" class="reg_c3">·再次确认登录密码</td> </tr></table><table width="98%" height="40" border="0" align="center" cellpadding="0" cellspacing="0"> <tr>  <td width="134"></td><td width="417" valign="middle" class="reg_c4"><input id="indexAgreement" checked="checked" name="indexAgreement" type="checkbox" class="reg_cinput" value="" /> 我已经仔细阅读并同意《<a href="/protocol.html"  target="_blank">现代战争用户注册协议</a>》</td></tr></table><table height="50" border="0" cellpadding="0" cellspacing="0"><tr><td width="140"></td> <td width="184" valign="middle" class="reg_c4"><a style="cursor:pointer" onclick="checkRegist(\'indexUserName\',\'indexPassword\',\'indexConfirm\',\'indexNickName\',\'indexAgreement\',\'index\')"><img src="http://img.nextwar.cn/images/btn_teg.gif" /></a></td><td width="238" valign="middle" class="reg_c4"><a href="javascript:resetRegForm(\'indexUserName\',\'indexNickName\',\'indexPassword\',\'indexConfirm\',\'index\')"><img src="http://img.nextwar.cn/images/btn_reg2.gif"  /></a></td></tr></table>';
    to("regDiv").innerHTML =registeContent;    
}
function messageInfo(title,message,type,error)
{
    if(type == undefined)
    {
        type = "";
    }
    to("alert_filter").style.display = "";
    var result = '<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center"><tr> <td align="right" height="50"><a href="javascript:closeDivs()" ><img id="messageInfoClose" src="http://img.nextwar.cn/images/close.gif" border="0" style="margin-right:20px;margin-top:16px;" /></a></td></tr></table><table width="98%" height="10" border="0" align="center" cellpadding="0" cellspacing="0"><tr> <td></td></tr></table><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="top" class="reg_c5">'+title+'</td></tr></table><table width="85%" height="81" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;"> <tr><td valign="top" class="reg_c6">'+message+'</td></tr></table><table width="100%" align="center" cellpadding="0" cellspacing="0"><tr><td colspan="3" align="center"><a href="javascript:closeDivs(\''+type+'\')"><img  id="messageInfoConfirm" src="http://img.nextwar.cn/images/btn06.gif"/></a></td></tr></table>';
  to("messageDiv").innerHTML  = result;
  to("messageDiv").style.display = "";
  to("messageInfoConfirm").style.display = "";
  to("messageInfoClose").style.display = "";
  return false;

}

function closeDivs(option)
{
    if(option  != undefined &&option != '')
    {
        to("messageDiv").style.display = "none";
        to("regDiv").style.display = "";  

    }
    else
    {
        to("messageDiv").innerHTML = "";
        to("messageDiv").style.display = "none";
        if(to("regDiv") != null)
        {
            to("regDiv").style.display = "none";  
        }
        to("alert_filter").style.display = "none";
    }
}

function drawCode()
{
    $.post("/ajaxrequests/RegisteSuccessAjax.aspx",{type:"drawCode"},function(xml){ 
        to("messageDiv").className = "reg_div_2   reg_div_3";
        if(xml.indexOf("@") != -1)
        {
            messageInfo("激活码领取成功！","恭喜您，指挥官！您已成功领取《现代战争》激活码！<br /> 请登录首页，点击“查看激活码/礼品券”按钮进行查看！<br /><b>您是第 <span style='color:#C3D304'>" + xml.substr(0,xml.indexOf("@")) + "</span> 位激活码领取人</b><br/>您的激活码为<b><span style='color:#C3D304'>"+xml.substr(xml.indexOf("@")+1)+"</span></b>");
        }
        else
        {
            messageInfo("激活码领取失败！",xml);
        }
     });
}

function doChkChecked()
{
  to("logState").checked=!to("logState").checked;
}

function getUserPaih(){
    
    //$("#userPaih").load("http://124.238.249.105:8080/game/Ranking.aspx");
    //$("#userPaih").load("http://www.nextwar.cn/aaa/default.aspx");
    $("#userPaih").load("/UserPh.ashx");
}

function CallBack()
{
     $.post("/ajaxrequests/CallBack.aspx",{}, function(xml){});
}
window.setInterval("CallBack()",30000);

//add by HS, 2010-01-15
function indexFlash(strSwfUrl,strFlashVars,intWidth,intHeight){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+intWidth+'" height="'+intHeight+'" align="top">');
    document.write('<param name="flashVars" value="'+strFlashVars+'" />');
    document.write('<param name="movie" value="'+strSwfUrl+'" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="wmode" value="transparent" />');
    document.write('<embed src="'+strSwfUrl+'" flashVars="'+strFlashVars+'" quality="high" align="top" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+intWidth+'" height="'+intHeight+'"></embed>');
    document.write('</object>');
}

//add by HS 2010-01-18
(function($) { 
 $.fn.jMarquee = function(o) {
    o = $.extend({
    speed:30,
    step:1,//滚动步长
    direction:"up",//滚动方向
    visible:1//可见元素数量
    }, o || {});
    //获取滚动内容内各元素相关信息
    var i=0;
    var div=$(this);
    var ul=$("div",div);
    var tli=$("a",ul);
    var liSize=tli.size();
    if(o.direction=="left")
        tli.css("float","left");
    var liWidth=tli.innerWidth();
    var liHeight=tli.height();
    var ulHeight=liHeight*liSize;
    var ulWidth=liWidth*liSize;
    //如果对象元素个数大于指定的显示元素则进行滚动，否则不滚动。
    if(liSize>o.visible){
        ul.append(tli.slice(0,o.visible).clone())  //复制前o.visible个li，并添加到ul的最后
        li=$("a",ul);
        liSize=li.size();
        
          //给滚动内容添加相关CSS样式
        div.css({"position":"relative","overflow":"hidden"});
        ul.css({"position":"relative","margin":"0","padding":"0","list-style":"none"});
        li.css({"margin":"0","padding":"0","position":"relative"});
        switch(o.direction){
            case "left":
                div.css("width",(liWidth*o.visible)+"px");
                ul.css("width",(liWidth*liSize)+"px");
                li.css("float","left");
                break;
            case "up":
                div.css({"height":(liHeight*o.visible)+"px"});
                ul.css("height",(liHeight*liSize)+"px");
                break;
        }
        
       
        var MyMar=setInterval(ylMarquee,o.speed);
        ul.hover(
            function(){clearInterval(MyMar);},
            function(){MyMar=setInterval(ylMarquee,o.speed);}
        );
    };
    function ylMarquee(){
         
        if(o.direction=="left"){
            
            if(div.scrollLeft()>=parseInt(ulWidth)-10){
                div.scrollLeft(0);
               
            }
            else
            {
                var leftNum=div.scrollLeft();
                leftNum+=parseInt(o.step);
                div.scrollLeft(leftNum)
               
            }
        }
        
        if(o.direction=="up"){
            if(div.scrollTop()>=ulHeight){
               div.scrollTop(0);
                
            }
            else{
               var topNum=div.scrollTop();
               topNum+=parseInt(o.step);
               div.scrollTop(topNum);
            }
        }
        
    };
   
}; 
     
})(jQuery);
 
$(document).ready(function(){
 
});
   