﻿
    var hellotext="Welcome to Hueway technogoly";
    var thetext="";
    var started=false;
    var step=0;
    var times=1;

    function welcometext()
    {
      times--
      if (times==0)
      { 
        if (started==false)
        {
          started = true;
          window.status = hellotext;
          setTimeout("anim()",1); 
        }
        thetext = hellotext;
      }
    }
    function showstatustext(txt)
    {
      thetext = txt;
      setTimeout("welcometext()",4000)
      times++
    }

    function anim()
    {
      step++
      if (step==7) {step=1}
      if (step==1) {window.status='>==='+thetext+'===<'}
      if (step==2) {window.status='=>=='+thetext+'==<='}
      if (step==3) {window.status='>=>='+thetext+'=<=<'}
      if (step==4) {window.status='=>=>'+thetext+'<=<='}
      if (step==5) {window.status='==>='+thetext+'=<=='}
      if (step==6) {window.status='===>'+thetext+'<==='}
      setTimeout("anim()",200);
    }

function InitWeb()
{
    welcometext();
    document.title= document.title+"- cartridge.cn";
}
//function InitContacts()
//{
//    for(var i=1;i<13;i++)
//    {
//        document.getElementById("server"+i).style.display = "none";
//    }
//    document.getElementById("server2").style.display = "block";
//}
function nocopy()

{
//event.returnValue=false;

}
function stop(){

//return false;

}
//document.oncontextmenu=stop;

function StoreInit()
{
    var lis =document.getElementById("ProductStore").getElementsByTagName("li");
    for(var i=0;i<lis.length;i++)
    {
        lis[i].style.background="#FFB6B6";
        i = i+1;
    }
}
function ShowMember(obj,num)
{
    document.getElementById("iframText").innerHTML= obj.innerHTML;
    document.getElementById("bannerContent").innerHTML= obj.innerHTML;
    document.title= obj.innerHTML+"- cartridge.cn";
    var lis = document.getElementById("aboutul").getElementsByTagName("li");
   for(var i=0;i<lis.length;i++)
   { 
        lis[i].getElementsByTagName("a")[0].style.color="#999";
        lis[i].getElementsByTagName("a")[0].style.background="#FFF";
   }
    obj.style.color="#fff";
    obj.style.background ="#16387c";
    
    document.getElementById("MyFrame").src="/member/"+num+".aspx";
}


function showMsn(tag)
{
    var msn = document.getElementById(tag);
    if(msn.style.display != "none")
        msn.style.display ="none";
    else
        msn.style.display = "block";
}
//function ShowServerInfo(id)
//{
//    for(var i=1;i<15;i++)
//    {
//        document.getElementById("server"+i).style.display = "none";
//    }
//    document.getElementById(id).style.display = "block";
//}
function backTop()
{
		window.onscroll=null;
        document.documentElement.scrollTop-=Math.ceil(document.documentElement.scrollTop*2);
};
function GetParam()
{
    var url = document.location.href;
    var name="";
    if (url.indexOf("=")>0)
    {
        name = url.substring(url.indexOf("=")+1,url.length);
    }
    else
    {
    var url=document.location.pathname;//获取完整URL    
    var tmp= new Array();
    tmp=url.split("/");   
    var pp = tmp[tmp.length-1];  
    tmp=pp.split("."); 
    name =tmp[0];
    }
    return name;
};

function ProductInit()
{
    document.getElementById("MyFrame").src = "/discuss/Default.aspx?aid="+ GetParam();
};

function ServerInfoMsn1(obj)
{
    var lis =document.getElementById("AllServerInfoMsn").getElementsByTagName("li");
    for(var i=0;i<lis.length;i++)
    {
        lis[i].style.display = "none";
    }
    document.getElementById(obj).style.display = "block";
}

//function onloadMove()
//{
//    var id = GetParam();
//    if(id!="Contacts")
//    {
//        document.getElementById("MyFrame").src = "/Contact/4.aspx?id="+id;
//    }
//    else
//    {
//        document.getElementById("MyFrame").src = "/Contact/1.aspx";
//    }
//}

function LoadBrand(TypeValue)
{
    var xmlhttp = new JavaScript.Common.HttpRequest();
    xmlhttp.Url ="/Action/GetBrand.aspx";
    xmlhttp.Method = "POST";
    xmlhttp.addFormData("TypeValue",TypeValue);
    xmlhttp.OnComplete = LoadBrand_Comlete;
    xmlhttp.OnError = LoadBrand_Error;
    xmlhttp.DoCallBack(); 

}

function LoadBrand_Comlete(responseText, responseXML)
{    
    if(responseText!="")
    {
    var strs = new Array();
    var obj = new Array();
    strs = responseText.split("#");
    for (j = 0; j < strs.length; j++)
    {
        obj[j] = eval("("+ strs[j] + ")");
        
    }  
    var count=0;    
    document.getElementById("Select2").options.innerHTML="";    
    document.getElementById("Select2").options[0]= new Option("--Select--","-1");    
    for(i=0;i<strs.length;i++)    
    { 
         count++;    
         document.getElementById("Select2").options[count]= new Option(obj[i].C_Title,obj[i].C_RootID);   

    } 
    }
    else
    {
        alert("response Text is null");
    }
};

function LoadBrand_Error(status, statusText, responseText)
{    
    window.location=window.location;
};

function LoadModel(TypeValue)
{
    var xmlhttp = new JavaScript.Common.HttpRequest();
    xmlhttp.Url ="/Action/GetModel.aspx";
    xmlhttp.Method = "POST";
    xmlhttp.addFormData("TypeValue",TypeValue);
    xmlhttp.OnComplete = LoadModel_Comlete;
    xmlhttp.OnError = LoadModel_Error;
    xmlhttp.DoCallBack(); 

}

function LoadModel_Comlete(responseText, responseXML)
{    
    if(responseText!="")
    {
        var strs = new Array();
        var obj = new Array();
        strs = responseText.split("#");
        for (j = 0; j < strs.length; j++)
        {
            obj[j] = eval("("+ strs[j] + ")");
            
        }  
        var count=0;    
        document.getElementById("Select3").options.innerHTML="";    
        document.getElementById("Select3").options[0]= new Option("--Select--","-1");    
        for(var i=0;i<strs.length;i++)    
        {    
                 count++;    
                 document.getElementById("Select3").options[count]= new Option(obj[i].FullName,obj[i].ID);    
        } 
    }
    else
    {
        alert("response Text is null");
    }
};

function LoadModel_Error(status, statusText, responseText)
{    
    window.location=window.location;
};

function ChangeUrl(ProductId)
{
    document.getElementById("SelectRuslt").href = "/product.aspx?id="+ProductId;
}

    var agree = 1;
    ////////////////////////////////////////////////////////////////
   

//    function CheckUserName()
//    {
//        document.getElementById("error_name").innerText="";
//        var name = document.getElementById("signup_name1").value;
//        var xmlhttp = new JavaScript.Common.HttpRequest();
//        xmlhttp.Url ="/Action/CheckUserName.aspx";
//        xmlhttp.Method = "POST";
//        xmlhttp.addFormData("name",name);
//        xmlhttp.OnComplete = CheckUserName_Comlete;
//        xmlhttp.OnError = CheckUserName_Error;
//        xmlhttp.DoCallBack();
//        var flag = false;
//        $.ajax({
//            type:"POST",
//            url: "/Action/CheckUserName.aspx",
//            cache:false,
//            async:false,
//            datatype:"test",
//            data:{name : name},
//            success:function(data){
//                    if(data.toString()!="-1")
//                    {
//                        document.getElementById("error_name").innerText="your name is used";
//                    }
//                }
//        });

//    
//    }
    
    function CheckUserName_Comlete(responseText, responseXML)
    {    
        if(responseText!="-1")
        {
           document.getElementById("error_name").innerText="your name is used";
        }
        else
        {
          
        }
    };
    
    function CheckUserName_Error(status, statusText, responseText)
    {    
        alert('网络错误，请重试！');
    };
    
    
    function CheckEmail()
    {

         document.getElementById("error_email").innerText="";
         var strm = document.getElementById("signup_e_mail1").value;   //提交mail地址的文本框
         var regm = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;//验证Mail的正则表达式,^[a-zA-Z0-9_-]:开头必须为字母,下划线,数字,
         if (!strm.match(regm) && strm!="")
         {
             document.getElementById("error_email").innerText="youe E-Mail is wrong";
             return "0";
         } 
         else{
         return "1";
         }
    }
    function CheckComplint()
    {
        if(CheckEmail()=="1"&&document.getElementById("signup_name1").value!="")
        {
            document.getElementById("input").value = document.getElementById("input").innerText;
            return "1";
        }
        else
        {
            alert("Please enter complete information");
            return "0";
        }
    }
    function CheckPassword()
    {
        var p1 = document.getElementById("signup_password1").value;
        var p2 = document.getElementById("signup_password1_confirm").value;

        document.getElementById("error_password").innerText="";
        label="";
        if(p1!=p2)
        {
              document.getElementById("error_password").innerText="两次密码不一样";
              return "0";
        }
        else
            return "1";

    }
    
    function  CheckNull()
    {
         if(document.getElementById("signup_name1").value=="")
         {
             document.getElementById("error_name").innerText="Please write your name";
             return "0";
         }
         if(document.getElementById("signup_password1").value=="")
         {
            document.getElementById("error_password").innerText="please write your password";
            return "0";
         }
         if(document.getElementById("signup_e_mail1").value=="")
         {
            document.getElementById("error_email").innerText="please write your E_mail";
            return "0";
         }
    }
 
    function SignupData()
    {
        if(CheckNull()=="0"||CheckPassword()=="0"||CheckEmail()=="0")
        {
            return false;
        }
        else
        {
            return true;

        }
    }
    
function ShowDiv(obj)
{
	document.getElementById(obj).style.display='block';
	switch (obj)
	{
    case "Nav_List1":
          document.getElementById(obj).style.left = (document.body.offsetWidth/2)-480+"px";break;
    case "Nav_List2":
          document.getElementById(obj).style.left = (document.body.offsetWidth/2)-350+"px";break;
    case "Nav_List3":
          document.getElementById(obj).style.left = (document.body.offsetWidth/2)-420+"px";break;
    case "Nav_List4":
          document.getElementById(obj).style.left = (document.body.offsetWidth/2)-125+"px";break;
    }

}
function Hidden(obj)
{
   document.getElementById(obj).style.display='none';
}

function init_srolltext(){ 
 oScroll.scrollTop = 0; 
 setInterval('scrollUp()', 15); 
} 
 
function scrollUp(){ 
 if(isStoped) return; 
 curTop += 1; 
 if(curTop == 19) { 
 stopTime += 1; 
 curTop -= 1; 
 if(stopTime == 180) { 
 curTop = 0; 
 stopTime = 0; 
 } 
 }else{ 
 preTop = oScroll.scrollTop; 
 oScroll.scrollTop += 1; 
 if(preTop == oScroll.scrollTop){ 
 oScroll.scrollTop = 0; 
 oScroll.scrollTop += 1; 
 } 
 } 
} 
