var url=document.location.host;
if(url=="")
{
  url="www1.soufun.com";
}
var hosturl1="http://"+url+"/card/card_manage/";
if(document.location.host=="test.soufun.com" || document.location.host=="t.soufun.com")
{
    hosturl1="http://"+url+"/card/card_manage/";
}
if(url.indexOf("cardmanager.light")>-1)
{
  hosturl1="http://"+url+"/card_manage/";
}
  //alert(hosturl1);
var XMLHttpReq = false
var ClassNameMess
var SetNameMess

//创建XMLHttpRequest对象
function createXMLHttpRequest() 
{
if(window.XMLHttpRequest) //Mozilla 浏览器
{ 
    XMLHttpReq = new XMLHttpRequest();
}
else if (window.ActiveXObject) // IE浏览器
{ 
    try 
    {
        XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) 
    {
        try 
        {
            XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) {}
    }
}
}
//    //发送请求函数
function sendRequest(KeWord,CityName) 
{
var LinkUrl=hosturl1+"AjaxProc/SearchAjax.aspx?keyword="+KeWord+"&cityname="+escape(CityName);
//alert(LinkUrl); 
createXMLHttpRequest();  
XMLHttpReq.open("GET", LinkUrl, true);
XMLHttpReq.onreadystatechange = processResponse;//指定响应函数
XMLHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
XMLHttpReq.send(null);  // 发送请求
}
function processResponse() 
{        
if (XMLHttpReq.readyState == 4) // 判断对象状态
{          
if (XMLHttpReq.status == 200) // 信息已经成功返回，开始处理信息
{ 
    if(XMLHttpReq.responseXML.getElementsByTagName("projname")!=null)
    {
    
        var ProjFlag=XMLHttpReq.responseXML.getElementsByTagName("projname");
        var NewCode=XMLHttpReq.responseXML.getElementsByTagName("sign");
        var PrintDiv="";
        for(var i=0;i<ProjFlag.length;i++)
        {
            PrintDiv +="<div style =\"width:97%;height:18px;padding-left:3px;overflow:hidden;text-overflow:clip ;white-space:nowrap;text-align:left;line-height:18px;cursor:pointer;\" onclick =\"GetListValue('"+NewCode[i].firstChild. nodeValue+"','"+ProjFlag[i].firstChild. nodeValue+"')\" onmouseover=\"this.style.background='#0a246a';this.style.color='white';\" onmouseout=\"this.style.background='white';this.style.color='black';\">"+ProjFlag[i].firstChild. nodeValue+"</div> ";
        }
        document.getElementById("FloorSeach").innerHTML=PrintDiv;
//        alert(document.getElementById("FloorSeach").innerHTML);
        DivSetBasicVisible(true,'FloorSeach');
    
    } 
    else
    {
        document.getElementById("FloorSeach").style.display="none";
        alert('没有找到您要的小区!');
        document.getElementById("strFloorName").value="";
    }      
}
}
}
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 SprocessResponse() 
//    {        
//        if (XMLHttpReq.readyState == 4) // 判断对象状态
//        {          
//            if (XMLHttpReq.status == 200) // 信息已经成功返回，开始处理信息
//            { 
//                //alert(XMLHttpReq.responseText);
//                ChanDivInto(XMLHttpReq.responseText);
//                
//            }
//       }
//    }
//    
//    
//    function ChanDivInto(PrintMess)
//    {
//        PrintMess=PrintMess.replace('\r\n','');
//        if(PrintMess=='' || PrintMess==',')
//        {
//            
//            document.getElementById("FloorSeach").style.display="none";
//            alert('没有找到您要的楼盘项目!');
//            document.getElementById("strFloorName").value="";
//        }
//        else
//        {
//            var MessList;
//            var PrintDiv="";
//            MessList=PrintMess.split(',');
//           
//            if(MessList.length==2)
//            {
//                //$("strFloorName").value=MessList[0];
//                if($("SelectFloorItem").options.length>=5)
//                {
//                    alert('楼盘项目已达到最大限制,请删除后再添加!');
//                    return;
//                }
//                else
//                {
//                    if($("strFloorName").value!="" && $("strFloorName").value==MessList[0])
//                    {
//                        var iFlag=0;
//                        for(var iLint=0;iLint<$("SelectFloorItem").options.length;iLint++)
//                        {
//                            if($("SelectFloorItem").options[iLint].value == $("strFloorName").value)
//                            {
//                                iFlag=1;
//                            }
//                        }
//                        if(iFlag==0)
//                        {
//                            $("SelectFloorItem").options.add(new Option($("strFloorName").value,$("strFloorName").value));
//                            $("SelectFloorItem").style.background="#EEEEEE";
//                            //$("chk_SelectFloorItem").innerHTML="";
//                            //$("strFloorName").value="";
//                        }
//                        else
//                        {
//                            alert('您已经添加了该楼盘项目!');
//                            $("strFloorName").value="";
//                        }
//                    }
//                    else
//                    {
//                        for(var i=0;i<MessList.length;i++)
//                        {
//                            if(i!=MessList.length-1)
//                            {
//                            PrintDiv +="<div style =\"width:100%;height:18px;line-height:18px;cursor:pointer;\";  onclick =\"GetListValue('"+MessList[i]+"')\" onmouseover=\"this.style.background='#0a246a';this.style.color='white';\" onmouseout=\"this.style.background='white';this.style.color='black';\">"+MessList[i]+"</div> ";
//                            }
//                        }     
//                        
//                        document.getElementById("FloorSeach").style.display="block";
//                        document.getElementById("FloorSeach").innerHTML=PrintDiv;
//                        DivSetBasicVisible(true,'FloorSeach');
//                    }
//                }
//                $("FloorSeach").style.display="none";
//            }
//            else
//            {
//                for(var i=0;i<MessList.length;i++)
//                {
//                    if(i!=MessList.length-1)
//                    {
//                    PrintDiv +="<div style =\"width:100%;height:18px;line-height:18px;cursor:pointer;\" onclick =\"GetListValue('"+MessList[i]+"')\" onmouseover=\"this.style.background='#0a246a';this.style.color='white';\" onmouseout=\"this.style.background='white';this.style.color='black';\">"+MessList[i]+"</div> ";
//                    }
//                } 
//                document.getElementById("FloorSeach").style.display="block";
//                document.getElementById("FloorSeach").innerHTML=PrintDiv;
//                DivSetBasicVisible(true,'FloorSeach');   
//            }
//        }
//    }
//    //获取元素的具体位置
//    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;    
//}
 

