function set_filter(val){
    document.filterfrm.submit();
    return true;
}
function set_filter1(val){
	if(document.filterfrm.city.value=="" && document.filterfrm.builder.value=="" && document.filterfrm.construction_stage.value==""){
        alert("Please Select any of City,Builder or Construction Stage");
        return false;
    }
    _gaq.push(['_trackEvent', 'City-Filter',document.filterfrm.city.value]);
    _gaq.push(['_trackPageview', '/site-search.html?City='+document.filterfrm.city.value+'&location='+document.filterfrm.locality.value+'&builder='+document.filterfrm.builder.value+'&type='+document.filterfrm.construction_stage.value]);
    //document.filterfrm1.submit();
    return true;
}
function set_filter2(val){
    if(document.filterfrm1.city.value==""){
        alert("Please Select the city");
        return false;
    }
    return true;
}
function validate_login(host){
    if(trim(document.toplogin.hmusername.value)=="" || document.toplogin.hmusername.value=="Email"){
        alert("Please Enter your Email.");
        document.toplogin.hmusername.focus();
        return false;
    }else{
		if(chkemail(document.toplogin.hmusername.value)==false){
			alert("Please Enter your Email in proper format.");
        	document.toplogin.hmusername.value="";
			document.toplogin.hmusername.focus();
        	return false;
		}
	}
	if(trim(document.toplogin.hmpassword.value)=="" || document.toplogin.hmpassword.value=="Password"){
        alert("Please Enter your Password.");
        document.toplogin.hmpassword.focus();
        return false;
    }
	
	var a = document.toplogin.hredirect.value;
	
	$.ajax({
			  type: 'post',
			  url: host+'validatelogin.php',
			  data: "u="+document.toplogin.hmusername.value+"&p="+document.toplogin.hmpassword.value+"&red="+a,
			  success:function(data){
				  	if(data=="Success"){
						window.location.href=document.toplogin.hredirect1.value;
					}else{
						document.getElementById("loginerrordiv").style.display="block";
						if(data=="Fail1"){		
							document.getElementById("loginerrordiv").innerHTML="Invalid Login Details";
						}else{
							document.getElementById("loginerrordiv").innerHTML="You arenot registered with us";
						}
					}
				}
			  });
    //check_valid_login(document.toplogin.hmusername.value,document.toplogin.hmpassword.value,document.toplogin.hredirect.value,host);
    //return false;
}

