﻿var currentFullUrl = new String( window.location );    
                        
if( currentFullUrl.toLowerCase().indexOf("www.waheaven.com")>=0 ||
    currentFullUrl.toLowerCase().indexOf("http://waheaven.com")>=0  )
    {
        //默认自己大主页
    }
    else
    {
        //重庆例外
        if( currentFullUrl.toLowerCase().indexOf("cq.waheaven.com")>=0 )
        {
		 
            window.location = "/ss/cq/Index11.aspx";
	    
        }

	//军魂例外
        else if( currentFullUrl.toLowerCase().indexOf("junhun.waheaven.com")>=0 )
        {
		 
            window.location = "/ss/jh/Index11.aspx";
	    
        }

        else
	{
        	//非主站例外
        	window.location = "/Index.aspx";
	}
    }                      
                                  
                                        
    function loginKeyDown()
    {
        if(window.event.keyCode == 13)
        {
            loginMember();
        }
    }
                                        
    //------
                                        
    function loginMember()
    {
        if( document.getElementById("txtNo").value.trim() == "")
        {
            alert("请输入用户名。");
            document.getElementById("txtNo").focus();
            return;
        }
                                        
        if( document.getElementById("txtPassword").value.trim() == "")
        {
            alert("请输入密码。");
            document.getElementById("txtPassword").focus();
            return;
        }
                                        
        var oAjaxResult = AjaxHandler.loginMember(
        document.getElementById("txtNo").value.trim(),
        document.getElementById("txtPassword").value.trim()
        );
                                        
        if(oAjaxResult.isSuccess)
        {
            window.top.location = "/MemberCenter/Index.aspx";
            //window.location = "/IndexLogin.aspx?time=" + (new Date()).getTime();
        }
        else
        {
            alert( oAjaxResult.message );
        }
    }
    
    
    
    function searchMemorialHall()
    {
        var txtSearchKey = window.document.getElementById("txtSearchKey");
        if(txtSearchKey.value == "" || txtSearchKey.value == txtSearchKey.defaulttext)
        {
            alert("请先请输入天堂人民姓名或纪念馆编号。");
            txtSearchKey.focus();
        }
        else
        {
            window.open("/Memorials/Search.aspx?Key=" + escape( txtSearchKey.value ));
        }
    }
            
    function txtSearchKey_keydown()
    {
        if(event.keyCode == 13 )
        {   
            searchMemorialHall();
            return false;
        }
    }
    
    
    
    
    function SumCount(){
        var rb= Math.floor(Math.random()*2+2),tab=document.getElementById("CountNum");   
        tab.innerHTML= parseInt(rb,10)+parseInt(tab.innerHTML,10);
    }
    window.setInterval("SumCount()", 2000); 
    
    function SumCount1(){
        var rb= Math.floor(Math.random()*4+2),tab=document.getElementById("CountNum1");   
        tab.innerHTML= parseInt(rb,10)+parseInt(tab.innerHTML,10);
    }
    window.setInterval("SumCount1()", 2000);
