﻿
function clearText(obj)
{
    if (obj.value=="楼盘名称,拼音首字母")
    {
        obj.value="";
        obj.className="ftGray_7E";
    }
        obj.className="ftGray";
}

function setTextValue(obj)
{
    if (obj.value=="")
    {
        obj.className="ftGray_7E";    
        obj.value="楼盘名称,拼音首字母";        
    }else
        obj.className="ftGray";
}

function psearch(city,areas,price,pType,keyword)
{
    var strUrl="",selectedArea="";
    var strCity=city!=null?city.options[city.selectedIndex].value:"";
    var strAreas=areas.options[areas.selectedIndex].value;
    var strPrice=price.options[price.selectedIndex].value;
    var strType=pType.options[pType.selectedIndex].value;
    
    if (strAreas!='0'&& strAreas!="")
    {
        selectedArea=strAreas;
    }
    else if (strCity!='0'&& strCity!="")
    {
        selectedArea=strCity;        
    }
    
    if (selectedArea!='')
    {
        strUrl+=(strUrl==""?"/newhouse/search.aspx?Areas="+selectedArea:"&Areas="+selectedArea);
    }    
    if(strPrice!='0'&&strPrice!="")
    {
        strUrl+=(strUrl==""?"/newhouse/search.aspx?Price="+strPrice:"&Price="+strPrice);
    }   
    if(strType!='物业类型'&&strType!='')
    {
        strUrl+=(strUrl==""?"/newhouse/search.aspx?Type="+escape(strType):"&Type="+escape(strType));
    }
    if (keyword.value!="楼盘名称,拼音首字母"&&keyword.value!="")
    {
        strUrl+=(strUrl==""?"/newhouse/search.aspx?Keyword="+escape(keyword.value):"&Keyword="+escape(keyword.value));  
    }
    if (strUrl=="")
    {
        window.open("/newhouse/search.aspx");
    }
    else
    {
        window.open(strUrl);
        
        //debugger;
        //document.forms[0].action=strUrl;
        //document.forms[0].target="_blank";
        //document.forms[0].submit();
        //myWindow.open(strUrl);               
    } 
}

function keyDown(evt,city,areas,price,pType,keyword)
{
     //onkeydown="javascript:return okd(event);" 
    if(evt.keyCode==13 )
    {
        //doClick2(submitBoutton)
        //debugger;
        psearch(document.getElementById(city),document.getElementById(areas),document.getElementById(price),document.getElementById(pType),document.getElementById(keyword))
        return false;
    }
}
