﻿// JScript 文件


function onlod(name,b)
{
    var mycookie = document.cookie+";"; 
    //indexOf查找子字符串的，如果没有找到，就返回 -1。
    var start1 = mycookie.indexOf(name + "=");
    var start2 = mycookie.indexOf(b + "=");
    //alert(document.cookie);
    if (start1== -1)
    {

     document.getElementById("login").style.display="";
     document.getElementById("loginend").style.display="none";

    }
    else
    {
        start=mycookie.indexOf("=",start1)+1; 
        start3=mycookie.indexOf("=",start2)+1; 
        var end = mycookie.indexOf(";",start);
        var end1 = mycookie.indexOf(";",start3);
        if (end==-1)
        {
         end=mycookie.length;}
         var value=unescape(mycookie.substring(start,end));
          var value2=unescape(mycookie.substring(start3,end1));
         if (value==null)
         {
          document.getElementById("login").style.display="";
          document.getElementById("loginend").style.display="none";

         }
         else
         {
         
           var username=value;
           var jibie=value2;
	       document.getElementById("login").style.display="none";
	       document.getElementById("loginend").style.display="";
	       document.getElementById("UN").innerText=username;
	       document.getElementById("JB").innerText=jibie;
        	       
         }

    }

}
function login()
{//alert("1");
    var yonghuming=document.getElementById("SelectUser").value;
    var mima=document.getElementById("PWD").value;
   // alert("2");
    if(yonghuming==""||mima=="")
    {
        alert("用户名或者密码不能为空");
        return;
    }
    var url="login.aspx";
    var str="<UserName>"+yonghuming+"</UserName><PWD>"+mima+"</PWD>";
    ret=SendHttp(url,str);
    
	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.loadXML(ret);
	if (xmlDoc.documentElement!=null)
	{
	    var oRoot = xmlDoc.documentElement;
	    var check=oRoot.childNodes(0).text
	   // alert(check);
	    if(check=="OK")
	    {
	        var username=oRoot.childNodes(1).text;
	        var jibie=oRoot.childNodes(2).text;
	        document.getElementById("login").style.display="none";
	        document.getElementById("loginend").style.display="";
	        document.getElementById("UN").innerText=username;
	        document.getElementById("JB").innerText=jibie;
	        //alert("2");
	        //window.location = "User.aspx"
	         
             var today = new Date();
             var expire = new Date();
          expire.setTime(today.getTime() + 7200000); 
	    document.cookie="a="+username+";expires="+expire.toGMTString()+";path= "+ "/"+";domain= "+ ".bidcenter.com.cn"; 
        document.cookie="b="+jibie+";expires="+expire.toGMTString()+";path= "+ "/"+";domain= "+ ".bidcenter.com.cn"; 
          //document.cookie="a="+username+";expires="+expire.toGMTString();
          //document.cookie="b="+jibie+";expires="+expire.toGMTString();
               //alert(document.cookie);
	            return;
	    }
	    else
	    {
	    //alert("4");
	      document.getElementById("login").style.display="";
	         document.getElementById("loginend").style.display="none";
	        alert("用户名或者密码不正确");
	        return;
	    }
	}
}
//xmlhttp处理
		function SendHttp(sAspFile,sSend)
		{
		//alert("4");
		if (navigator.onLine==false) 
			{return ""} 
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		 
			xmlhttp.Open("POST", sAspFile, false);
		//   alert(xmlhttp.status);
			try { xmlhttp.Send("<root><record>"+sSend+"</record></root>");}
			catch (exception)
			{
			//alert("5")
			}
			try
			{ var str11=xmlhttp.responseText //系统错误: -1072896748。
			//alert("6");
			}
			catch (exception)
			{if (exception.description==': -1072896748。') 
				{	
	 			str11=""
				}
			}
				delete xmlhttp;
			return str11
		}
  
//删除cookie
function ClearCookie() 
{ 
　 var strCookie = document.cookie;
　 var arrCookie = strCookie.split(";");
　 var i;
　 var expires = new Date(); 
　 expires.setDate(expires.getTime() - 1000); 
　 // document.cookie = 'c1='+ escape('c1value');
　  //alert(document.cookie);
　 for(i=0; i<arrCookie.length; i++)
　 {
　 　 document.cookie = arrCookie[i].split('=')[0]+'=null;expires=' + expires.toGMTString()+";path= "+ "/"+";domain= "+ ".bidcenter.com.cn"; 
　 　 //alert(arrCookie[i]+';expires=' + expires.toGMTString());
　 }
　 
　 document.getElementById("SelectUser").value="";
   document.getElementById("PWD").value="";
　 document.getElementById("login").style.display="";
   document.getElementById("loginend").style.display="none";
    return;
　 // alert(document.cookie);
} 
function baocuo()
{
    alert("暂未开通!");
}

   /*
 * 函数说明：去除头尾空格
 * 参数：	字符串
 * 返回值：	无
 * 时间：2005-5-12
 */
function trim(inputString) {
	return inputString.replace(/^ +/,"").replace(/ +$/,"");
}
   /*function checkform(){
	var v = trim(document.getElementById("searchform").keywords.value);
	if(v.length > 100){
		alert("您输入的关键字过长！");
		return false;
	}
	if(v == ""  || v.substring(0,3) =="请输入") {
		alert("请输入关键字！");
		return false;
	}
	}*/
//    function gonggao()
//    {
//        //关键字
//       var guanjianzi=document.frm1.keywords.value;
//       var v = trim(guanjianzi);
//	if(v.length > 100){
//		alert("您输入的关键字过长！");
//		return false;
//	}
//	if(v == ""  || v.substring(0,3) =="请输入") {
//		alert("请输入关键字！");
//		return false;
//	}
//      
//       //地区
//       var diqu=document.frm1.province.value;
//        //行业
//       var hangye=document.frm1.field.value;
//         //搜索时间
//       var time=document.frm1.leftday.value;
//    //alert(hangye);
//     parent.window.location="Seach.aspx?code="+guanjianzi+"&address="+diqu+"&tag="+hangye+"&time="+time+"&type=1";
//     
//    }
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   ///
   //　　　　　　　　　　　　　　　　　　　　　　　搜索提交处理
   ////
   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function yugao() {
    //关键字field 
    //alert("sdfsdf");
    var guanjianzi1 = document.frm2.keywords.value;
    var re = /\s+/g;
    guanjianzi1 = guanjianzi1.replace(re, " ");
    var guanjianzi2 = guanjianzi1.replace(new RegExp("\ ", "gm"), ".");
    var guanjianzi = guanjianzi2.replace(new RegExp("，", "gm"), ",");
    guanjianzi = guanjianzi.replace("+", ",")
    //var pattern = /^([\u4e00-\u9fa5]|[a-zA-Z0-9]|[,]|[.]){1,40}$/;
    var pattern = /^([\u4e00-\u9fa5]|[a-zA-Z0-9]|[-]|[_]){1,40}$/;
    var v = trim(guanjianzi);
    if (v != "") {
        if (v.length > 40) {
            alert("您输入的关键字过长！");
            return false;
        }
        if (v == "请输入关键字！" || v.substring(0, 3) == "请输入") {
            alert("请输入关键字！");
            return false;
        }
        if (!pattern.test(v)) {
            alert("您的关键词有误，请重新输入!");
            return false;
        }

        var yi = v.substring(0, 1);
        if (yi == "." || yi == ",") {
            alert("您的关键词有误，第一个字符不能为空格或加号!");
            return false;
        }
        var end = v.charAt(v.length - 1);
        if (end == "." || end == ",") {
            alert("您的关键词有误，最后一个字符不能为空格或加号!");
            return false;
        }
    }
    //标题
    var diqu = document.frm2.field.value;
    //地区
    var jq = document.frm2.jq.value;
    //时间
    var time = document.frm2.time.value;
    if (time == "4") {
        var now = new Date();   
        var hh = now.getHours(); //截取小时
        var zao = "9";
        var wan = "18";
        if (zao < hh && wan > hh) {
            alert("由于数据量过大，近一年的数据仅在非工作时间提供检索!");
            return false;
        }
    }

    //类别
    var type = document.frm2.type.value;
    //alert(type);
    if (type == "0") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=0";
        window.open(aaa);
    }
    if (type == "1") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=1";
        window.open(aaa);
    }
    if (type == "2") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=2";
        window.open(aaa);
    }
    if (type == "3") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=3";
        window.open(aaa);
    }
    if (type == "4") {// alert("aaa");
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=4";
        // alert(aaa);
        // window.location.href="Seach.aspx?code="+guanjianzi+"&time="+time+"&type=4&tag="+diqu;

        window.open(aaa);
    }
    if (type == "5") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=5";
        window.open(aaa);
    }
    if (type == "6") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=6";
        window.open(aaa);
    }
    if (type == "7") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&time=" + time + "&type=7";
        window.open(aaa);
    }
    if (type == "8") {
        var aaa = "Seach.aspx?code=" + guanjianzi + "&tag=" + diqu + "&address=" + jq + "&&time=" + time + "type=8";
        window.open(aaa);
    }
    if (type == "9") {
        var aaa = "Seachold.aspx?code=" + guanjianzi + "&tag=" + diqu + "";
        window.open(aaa);
    }
    if (type == "10") {
        var aaa = "Seachzixu.aspx?code=" + guanjianzi + "&tag=" + diqu + "";
        window.open(aaa);
    }
    if (type == "11") {
        var aaa = "Seachhy.aspx?code=" + guanjianzi + "&tag=" + diqu + "&type=&startime=&endtime=";
        window.open(aaa);
    }
    if (type == "12") {
        var aaa = "Seachvip.aspx?code=" + guanjianzi + "&tag=" + diqu + "&type=&startime=&endtime=";
        window.open(aaa);
    }
}
	/////////////////////////////////////////////
	/////////////////////
	////////////////////
	/////////////////
     
   

