function $(obj) {return document.getElementById(obj);}
function V(id){ return document.getElementById(id); }
function SendToAjax()
{
    var KeyWord="";
    var CityName="";
    if($("strFloorName").value!="")
    {
        KeyWord=$("strFloorName").value;
        if($("select_city2").value!="")
        {
            CityName=$("select_city2").value;
            sendRequest(KeyWord,CityName);
        }
        else
        {
            alert('请选择省市！');
        }
    }
}
function CheckSubit()
{
    if($("hidCity").value.replace( /^\s*/, "")=="")
    {
        alert("请选择省市！");
        return false;
    }
}
//使用IFRAME垫底来解决IE6.0下的SELECT控件问题
function DivSetBasicVisible(state,proj)
{
    var DivRef = $(proj);
    var IfrRef = $('DivSeach');
    if(state)
    {
        DivRef.style.display = "block";
        IfrRef.style.width = DivRef.offsetWidth;
        IfrRef.style.height = DivRef.offsetHeight;
        IfrRef.style.top = DivRef.style.top;
        IfrRef.style.left = DivRef.style.left;
        IfrRef.style.zIndex = DivRef.style.zIndex - 1;
        IfrRef.style.display = "block";
    }
    else
    {
        DivRef.style.display = "none";
        IfrRef.style.display = "none";
    }
}
function ShowDefault()
{
    if(document.getElementById ("strFloorName").value=="")
    {
        document.getElementById ("strFloorName").value="请输入楼盘名称";
    }
}

function ShowDefaultBuyEnd()
{
    if(document.getElementById ("strFloorNameBuyEnd").value=="")
    {
        document.getElementById ("strFloorNameBuyEnd").value="请输入楼盘名称";
    }
}
//引处注释掉了，以便各调用页可以自行修改层的位置
//function ShowBasicDistrict(evnt)
//{
//    if(document.getElementById ("strFloorName").value=="请输入楼盘名称")
//    {
//        document.getElementById ("strFloorName").value="";
//    }
//    var ieNo;
//    with(navigator) 
//    {      
//        if(appName == "Microsoft Internet Explorer") 
//        { 
//           ieNo = parseInt(appVersion.split(" ")[3]); 
//        } 
//    }
//    
//    var PfSeach=$("FloorSeach");
//    if(ieNo==null)
//    {
//        if(document.body.clientWidth>960)
//        {
//            PfSeach.style.width = 99+"px";
//            PfSeach.style.top = 310+"px";
//            PfSeach.style.left = 315+"px";
//        }
//        else
//        {
//            PfSeach.style.width = 99+"px";
//            PfSeach.style.top = 310+"px";
//            PfSeach.style.left = 290+"px";
//        }
//    }
//    else if(ieNo=="7")
//    {
//        if(document.body.clientWidth>960)
//        {
//            PfSeach.style.width = 101+"px";
//            PfSeach.style.top = 310+"px";
//            PfSeach.style.left = 313+"px";
//        }
//        else
//        {
//            PfSeach.style.width = 101+"px";
//            PfSeach.style.top = 310+"px";
//            PfSeach.style.left = 290+"px";
//        }
//    }
//    else
//    {
//        if(document.body.clientWidth>960)
//        {
//            PfSeach.style.width = 101+"px";
//            PfSeach.style.top = 332+"px";
//            PfSeach.style.left = 393+"px";
//        }
//        else
//        {
//            PfSeach.style.width = 101+"px";
//            PfSeach.style.top = 332+"px";
//            PfSeach.style.left = 371+"px";
//        }
//    }
//}

function ShowBasicDistrict(evnt)
{
    if(document.getElementById ("strFloorName").value=="请输入楼盘名称")
    {
        document.getElementById ("strFloorName").value="";
    }
    var ieNo;
    with(navigator) 
    {      
        if(appName == "Microsoft Internet Explorer") 
        { 
           ieNo = parseInt(appVersion.split(" ")[3]); 
        } 
    }
    
    var PfSeach=$("FloorSeach");
            var o = getPosition(document.getElementById("strFloorName"));
//            PfSeach.style.width = 150+"px";
        if($("HManagepage")){
            PfSeach.style.top = o.top-130+'px';
            PfSeach.style.left=o.left-100+'px';
         }else{
            PfSeach.style.top = o.top+20+"px";
            PfSeach.style.left=o.left+"px";
         }
           //$("SelectFloorItem").style.display='none';
//PfSeach.style.top = "200px";
           // PfSeach.style.left="350px";
}


function ShowBasicDistrictBuyEnd(evnt)
{
    if(document.getElementById ("strFloorNameBuyEnd").value=="请输入楼盘名称")
    {
        document.getElementById ("strFloorNameBuyEnd").value="";
    }
    var ieNo;
    with(navigator) 
    {      
        if(appName == "Microsoft Internet Explorer") 
        { 
           ieNo = parseInt(appVersion.split(" ")[3]); 
        } 
    }
    
    var PfSeach=$("FloorSeachBuyEnd");
            var o = getPosition(document.getElementById("strFloorNameBuyEnd"));
//            PfSeach.style.width = 150+"px";
        if($("HManagepage")){
            PfSeach.style.top = o.top-130+'px';
            PfSeach.style.left=o.left-100+'px';
         }else{
            PfSeach.style.top = o.top+20+"px";
            PfSeach.style.left=o.left+"px";
         }
           //$("SelectFloorItem").style.display='none';
//PfSeach.style.top = "200px";
           // PfSeach.style.left="350px";
}

function getIE(e)
{ 
	//var t=e.offsetTop; 
	var l=e.offsetLeft; 
	while(e=e.offsetParent)
	{ 
		//t+=e.offsetTop; 
		l+=e.offsetLeft; 
	} 

	return l;
}
function getIE_Top(e)
{ 
	var t=e.offsetTop; 
	while(e=e.offsetParent)
	{ 
		t+=e.offsetTop; 
	} 

	return t;
}

 function getPosition(obj)
    { 
        var top = 0,left = 0;
        do 
        {
           top += obj.offsetTop;
           left += obj.offsetLeft;
        }
        while ( obj = obj.offsetParent );      
        var o = new Object();      
        o.top = top;
        o.left = left;    
        return o;    
    }

function GetListValue(NewCode,SeleValue)
{
    $("strFloorName").value=SeleValue;
    if($("SelectFloorItem").options.length>=12)
    {
        alert('楼盘已达到最大限制,请删除后再添加!');
        $("FloorSeach").style.display="none";
        $("DivSeach").style.display="none";
        $("SelectFloorItem").style.display='';
        document.getElementById ("strFloorName").value="";
        return;
    }
    else
    {
//        var HiddObj=$("HiddProj").value;
//        var HiddArr=HiddObj.split("|");
        var iFlag=0;
        if($("strFloorName").value!="")
        {
          
            
            if($("SelectFloorItem")){
                var len =$("SelectFloorItem").options.length;  
                if(len>0){
                    for(var i = 0; i< len; i++)
                    {    //alert($("SelectFloorItem").options[i].text);
                        if($("SelectFloorItem").options[i].text
                        && $("SelectFloorItem").options[i].text
                            ==$("strFloorName").value){   
                            iFlag=1;
                        } 
                    }
                }
            }
            
            if(iFlag==0)
            {
                $("SelectFloorItem").options.add(new Option($("strFloorName").value,NewCode));
//                $("HiddProj").value=$("HiddProj").value+$("strFloorName").value.replace( /[' '|'　']*$/, '')+"|";
                $("SelectFloorItem").style.background="#EEEEEE";
                $("strFloorName").value="请输入楼盘名称";
            }
            else
            {
                alert('您已经添加了该楼盘!');
                $("strFloorName").value="请输入楼盘名称";
            }
             $("SelectFloorItem").style.display='';
        }
    }
    $("FloorSeach").style.display="none";
    DivSetBasicVisible(false,'FloorSeach');
    //alert($("HiddProj").value);
}
function EndToAjax()
{
    $("FloorSeach").style.display="none";
}
function ItemDelete()
{
    var length = $("SelectFloorItem").options.length - 1;   
    for(var i = length; i >= 0; i--)
    {    
        if($("SelectFloorItem")[i].selected == true)
        {   
            $("HiddProj").value=$("HiddProj").value.replace($("SelectFloorItem").options[i].text+"|",'');
            $("SelectFloorItem").options[i] = null;
        }    
    }
    //alert($("HiddProj").value);
}
function ShowBgColor(obj)
{
    if(obj.length<=0)
    {
        obj.style.background='#FF0000';
    }
    else
    {
        obj.style.background='#EEEEEE';
    }
}
function SeleAllProj()
{
    var objProj=$("SelectFloorItem");
    //alert(objProj.options.length);
    for(var i=0;i<objProj.options.length;i++)
    {
        objProj[i].selected=true;
    }
}
function rel_chk(obj)
{   
    val=obj.value;
    $("nameflag").value=="1"
    BsendRequest("realname",val);
    
    if(val=="" )
    {
        $("RealErr").innerHTML="请输入姓名";
        return false;
    }
    if(GetStrLen(val)>10)
    {
        $("RealErr").innerHTML="您输入不能超过5个字";
        return false;
    }
    
    var badChar ;
    badChar ="ABCDEFGHIJKLMNOPQRSTUVWXYZＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺ"; 
    badChar += "abcdefghijklmnopqrstuvwxyzａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ"; 
    badChar += "0123456789０１２３４５６７８９　"; 
    badChar += " "+"　";
    badChar += "`~!@#$%^&()-_=+]\\\\|:;\\;\\\'<,>?/～！·＃￥％……—＊…（）——＋—｜—｝—｛—“：《》？／—。，；‘［—］—、＝—－—";
    for(var i=0;i<val.length;i++)
    { 
        var c = val.charAt(i);//字符串str中的字符 
        if(badChar.indexOf(c) > -1)
        { 
            $("RealErr").innerHTML="请输入正确的姓名";
            return false; 
        } 
    }
    if($("nameflag").value=="0")
    {
        return false; 
    }
    $("RealErr").innerHTML="";
    return true;
}
function rel_focus()
{
    $("RealErr").innerHTML="";
}
function GetStrLen(key)
{
var l=escape(key),len
len=l.length-(l.length-l.replace(/\%u/g,"u").length)*4
l=l.replace(/\%u/g,"uu")
len=len-(l.length-l.replace(/\%/g,"").length)*2
return len
}


