﻿var xmlDom = false;//XMLHTTP对象
var arr_UserName = new Array();//保存已经查询过的 用户名
var arr_BackInfo = new Array();//保存查询过的用户名 是否可以注册的信息

//注册登录链接的字符串表示，当注销后显现在页面上
var LoginStr="<a href =\"javascript:loadcontrol('register.ashx');\" >注册</a>&nbsp; &nbsp;<a href =\"javascript:loadcontrol('login.ashx');\" >登录</a>&nbsp;";
//创建一个xmlhttp
try
{
	xmlDom = new ActiveXObject("Msxml2.XMLHTTP"); //IE高版本创建XMLHTTP
} 
catch (E)
{
	try
	{
		xmlDom = new ActiveXObject("Microsoft.XMLHTTP");//IE低版本创建XMLHTTP
	}
	catch (E)
	{
		  xmlDom = new XMLHttpRequest(); //兼容非ie浏览器，直接创建XMLHTTP对象
	}
} 


var intvboo=true;
var intid=1;
function $(ID) 
{  
return document.getElementById(ID); 
} 

function doso()
{
  if(document.getElementById('Text1').value==""||document.getElementById('Text1').value=="请输入搜索关键词")
  {
  alert("请输入关键字！");
  }
  else
  {
  window.open('search.aspx?searchtype=1&pname='+escape(document.getElementById('Text1').value)+'&ptype='+document.getElementById('ddlptype').value);
  }
}

function doso2()
{
  if(document.getElementById('Text1').value==""||document.getElementById('Text1').value=="请输入搜索关键词")
  {
  alert("请输入关键字！");
  }
  else
  {
  window.open('../search.aspx?searchtype=1&pname='+escape(document.getElementById('Text1').value)+'&ptype='+document.getElementById('ddlptype').value);
  }
}

function searchbyid()
{
  window.open('user/OrderModify.aspx?billid='+escape(document.getElementById('Tbillid').value));
}

//--------登录、注销--------------//
//加载用户控件的工具方法
function loadcontrol()
{
	var d = new Date();//创建一个随机时间，防止浏览器缓存
	var strURL = "login_cs.aspx?type=0&guid=" + d.getTime();//请求的url
	xmlDom.Open("get",strURL , true);
	xmlDom.onreadystatechange = function(){
	  if (xmlDom.readyState == 4 )//已经加载
	  if(xmlDom.status == 200)//服务器返回成功
	{
	document.getElementById("main").innerHTML=xmlDom.responseText;
	}
	}
	xmlDom.Send(xmlDom);	
}

//加载用户控件的工具方法
function loadcontrol2(controlname)
{
	var d = new Date();//创建一个随机时间，防止浏览器缓存
	var strURL = controlname+"?id=" + Math.random();//请求的url
	xmlDom.Open("get",strURL , true);
	xmlDom.onreadystatechange = function(){
	  if (xmlDom.readyState == 4 )//已经加载
	  if(xmlDom.status == 200)//服务器返回成功
	{
	document.getElementById("check").innerHTML=xmlDom.responseText;
	
	}
	
	  };
	xmlDom.Send(xmlDom);

}


//用户登录，检测用户名密码是否正确
function login(name,pass,check,savecookie)
{
	var d = new Date();
	var strURL = "login_cs.aspx?type=1&name=" + name +"&pass="+pass+ "&check="+check+"&savecookie="+savecookie+"&guid=" + d.getTime();//发送请求的路径
	xmlDom.Open("get",strURL , true);
	xmlDom.onreadystatechange = function()
	{
	if (xmlDom.readyState == 4 &&xmlDom.status == 200)
	{
	if(xmlDom.responseText=="0") //服务器返回0，代表账号密码验证失败
	    {	
	    document.getElementById("txt_name").value=document.getElementById("txt_pass").value="";
	    alert("账号或者密码错误！");
	    }
	    else if(xmlDom.responseText=="1")
	    {
	    document.getElementById("txt_name").value=document.getElementById("txt_pass").value=document.getElementById("txt_check").value="";
	    alert("验证码错误！");
	    }
	    else if(xmlDom.responseText=="2")
	    {
	    document.getElementById("txt_name").value=document.getElementById("txt_pass").value=document.getElementById("txt_check").value="";
	    alert("用户名未激活！");
	    }
	 else 
	    {//登录成功，显示登录成功页面
	 document.getElementById("main").innerHTML=xmlDom.responseText;  
	    
	    }
	    
	}
	}
	xmlDom.Send(xmlDom);
	
}
//用户注销退出
function signout()
{
	var d = new Date();
	var strURL = "signout.ashx?guid=" + d.getTime();
	xmlDom.Open("get",strURL , true);
	xmlDom.onreadystatechange = function()
	{
	if (xmlDom.readyState == 4 &&xmlDom.status == 200)
	    {
	    //注销成功，显示注销后的页面
	    alert("成功退出！");
	    setTimeout("javascript:loadcontrol('login_cs.aspx');", 1000);  
	    	    
	    }
	}
	xmlDom.Send(xmlDom);//发送请求
	
}



//<![CDATA[
//全局
/* GetObj begin */
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else if(document.layers){return eval("document.layers['"+objName+"']")}else{return eval('document.all.'+objName)}}
/* GetObj end */

/* 显示/隐藏一个容器 begin */
function hiddenObj(ObjId){GetObj(ObjId).style.display="none"}function showObj(ObjId){GetObj(ObjId).style.display="block"}
/* 显示/隐藏一个容器 end */

/* 改变className begin */
function chgClassName(ObjId,className){GetObj(ObjId).className=className}
/* 改变className end */

function showTime(){var date=new Date();var year=date.getYear();year=(year<2008)?(year+1900):year;var month=date.getMonth()+1;var day=date.getDate();var time=year+"."+month+"."+day;return time;}


/* ========== 舌签构造函数 begin ========== */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('r z=1g.1h.1i("1j")!=-1?I:9;s 6(h,j,k,l,m){5.1k="1.0";5.1l="1m";5.t=6.$(h);7(5.t==q){J B K("6(x)参数错误:x 对像存在!")};7(!6.u){6.u=B 1n()};5.x=6.u.v;6.u.17(5);5.1o=9;5.8=[];5.R=k==q?0:k;5.L=5.R;5.S=l==q?"1p":l;5.T=m==q?"":m;5.M=9;r n=U("6.u["+5.x+"].M = I");r o=U("6.u["+5.x+"].M = 9");7(z){5.t.C("V",n)}w{5.t.D("W",n,9)};7(z){5.t.C("X",o)}w{5.t.D("Y",o,9)};7(Z(j)!="1q"){j="1r"};j=j.1s();1t(j){N"V":5.y="W";E;N"X":5.y="Y";E;N"1u":5.y="1v";E;N"1w":5.y="1x";E;1y:5.y="1z"};5.18=s(a,b,c,d,e){7(6.$(a)==q){J B K("18(19)参数错误:19 对像存在!")};r f=5.8.v;7(c==""){c=q};5.8.17([a,b,c,d,e]);r g=U(\'6.u[\'+5.x+\'].F(\'+f+\')\');7(z){6.$(a).C("1A"+5.y,g)}w{6.$(a).D(5.y,g,9)};7(f==5.R){6.$(a).O=5.S;7(6.$(b)){6.$(b).A.P=""};7(c!=q){5.t.A.1a=c};7(d!=q){G(d)}}w{6.$(a).O=5.T;7(6.$(b)){6.$(b).A.P="1b"}};7(6.$(b)){7(z){6.$(b).C("V",n)}w{6.$(b).D("W",n,9)};7(z){6.$(b).C("X",o)}w{6.$(b).D("Y",o,9)}}};5.F=s(a){7(Z(a)!="10"){J B K("F(1c)参数错误:1c 不是 10 类型!")};r i;11(i=0;i<5.8.v;i++){7(i==a){6.$(5.8[i][0]).O=5.S;7(6.$(5.8[i][1])){6.$(5.8[i][1]).A.P=""};7(5.8[i][2]!=q){5.t.A.1a=5.8[i][2]};7(5.8[i][3]!=q){G(5.8[i][3])}}w 7(5.L==i){6.$(5.8[i][0]).O=5.T;7(6.$(5.8[i][1])){6.$(5.8[i][1]).A.P="1b"};7(5.8[i][4]!=q){G(5.8[i][4])}}};5.L=a};5.12=s(){7(H.v!=5.8.v){J B K("12()参数错误:参数数量与标签数量不符!")};r a=0,i;11(i=0;i<H.v;i++){a+=H[i]};r b=1B.12(),13=0;11(i=0;i<H.v;i++){13+=H[i]/a;7(b<13){5.F(i);E}}};5.Q=9;r p=q;5.14=1C;5.1D=s(a){7(Z(a)=="10"){5.14=a};1d(p);p=1E("6.u["+5.x+"].1e()",5.14);5.Q=I};5.1e=s(){7(5.Q==9||5.M==I){15};r a=5.L;a++;7(a>=5.8.v){a=0};5.F(a)};5.1F=s(){1d(p);5.Q=9}};6.$=s(a){7(16.1f){15 G(\'16.1f("\'+a+\'")\')}w{15 G(\'16.1G.\'+a)}}',62,105,'|||||this|SubShowClass|if|label|false|||||||||||||||||null|var|function|parentObj|childs|length|else|ID|eventType|isIE|style|new|attachEvent|addEventListener|break|select|eval|arguments|true|throw|Error|selectedIndex|mouseIn|case|className|display|autoPlay|defaultID|openClassName|closeClassName|Function|onmouseover|mouseover|onmouseout|mouseout|typeof|number|for|random|percent|spaceTime|return|document|push|addLabel|labelID|background|none|num|clearInterval|nextLabel|getElementById|navigator|appVersion|indexOf|MSIE|version|author|mengjia|Array|lock|selected|string|onmousedown|toLowerCase|switch|onclick|click|onmouseup|mouseup|default|mousedown|on|Math|5000|play|setInterval|stop|all'.split('|'),0,{}))
/* ========== 舌签构造函数 end ========== */
try{document.execCommand('BackgroundImageCache', false, true);}catch(e){}
//]]>
function $(ID) 
{ 
    return document.getElementById(ID); 
} 

function gonggao(chatwindow) { var MainWindow = window.open (chatwindow,            
"_blank","toolbar=no,location=no,menubar=no,scrollbars=no,width=400,height=450,resizeable=no,status=no");}



//获取服务器时间
//var hr = null;
//if (window . XMLHttpRequest)
//{
//        try {
//                hr = new XMLHttpRequest();
//        }
//        catch (e) {;
//        }
//}
//else if (window . ActiveXObject)
//{
//        try {
//                hr = new ActiveXObject("Msxml2.XMLHTTP");
//        }
//        catch (e) {;
//        }
//        if (hr == null) {
//                try {
//                        hr = new ActiveXObject("Microsoft.XMLHTTP");
//                }
//                catch (e) {;
//                }
//        }
//}

//hr.open("HEAD", ".", false);
//hr.send(null);
//var curDate = new Date;
//var myweekday=curDate.getDay();
//if(myweekday == 0)
//        weekday=" 星期日";
//        else if(myweekday == 1)
//        weekday=" 星期一";
//        else if(myweekday == 2)
//        weekday=" 星期二";
//        else if(myweekday == 3)
//        weekday=" 星期三";
//        else if(myweekday == 4)
//        weekday=" 星期四";
//        else if(myweekday == 5)
//        weekday=" 星期五";
//        else if(myweekday == 6)
//        weekday=" 星期六";
//var offsetTime = curDate - Date.parse(hr.getResponseHeader("Date"));
//setInterval(function() {
//                curDate.setTime(new Date - offsetTime);
//                document.getElementById("curTime").innerHTML = curDate.toLocaleString();
//        } , 1000);
//function writeDateInfo()
//{
//        var day="";
//        var month="";
//        var ampm="";
//        var ampmhour="";
//        var myweekday="";
//        var year="";
//        mydate=new Date();
//        myweekday=mydate.getDay();
//        mymonth=mydate.getMonth()+1;
//        myday= mydate.getDate();
//        myyear= mydate.getYear();
//        year=(myyear > 200) ? myyear : 1900 + myyear;
//        if(myweekday == 0)
//        weekday=" 星期日";
//        else if(myweekday == 1)
//        weekday=" 星期一";
//        else if(myweekday == 2)
//        weekday=" 星期二";
//        else if(myweekday == 3)
//        weekday=" 星期三";
//        else if(myweekday == 4)
//        weekday=" 星期四";
//        else if(myweekday == 5)
//        weekday=" 星期五";
//        else if(myweekday == 6)
//        weekday=" 星期六";
//        document.write(year+"年"+mymonth+"月"+myday+"日"+weekday);
//} 
var goto_top_type = -1;

var goto_top_itv = 0;
function goto_top_timer() {

      var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;

         var moveby = 15;          

         y -= Math.ceil(y * moveby / 100);

         if (y < 0) {

         y = 0;

         }          

         if (goto_top_type == 1) {

         document.documentElement.scrollTop = y;

         }

         else {

         document.body.scrollTop = y;

         }         

         if (y == 0) {

         clearInterval(goto_top_itv);

         goto_top_itv = 0;

         }

}
function goto_top() {

         if (goto_top_itv == 0) {

                  if (document.documentElement && document.documentElement.scrollTop) {

                  goto_top_type = 1;

                  }

                  else if (document.body && document.body.scrollTop) {

                  goto_top_type = 2;

                  }

                  else {

                  goto_top_type = 0;

                  }                   

                  if (goto_top_type > 0) {

                  goto_top_itv = setInterval('goto_top_timer()', 50);

                  }

         }

}