﻿// JScript 文件
document.onclick=function()
{
    if(chkdiv("BL")){document.getElementById("BL").style.display="none";}
    if(chkdiv("SL")){document.getElementById("SL").style.display="none";}
    for(var i=1;i<5;i++)
    {
        if(chkdiv("A"+i)){document.getElementById("A"+i).style.display="none";}
    }
    if(chkdiv("prostr")){document.getElementById("prostr").style.display="none";}
    if(chkdiv("citystr")){document.getElementById("citystr").style.display="none";}
}

function $(obj)
{
	return document.getElementById(obj).value;
}
function isDigit(s)
{
	var patrn=/^[0-9]{1,20}$/;
	if (!patrn.exec(s)) return false
	return true
}
function isEmail(emailStr)
{
	var reg=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	return reg.test(emailStr)
}
function fTrim(str)
{
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

function print_content()  
{
  var code="<body onload=window.print()>"
  code+=document.getElementById("content").innerHTML;
  var newwin=window.open('','','');
  newwin.opener = null;
  newwin.document.write(code);
  newwin.document.close();
}
function chkdiv(divid)
{
    var chkid=document.getElementById(divid);
    if(chkid != null)
    {
        return true;
    }
    else 
    {
        return false;
    }
}
function setHome(title, url) {    
    if(!title) {    
        var title = window.document.title;    
    }    
    if(!url) {    
        var url = window.document.location;    
    }    
    try{    
        if (document.all){     
            window.external.addFavorite(url,title);     
        } else if (window.sidebar) {     
            window.sidebar.addPanel(title, url,"");     
        }     
    }catch(e){};    
} 
function copyToClipBoard()
{    
    var clipBoardContent="";      
    clipBoardContent+=this.location.href;    
    window.clipboardData.setData("Text",clipBoardContent);    
    alert("复制成功，请粘贴到你的QQ/MSN上告送给你的好友");
}
function len(s) 
{ 
	var l = 0; 
	var a = s.split(""); 
	for (var i=0;i<a.length;i++)
	{ 
		if (a[i].charCodeAt(0)<299) 
		{ 
			l++; 
		} 
		else 
		{ 
			l+=2; 
		} 
	} 
	return l; 
} 

function changex(obj)
{
    var allid=document.getElementById("allid").value;
    var _allid=allid.split(",");
    for(var i=0;i<_allid.length;i++)
    {
        document.getElementById("b_"+_allid[i]).className="";
        document.getElementById("c_"+_allid[i]).style.display="none";
    }
    document.getElementById("b_"+obj).className="els";
    document.getElementById("c_"+obj).style.display="block";
}
function changeq(obj)
{
    var allid=document.getElementById("alliid").value;
    var _allid=allid.split(",");
    for(var i=0;i<_allid.length;i++)
    {
        document.getElementById("b_"+_allid[i]).className="";
        document.getElementById("c_"+_allid[i]).style.display="none";
    }
    document.getElementById("b_"+obj).className="one";
    document.getElementById("c_"+obj).style.display="block";
}
function ShowA(obj)
{
    if(document.getElementById("A"+obj).style.display=="none")
    {
        document.getElementById("A"+obj).style.display="block";
    }
    else
    {
        document.getElementById("A"+obj).style.display="none";
    }
}
function ShowB()
{
    if(document.getElementById("BL").style.display=="block")
    {
        document.getElementById("BL").style.display="none";
    }
    else
    {
        document.getElementById("BL").style.display="block";
    }
}
function SelectB(objv,objn)
{
    document.getElementById("BL").style.display="none";
    document.getElementById("BV").value=objv;
    document.getElementById("BN").innerHTML=objn;
    if(objv==3)
    {
        objv=22;
    }
    var as=new Ajax();
	//指定错误容器
	as.OnErrorOBJ 	= document.getElementById("SL");
	//指定状态容器
	as.OnStateOBJ 	= document.getElementById("SL");
	//指定完成容器
	as.OnDownloadEndOBJ 	= document.getElementById("SL");
	as.method 	= "post";
	as.URL	= "/inc/Ajax.aspx"
	as.Sync	= true;
	as.Charset	= "gb2312";
    as.PostData ="type=4&value="+escape(objv);
	as.send();
	as=null;
	document.getElementById("SL").style.display="none";
}
function ShowS()
{
    if(document.getElementById("SL").style.display=="block")
    {
        document.getElementById("SL").style.display="none";
    }
    else
    {
        document.getElementById("SL").style.display="block";
    }
}
function SelectS(objv,objn)
{
    document.getElementById("SL").style.display="none";
    document.getElementById("SV").value=objv;
    document.getElementById("SN").innerHTML=objn;
}
function CheckForm()
{
    //var BV=document.getElementById("BV").value;
    //if(BV==0)
    //{
        //alert("至少要选择一个大类别！");
        //return false;
    //}
    var key=document.getElementById("key").value;
    if(key=="")
    {
        alert("搜索关键字不能为空！");
        return false;
    }
}
function SeaArea(obj)
{
    var as=new Ajax();
	//指定错误容器
	as.OnErrorOBJ 	= document.getElementById("areastr");
	//指定状态容器
	as.OnStateOBJ 	= document.getElementById("areastr");
	//指定完成容器
	as.OnDownloadEndOBJ 	= document.getElementById("areastr");
	as.method 	= "post";
	as.URL	= "/inc/Ajax.aspx"
	as.Sync	= true;
	as.Charset	= "gb2312";
    as.PostData ="type=5&value="+escape(obj);
	as.send();
	as=null;
}
function showarea()
{
    if(document.getElementById("citystr").style.display=="none")
    {
        document.getElementById("citystr").style.display="block";
    }
    else
    {
        document.getElementById("citystr").style.display="none";
    }
}
function SeaAreaA(obj)
{
    if(document.getElementById("prostr").style.display=="none")
    {
        document.getElementById("prostr").style.display="block";
    }
    else
    {
        document.getElementById("prostr").style.display="none";
    }
}
function showcity(obj,objname)
{
    document.getElementById("pname").innerHTML=objname;
    var as=new Ajax();
	//指定错误容器
	as.OnErrorOBJ 	= document.getElementById("citystr");
	//指定状态容器
	as.OnStateOBJ 	= document.getElementById("citystr");
	//指定完成容器
	as.OnDownloadEndOBJ 	= document.getElementById("citystr");
	as.method 	= "post";
	as.URL	= "/inc/Ajax.aspx"
	as.Sync	= true;
	as.Charset	= "gb2312";
    as.PostData ="type=6&value="+escape(obj);
	as.send();
	as=null;	
}
function showcityF(obj,objname)
{
    document.getElementById("pname").innerHTML=objname;
    var as=new Ajax();
	//指定错误容器
	as.OnErrorOBJ 	= document.getElementById("citystr");
	//指定状态容器
	as.OnStateOBJ 	= document.getElementById("citystr");
	//指定完成容器
	as.OnDownloadEndOBJ 	= document.getElementById("citystr");
	as.method 	= "post";
	as.URL	= "/inc/Ajax.aspx"
	as.Sync	= true;
	as.Charset	= "gb2312";
    as.PostData ="type=8&value="+escape(obj);
	as.send();
	as=null;	
}
function writearea(pid,cid,cname)
{
    document.getElementById("pid").value=pid;
    document.getElementById("cid").value=cid;
    document.getElementById("cname").innerHTML=cname;
    document.getElementById("citystr").style.display="none";
}
function tourl()
{

    var pid=document.getElementById("pid").value;
    var cid=document.getElementById("cid").value;
    if(cid=="0")
    {
        alert("请选择一个城市！");
        return false;
    }
    else
    {
        location.href="/Area/Lists/3/"+pid+"/"+cid+"/";
    }
}
function ChangeB(obj)
{
    var objv;
    if(obj==3)
    {
        objv=22;
    }
    else
    {
        objv=obj;
    }
    var as=new Ajax();
	//指定错误容器
	as.OnErrorOBJ 	= document.getElementById("c");
	//指定状态容器
	as.OnStateOBJ 	= document.getElementById("c");
	//指定完成容器
	as.OnDownloadEndOBJ 	= document.getElementById("c");
	as.method 	= "post";
	as.URL	= "/inc/Ajax.aspx"
	as.Sync	= true;
	as.Charset	= "gb2312";
    as.PostData ="type=7&value="+escape(objv);
	as.send();
	as=null;
}