function searchValidation(searchType){
	//Residential search validation
	if(searchType=='residential'){
		if(document.getElementById('userCity').value==''){
			alert('Error: Please select the city before starting search.');
			return false;
		}
		return true;
	}

	//Commercial search validation
	if(searchType=='commercial'){
		if(document.getElementById('userCityCommercial').value==''){
			alert('Error: Please select the city before starting search.');
			return false;
		}
		return true;
	}

}

//Disable bedroom dropdown
function disableBedroom(getPropertyType, bedRoomDivID){
	if(getPropertyType=='2'){
		document.getElementById(bedRoomDivID).disabled=true;
	}else{
		document.getElementById(bedRoomDivID).disabled=false;
	}
}

function validateThePriceRange(getFromSelectboxValue,selectboxId)
{
	var priceFrom= new Array(10);

	priceFrom['40 Lacs']=4000000;
	priceFrom['50 Lacs']=5000000;
	priceFrom['60 Lacs']=6000000;
	priceFrom['75 Lacs']=7500000;
	priceFrom['1 Crore']=10000000;
	priceFrom['1.5 Crore']=15000000;
	priceFrom['2 Crore']=20000000;
	priceFrom['3 Crore']=30000000;
	priceFrom['5 Crore']=50000000;
	priceFrom['10 Crore']=100000000;
	priceFrom['20 Crore']=200000000;
	/*alert(getFromSelectboxValue);
	alert(selectboxId);*/
	var i;
	for(i=selectboxId.options.length-1;i>=0;i--)
	{
		//Remove all elements
		selectboxId.remove(i);
	}

	//Insert option elements
	for(arrayKeyIs in priceFrom){


		if(Number(priceFrom[arrayKeyIs])>Number(getFromSelectboxValue) && Number(getFromSelectboxValue)>999999 && Number(getFromSelectboxValue)<200000000){
			//Add option elements
			var optn = document.createElement("OPTION");
			optn.text = arrayKeyIs;
			optn.value = priceFrom[arrayKeyIs];
			selectboxId.options.add(optn);
		}

		//If less then 10Lac
		if(Number(getFromSelectboxValue)==1){
			var optn = document.createElement("OPTION");
			optn.text = 'Min Price';
			optn.value = 999999;
			selectboxId.options.add(optn);
			break;
		}

		//If greater then 20Crore then 10Lac
		if(Number(getFromSelectboxValue)==200000000){
			var optn = document.createElement("OPTION");
			optn.text = 'Max Price';
			optn.value = 2000000000;
			selectboxId.options.add(optn);
			break;
		}
	}
}

//Validate the rent price
function validateThePriceRangeRent(getFromSelectboxValue,selectboxId)
{
	var priceFrom= new Array(10);

	priceFrom['20000']=20000;
	priceFrom['25000']=25000;
	priceFrom['40000']=40000;
	priceFrom['70000']=70000;
	priceFrom['1 Lac']=100000;
	priceFrom['1.5 Lacs']=150000;
	priceFrom['2 Lacs']=200000;
	priceFrom['5 Lacs']=500000;
	priceFrom['10 Lacs']=1000000;

	/*alert(getFromSelectboxValue);
	alert(selectboxId);*/
	var i;
	for(i=selectboxId.options.length-1;i>=0;i--)
	{
		//Remove all elements
		selectboxId.remove(i);
	}

	//Insert option elements
	for(arrayKeyIs in priceFrom){


		if(Number(priceFrom[arrayKeyIs])>Number(getFromSelectboxValue) && Number(getFromSelectboxValue)<1000000 && Number(getFromSelectboxValue)>4999){
			//Add option elements
			var optn = document.createElement("OPTION");
			optn.text = arrayKeyIs;
			optn.value = priceFrom[arrayKeyIs];
			selectboxId.options.add(optn);
		}

		//If less then 10Lac
		if(Number(getFromSelectboxValue)==1){
			var optn = document.createElement("OPTION");
			optn.text = 'Min Price';
			optn.value = 4999;
			selectboxId.options.add(optn);
			break;
		}

		//If greater then 20Crore then 10Lac
		if(Number(getFromSelectboxValue)==1000000){
			var optn = document.createElement("OPTION");
			optn.text = 'Max Price';
			optn.value = 10000000;
			selectboxId.options.add(optn);
			break;
		}
	}
}

