function keyDown(){ $(elem).keydown(function(event){ if(event.keyCode==13){ if(document.getElementById("user").value != "") { checkLogin(); } if(document.getElementById("username").value != "") { checkReg(); } } });}function changetab(id){ switch(id) { case "tab_1": document.getElementById("tab_1").style.display="block"; document.getElementById("tab_2").style.display="none"; document.getElementById("tab_card_1").style.display="block"; document.getElementById("tab_card_2").style.display="none"; break; case "tab_2": document.getElementById("tab_1").style.display="none"; document.getElementById("tab_2").style.display="block"; document.getElementById("tab_card_2").style.display="block"; document.getElementById("tab_card_1").style.display="none"; break; }}function tabnews(id){ switch(id) { case "list_1": document.getElementById("list_1").style.display="block"; document.getElementById("list_2").style.display="none"; document.getElementById("list_3").style.display="none"; document.getElementById("list_4").style.display="none"; break; case "list_2": document.getElementById("list_1").style.display="none"; document.getElementById("list_2").style.display="block"; document.getElementById("list_3").style.display="none"; document.getElementById("list_4").style.display="none"; break; case "list_3": document.getElementById("list_1").style.display="none"; document.getElementById("list_2").style.display="none"; document.getElementById("list_3").style.display="block"; document.getElementById("list_4").style.display="none"; break; case "list_4": document.getElementById("list_1").style.display="none"; document.getElementById("list_2").style.display="none"; document.getElementById("list_3").style.display="none"; document.getElementById("list_4").style.display="block"; break; }}function tabliansai(id){ switch(id) { case "liansai_1": document.getElementById("liansai_1").style.display="block"; document.getElementById("liansai_2").style.display="none"; document.getElementById("liansai_3").style.display="none"; break; case "liansai_2": document.getElementById("liansai_1").style.display="none"; document.getElementById("liansai_2").style.display="block"; document.getElementById("liansai_3").style.display="none"; break; case "liansai_3": document.getElementById("liansai_1").style.display="none"; document.getElementById("liansai_2").style.display="none"; document.getElementById("liansai_3").style.display="block"; break; }}function addFavorite(url,title){ var fav_url = url; var fav_title = title; if (document.all && window.external){ window.external.AddFavorite(fav_url,fav_title); }else if (window.sidebar){ window.sidebar.addPanel(fav_title,fav_url,""); }else{ alert(","); }}function isNumberOrLetter(s){ var regu = "^[0-9a-zA-Z\_]+$"; var re = new RegExp(regu); if (re.test(s)) { return true; }else{ return false; }}//function checkReg(){ var msg = new Array( "", "", "", "", "4-32,", "4-20", "", "", ",", "", "", "", "" ) var chk = true; if($("#username").val() == ""){ chk = false; alert(msg[0]); return false; } else if($("#username").val().length < 4 || $("#username").val().length>20){ chk = false; alert(msg[4]); return false; } else if(!isNumberOrLetter($("#username").val())){ chk = false; alert(msg[5]); return false; } if(chk){ //Ajax $.get("/source/Post.php", {checkuser:"checkusername", username:$("#username").val(),ran: Math.random()}, function(data){ if(data == -3) { chk = false; alert(msg[9]); return false; } }); } if(chk){ if($("#password").val()==""){ chk = false; alert(msg[1]); return false; } else if($("#password").val().length <4 || $("#password").val().length>32){ chk = false; alert(msg[5]); return false; } else if($("#password").val() == $("#username").val()){ chk = false; alert(msg[6]); return false; } else if($("#password").val()=="123456"){ chk = false; alert(msg[7]); return false; } } if(chk){ if($("#password").val() != $("#confirmpassword").val()){ chk = false; alert(msg[2]); return false; } } if(chk){ $("#loginbtn").attr("disabled","true"); $.post("/source/Post.php", {password:$("#password").val(), username:$("#username").val(),confirmpassword:$("#confirmpassword").val(),action:$("#action").val(),from:$("#refer").val(),ran: Math.random()}, function(data){ // $("#loginbtn").removeAttr("disabled"); if(data > 1) { //$("#logintip").html("<div class='serverstatus'><a href='http://web.7k7k.com/index.php?controller=user&action=game&sid=8'> [1](<font color='#ff0000'></font>)</a><br /><a href='http://web.7k7k.com/index.php?controller=user&action=game&sid=9'> [2](<font color='#ff0000'></font>)</a></div>"); //alert(',,...'); //top.location.href='http://web.7k7k.com/index.php?controller=user&action=game&sid=9'; alert(','); top.location.href='http://web.7k7k.com/games/ddt/index.html?ran='+Math.random(); //top.location.href='http://web.7k7k.com/games/ddt/server_list.htm'; } else if(result == -3) { alert(""); return false; } else if(result == -1) { alert(","); return false; } else if(result == -2) { alert(""); return false; } else if(result == -4) { alert(""); return false; } else if(result == -5) { alert(""); return false; } else if(result == 0) { alert(""); return false; } else { alert(","); return false; } }); }}function checkLogin(){ var msg = new Array( "", "", "4-32,", "4-20", "", "", "", "," ) var chk = true; if($("#user").val() == ""){ chk = false; alert(msg[0]); return false; } else if($("#user").val().length <4 || $("#user").val().length>32){ chk = false; alert(msg[2]); return false; } if($("#pass").val()==""){ chk = false; alert(msg[1]); return false; } else if($("#pass").val().length <4 || $("#pass").val().length>32){ chk = false; alert(msg[3]); return false; } if($("#action2").val() != "login"){ chk = false; alert(msg[4]); return false; } if(chk){ $("#loginbtn2").attr("disabled","true"); $.post("/source/Post.php", {password:$("#pass").val(), username:$("#user").val(),action:$("#action2").val(),ran: Math.random()}, function(data){ $("#loginbtn2").removeAttr("disabled"); if(data == 1) { $("#loginbtn2").removeAttr("disabled"); //$("#logintip").html("<div class='serverstatus'><a href='http://web.7k7k.com/index.php?controller=user&action=game&sid=8'> [1](<font color='#ff0000'></font>)</a><br /><a href='http://web.7k7k.com/index.php?controller=user&action=game&sid=9'> [2](<font color='#ff0000'></font>)</a></div>"); alert(','); top.location.href='http://web.7k7k.com/games/ddt/index.html?ran='+Math.random(); //top.location.href='http://web.7k7k.com/games/ddt/server_list.htm'; } else if(data == -1) { alert(","); return false; } else if(data == -2) { alert(","); return false; } else if(data == -3) { alert(""); return false; } else if(data == -4) { alert(""); return false; } else if(data == 0) { alert(","); return false; } }); }}function readCookie(name) {var cookieValue = "";var search = name + "=";if (document.cookie.length > 0){ offset = document.cookie.indexOf(search); if (offset