/*  common_script JavaScript
 *  Author : N. Sathyaprakash
 *--------------------------------------------------------------------------*/


	function showSubCategory(str)
	{
		xmlHttp ="";
		xmlHttpCity="";
		xmlHttpLocality="";
		xmlHttpCommission="";
		obj = document.getElementById('dummysubcat');
		obj1 = document.getElementById('subcat');
		obj2 = document.getElementById('bed');
		obj.style.display = "none";

		if(str !="")
		{
			new Ajax.Updater('subcat','../../sell/getsubcat/'+str, {asynchronous:true, evalScripts:true});
		}
		// Hide the Additional features divs
		hideAdditionalFeatures();
		
		/*if(str == "")
		{
			obj.style.display = "";
			obj1.style.display = "none";
			alert("Please, Select any category");
			return false;
		}
		else*/ if(str == '1')
		{
			document.getElementById('bed').style.display = "inline";
			document.getElementById('age').style.display = "inline";
			document.getElementById('built').style.display = "inline";
			document.getElementById('landarea').style.display = "none";
		}
		else if(str == '2')
		{
			document.getElementById('bed').style.display = "inline";
			document.getElementById('age').style.display = "inline";
			document.getElementById('built').style.display = "inline";
			document.getElementById('landarea').style.display = "inline";
		}
		else if(str == '3')
		{
			document.getElementById('bed').style.display = "none";
			document.getElementById('age').style.display = "inline";
			document.getElementById('built').style.display = "inline";
			document.getElementById('landarea').style.display = "none";
		}
		else if(str == '4')
		{
			document.getElementById('bed').style.display = "none";
			document.getElementById('age').style.display = "inline";
			document.getElementById('built').style.display = "inline";
			document.getElementById('landarea').style.display = "none";
		}
		else if(str == '5')
		{
			document.getElementById('bed').style.display = "none";
			document.getElementById('age').style.display = "none";
			document.getElementById('built').style.display = "none";
			document.getElementById('landarea').style.display = "inline";
		}
		else
		{
			obj1.style.display = "";
		}
		//Hide the Dummy select option and show the populated select option
		/*
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
		alert ("Browser does not support HTTP Request")
		return false;
		}

		var url="../../sell/getsubcat/"
		url=url+""+str
		//alert(url)
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)*/
	}

	function showSubCategoryEdit(str)
	{
		xmlHttp ="";
		xmlHttpCity="";
		xmlHttpLocality="";
		xmlHttpCommission="";
		obj = document.getElementById('dummysubcat');
		obj1 = document.getElementById('subcat');
		obj2 = document.getElementById('bed');
		obj.style.display = "none";

		if(str !="")
		{
			new Ajax.Updater('subcat','../../sell/getsubcat/'+str, {asynchronous:true, evalScripts:true});
		}
		if(str == '1')
		{
			new Ajax.Updater('bed','../../sell/bed/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('age','../../sell/age/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('built','../../sell/builtuparea/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('landarea','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});

		}
		else if(str == '2')
		{
			new Ajax.Updater('bed','../../sell/bed/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('age','../../sell/age/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('built','../../sell/builtuparea/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('landarea','../../sell/landarea/', {asynchronous:true, evalScripts:true});
		}
		else if(str == '3')
		{
			new Ajax.Updater('bed','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('age','../../sell/age/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('built','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('landarea','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
		}
		else if(str == '4')
		{
			new Ajax.Updater('bed','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('age','../../sell/age/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('built','../../sell/builtuparea/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('landarea','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});

		}
		else if(str == '5')
		{
			new Ajax.Updater('bed','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('age','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('built','../../sell/emptydiv/', {asynchronous:true, evalScripts:true});
			new Ajax.Updater('landarea','../../sell/landarea/', {asynchronous:true, evalScripts:true});
		}
		else
		{
			obj1.style.display = "";
		}
	}
	
	function showCity(str)
	{
		dummycityobj = document.getElementById('dummycity');
		cityobj1 = document.getElementById('city');
		dummycityobj.style.display = "none";

		if(str !="")
		{
			new Ajax.Updater('city','../../sell/getcity/'+str, {asynchronous:true, evalScripts:true});
		}
		if(str == "")
		{
			dummycityobj.style.display = "";
			cityobj1.style.display = "none";
			alert("Please, Select any city");
			return false;
		}
		else
		{
			cityobj1.style.display = "";
		}

	}



	function showLocality(str)
	{

		obj = document.getElementById('dummylocality');
		obj1 = document.getElementById('locality');
		obj.style.display = "none";
		if(str !="")
		{
			new Ajax.Updater('locality','../../sell/getlocality/'+str, {asynchronous:true, evalScripts:true});
		}
		if(str == "")
		{
			obj.style.display = "";
			obj1.style.display = "none";
			alert("Please, Select any locality");
			return false;
		}
		else
		{
			obj1.style.display = "";
		}
		//Hide the Dummy select option and show the populated select option

	}
		function showCity1(str)
	{
		dummycityobj = document.getElementById('dummycity1');
		cityobj1 = document.getElementById('city1');
		dummycityobj.style.display = "none";

		if(str !="")
		{
			new Ajax.Updater('city1','../../users/getcity/'+str, {asynchronous:true, evalScripts:true});
		}
		if(str == "")
		{
			dummycityobj.style.display = "";
			cityobj1.style.display = "none";
			alert("Please, Select any city");
			return false;
		}
		else
		{
			cityobj1.style.display = "";
		}

	}
	
	function showLocality1(str)
	{

		obj = document.getElementById('dummylocality1');
		obj1 = document.getElementById('locality1');
		obj.style.display = "none";
		if(str !="")
		{
			new Ajax.Updater('locality1','../../users/getlocality/'+str, {asynchronous:true, evalScripts:true});
		}
		if(str == "")
		{
			obj.style.display = "";
			obj1.style.display = "none";
			alert("Please, Select any locality");
			return false;
		}
		else
		{
			obj1.style.display = "";
		}
		//Hide the Dummy select option and show the populated select option

	}

/*
function showCommissionBox()
{
		xmlHttp ="";
		xmlHttpCity="";
		xmlHttpLocality="";
		xmlHttpCommission="";

		obj = document.getElementById('commissionbox');
		hide = document.getElementById('hideContactMe');
		show = document.getElementById('showContactMe');

		if(document.getElementById("property_mode_commission").checked)
		{
			xmlHttpCommission=GetXmlHttpObject()
			if (xmlHttpCommission==null)
			{
			alert ("Browser does not support HTTP Request")
			return false;
			}

			var url="../../sell/showcommissionbox/"
			//url=url+""+str
			//alert(url)
			xmlHttpCommission.onreadystatechange=stateChanged
			xmlHttpCommission.open("GET",url,true)
			xmlHttpCommission.send(null)

			obj.style.display = "";
			hide.style.display = "none";
			show.style.display = "none";
		}
		if(document.getElementById("property_mode_ppv").checked)
		{
			obj.style.display = "none";
			hide.style.display = "";
			show.style.display = "none";
		}
		if(document.getElementById("property_mode_free").checked)
		{
			obj.style.display = "none";
			show.style.display = ""
			hide.style.display = "none";
		}

}
*/



function showvalues(name,mobile,email)
{

	document.getElementById('property_contact_name').value = name;
	document.getElementById('property_contact_mobile').value = mobile;
	document.getElementById('property_contact_email').value = email;

}

function clearvalues()
{
	document.getElementById('property_contact_name').value = "";
	document.getElementById('property_contact_mobile').value = "";
	document.getElementById('property_contact_email').value = "";
}

function showhide()
{
	com = document.getElementById('common');
	obj = document.getElementById('agentinfo');
	//objagent = document.getElementById('agenthead');
	//obj1 = document.getElementById('indinfo');
														
	obj2 = document.getElementById('builderinfo');
	obj3 = document.getElementById('promoterinfo');
	if(document.getElementById("usertype_3").checked)
	{
		obj2.style.display = "";
	}
	else
	{
		obj2.style.display = "none";
	}
	if(document.getElementById("usertype_2").checked)
	{
		obj.style.display = "";
	}
	else
	{
		obj.style.display = "none";
	}
		if(document.getElementById("usertype_5").checked)
	{
		obj3.style.display = "";
	}
	else
	{
		obj3.style.display = "none";
	}
	//objagent.style.display = "none";
	//obj1.style.display = "none";
	//obj2.style.display = "none";

	if(document.getElementById("usertype_2").checked)
	{
		obj.style.display = "";
		//objagent.style.display = "";
		com.style.display = "";
	}
	else if(document.getElementById("usertype_1").checked)
	{
		//obj1.style.display = "";
		com.style.display = "";
	}
	else if(document.getElementById("usertype_3").checked)
	{
		obj2.style.display = "";
		com.style.display = "";
	}
	else if(document.getElementById("usertype_5").checked)
	{
		obj3.style.display = "";
		com.style.display = "";
	}
	else
	{
		obj.style.display = "none";
		obj1.style.display = "none";
		obj2.style.display = "none";
		obj3.style.display = "none";
	}

}
function GIMMpricebox()
{
	//alert("Hai");
/*	hide = document.getElementById('hideContactMe');
	show = document.getElementById('showContactMe');
	if(document.getElementById("property_mode_ppv").checked)
	{
		//alert("PPV");		
		hide.style.display = "";
		show.style.display = "none";
		
	}
	if(document.getElementById("property_mode_free").checked)
	{
		//alert("Free");
		hide.style.display = "none";
		show.style.display = "";
	}*/

	var check = document.getElementById('property_type_rent').checked;
	//alert(check);
	
	if(document.getElementById('property_mode_free').checked)
	{
		//var check = document.getElementById('property_type_rent').checked;

		//new Ajax.Updater('contact','../../sell/showcontact/'+check+'', {asynchronous:true, evalScripts:true});
		new Ajax.Updater('propertypricebox','../../sell/showpropertypricebox/'+check+'', {asynchronous:true, evalScripts:true});
		//new Ajax.Updater('commissionbox','../../sell/emptydiv/'+check+'', {asynchronous:true, evalScripts:true});
		//new Ajax.Updater('ppvbox','../../sell/emptydiv/'+check+'', {asynchronous:true, evalScripts:true});

	}


	if(document.getElementById('property_mode_ppv').checked)
	{
		new Ajax.Updater('propertypricebox','../../sell/showpropertypriceboxwithoutcontact/'+check+'', {asynchronous:true, evalScripts:true});

	}

	// written for not displaying the rented land
/*	if(check)
	{
		new Ajax.Updater('prop_category','../../sell/showpropcategorywithoutland/'+check+'', {asynchronous:true, evalScripts:true});
	}*/

}
/*
function showCommissionBox()
{

	obj = document.getElementById('commissionbox');
	hide = document.getElementById('hideContactMe');
	show = document.getElementById('showContactMe');

	if(document.getElementById("property_mode_commission").checked)
	{
		obj.style.display = "";
		hide.style.display = "";
		show.style.display = "none";

	}
	if(document.getElementById("property_mode_ppv").checked)
	{
		obj.style.display = "none";
		hide.style.display = "";
		show.style.display = "none";
	}
	if(document.getElementById("property_mode_free").checked)
	{
		obj.style.display = "none";
		show.style.display = ""
		hide.style.display = "none";
	}
	//objagent.style.display = "none";
	//obj1.style.display = "none";
	//obj2.style.display = "none";

	if(document.getElementById("usertype_2").checked)
	{
		obj.style.display = "";
		//objagent.style.display = "";
		//com.style.display = "";
	}
	else if(document.getElementById("usertype_1").checked)
	{
		//obj1.style.display = "";
		//com.style.display = "";
	}
	else if(document.getElementById("usertype_3").checked)
	{
		//obj2.style.display = "";
		//com.style.display = "";
	}
	else
	{
		obj.style.display = "none";
		obj1.style.display = "none";
		obj2.style.display = "none";
	}

}
*/


function validateSearch()
{
	if(document.getElementById("PropertyCity").value == "")
	{
		alert("Please Select Propert City");
		return false;
	}

	if(document.getElementById("PropertyPropertyCategory").value == "")
	{
		alert("Please Select Propert Category")	;
		return false;
	}

	return true;
}

function redirect(t)
	{
		var tab = t;
		if(t == 1)
		{
			document.getElementById('all').style.display = 'inline';
			document.getElementById('free').style.display = 'none';
			document.getElementById('commission').style.display = 'none';
			document.getElementById('pay').style.display = 'none';
		}
		if(t == 2)
		{
			document.getElementById('all').style.display = 'none';
			document.getElementById('free').style.display = 'inline';
			document.getElementById('commission').style.display = 'none';
			document.getElementById('pay').style.display = 'none';
		}
		if(t == 3)
		{
			document.getElementById('all').style.display = 'none';
			document.getElementById('free').style.display = 'none';
			document.getElementById('commission').style.display = 'inline';
			document.getElementById('pay').style.display = 'none';
		}
		if(t == 4)
		{
			document.getElementById('all').style.display = 'none';
			document.getElementById('free').style.display = 'none';
			document.getElementById('commission').style.display = 'none';
			document.getElementById('pay').style.display = 'inline';
		}
	}

function redirectshow(t)
	{
		var tab = t;
		if(t == 1)
		{
			document.getElementById('basic').style.display = 'inline';
			document.getElementById('details').style.display = 'none';
			document.getElementById('contact').style.display = 'none';
			document.getElementById('comment').style.display = 'none';
			document.getElementById('images').style.display = 'none';
		}
		if(t == 2)
		{
			document.getElementById('basic').style.display = 'none';
			document.getElementById('details').style.display = 'inline';
			document.getElementById('contact').style.display = 'none';
			document.getElementById('comment').style.display = 'none';
			document.getElementById('images').style.display = 'none';
		}
		if(t == 3)
		{
			document.getElementById('basic').style.display = 'none';
			document.getElementById('details').style.display = 'none';
			document.getElementById('contact').style.display = 'inline';
			document.getElementById('comment').style.display = 'none';
			document.getElementById('images').style.display = 'none';
		}
		if(t == 4)
		{
			document.getElementById('basic').style.display = 'none';
			document.getElementById('details').style.display = 'none';
			document.getElementById('contact').style.display = 'none';
			document.getElementById('comment').style.display = 'inline';
			document.getElementById('images').style.display = 'none';
		}
		if(t == 5)
		{
			document.getElementById('basic').style.display = 'none';
			document.getElementById('details').style.display = 'none';
			document.getElementById('contact').style.display = 'none';
			document.getElementById('comment').style.display = 'none';
			document.getElementById('images').style.display = 'inline';
		}
	}

function validateCompare(id,checkbox)
{

	// set var checkbox_choices to zero
	var elementId = id;
	var checkbox = checkbox;
	var checkbox_choices = 0;
	//alert("id = "+elementId);
	//alert("checkbox = "+checkbox);
	var count = document.getElementById(elementId).value;
	//alert("count = "+count);

	var checkbox_choices = 0;
	// Loop from zero to the one minus the number of checkbox button selections
	var min_id = checkbox.concat('Min');	
	var minCount = document.getElementById(min_id).value;
	//alert("Min ="+minCount);
	var max_id = checkbox.concat('Max');		
	var maxCount = document.getElementById(max_id).value;
	//alert("Max = "+maxCount);
	//alert("checkbox = "+checkbox);
	for (counter = maxCount; counter >= minCount; counter--)
	{
		//alert("counter ="+counter);
		var checkboxId = checkbox.concat('',counter);
		//alert("checkboxId = "+checkboxId);
		//document.displayAll.checkbox.value;
		// If a checkbox has been selected it will return true
		// (If not it will return false)
		if(document.getElementById(checkboxId))
		{
			if(document.getElementById(checkboxId).checked)
			{
				//alert("checkboxId ="+checkboxId);
				//alert("counter ="+counter);
				checkbox_choices = checkbox_choices + 1;

			}
			else
			{
				//alert("In esle");
			}
		}

	}
	//alert("checkbox_choices = "+checkbox_choices);
	if (checkbox_choices > 3 )
	{
		// If there were more than three selections made display an alert box
		msg = "You're limited to only 3 selections.\n";
		msg = msg + "You have made " + checkbox_choices + " selections.\n";
		msg=msg + "Please remove " + (checkbox_choices-3) + " selection(s).";
		alert(msg)
		return false;
	}

	if (checkbox_choices < 2 )
	{
		// If there were less then selections made display an alert box
		msg = "Please make atleast 2 selections to compare. \n";
		msg = msg + "" + checkbox_choices + " selected so far.";
		alert(msg);
		return false;
	}

	return true;
}

function emailmobile(em)
{
	var emobile = em;
	if(em == 1)
	{
		document.getElementById('email').style.display = "inline";
		document.getElementById('mobile').style.display = "none";
	}
	else if(em == 2)
	{
		document.getElementById('email').style.display = "none";
		document.getElementById('mobile').style.display = "inline";
	}
}

function validateCity()
{


	if(document.getElementById('UserCitySelected').value == "" || !(document.getElementById('UserCitySelected')))
	{
		alert("Please select a city you are from");
		return false;
	}
	else
		return true;
}

function LoadAjax()
{

	var check = document.getElementById('property_type_rent').checked;
	//alert(check);
	
	if(document.getElementById('property_mode_free').checked)
	{
		//var check = document.getElementById('property_type_rent').checked;

		new Ajax.Updater('contact','../../sell/showcontact/'+check+'', {asynchronous:true, evalScripts:true});
		new Ajax.Updater('propertypricebox','../../sell/showpropertypricebox/'+check+'', {asynchronous:true, evalScripts:true});
		new Ajax.Updater('commissionbox','../../sell/emptydiv/'+check+'', {asynchronous:true, evalScripts:true});
		new Ajax.Updater('ppvbox','../../sell/emptydiv/'+check+'', {asynchronous:true, evalScripts:true});

	}


	if(document.getElementById('property_mode_ppv').checked)
	{
		//var check = document.getElementById('property_type_rent').checked;
		new Ajax.Updater('ppvbox','../../sell/showppvsalebox/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('propertypricebox','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('contact','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('commissionbox','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});

	}


	if(document.getElementById('property_mode_commission').checked)
	{
		//var check = document.getElementById('property_type_rent').checked;
		new Ajax.Updater('commissionbox','../../sell/showsalecommissionbox/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('propertypricebox','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('contact','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('ppvbox','../../sell/emptydiv/'+check, {asynchronous:true, evalScripts:true});

	}
}

function LoadAjaxSearch()
{
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
		if(state=="") {	state = "null"; }
	 	if(city=="") {	city = "null"; }
	 	if(locality=="") { locality = "null";}
 		if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//alert(state);
	if(state=="null" && city=="null" && locality=="null" && category=="null")
	{
		alert("Please select the City to proceed");
		return false;
	}

// 	if(locality=="null")
// 	{
// 		alert("Null");
// 	}
// 	else
// 	{
// 		alert("in else");
// 	}

	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});


	if(state != "null")
	{
		//alert("in state");
		
		new Ajax.Updater('searchstate','../../properties/getsearchstate/'+check+'/'+city+'/null'+'/null', {asynchronous:true, evalScripts:true});
		if(document.getElementById('PropertyFrom').value == "listproperty")
		{
		new Ajax.Updater('searchcity','../../properties/getsearchcity/'+check+'/'+state+'/'+city+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		if(document.getElementById('PropertyFrom').value == "listproperty")
		{
			new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/null/null/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		if(document.getElementById('PropertyFrom').value == "showproperty")
		{
			new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/null/null/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}

	}

	if(city != "null")
	{
		//alert("in city1");
		if(locality == "null")
		{
			new Ajax.Updater('searchlocality','../../properties/getsearchlocality/'+check+'/'+locality+'/'+city+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		if(document.getElementById('PropertyFrom').value == "listproperty")
		{
			new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/null/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		if(document.getElementById('PropertyFrom').value == "showproperty")
		{
			new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/null/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		
		new Ajax.Updater('category','../../properties/getcategory/'+check+'/null/'+city+'/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
		if(state=="") {	state = "null"; }
	 	if(city=="") {	city = "null"; }
	 	if(locality=="") { locality = "null";}
 		if(category=="") { category = "null";}

	if(locality != "null")
	{
		//alert("in locality");

		//alert(check);alert(state);alert(city);alert(locality);alert(category);
		new Ajax.Updater('searchlocality','../../properties/getsearchlocality/'+check+'/'+locality+'/'+city+'/null'+'/null', {asynchronous:true, evalScripts:true});
		new Ajax.Updater('category','../../properties/getcategory/'+check+'/'+state+'/'+city+'/'+locality+'/null'+'/null', {asynchronous:true, evalScripts:true});
		if(document.getElementById('PropertyFrom').value == "listproperty")
		{
			new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		if(document.getElementById('PropertyFrom').value == "showproperty")
		{
			new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
		}
		
	}
	new Ajax.Updater('price_slider','../../properties/browsebysalebudget/'+check+'/'+state+'/'+city+'/'+locality+'/'+category, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});

}

function LoadAjaxCity(str)
{

	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
// 	alert(check);
// 	alert(state);
// 	alert(city);
// 	alert(locality);
// 	alert(category);
	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('price_slider','../../properties/browsebysalebudget/'+check+'/'+str+'/null/'+locality+'/'+category, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('searchcity','../../properties/getsearchcity/null/'+str+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('dummysearchcity','../../properties/emptydiv/'+str, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('searchlocality','../../properties/getsearchdummylocality', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('category','../../properties/getcategory/'+check+'/'+state+'/'+city+'/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
	if(document.getElementById('PropertyFrom').value == "listproperty")
	{
		new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	if(document.getElementById('PropertyFrom').value == "showproperty")
	{
		new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
}

function LoadAjaxLocality(str)
{
 	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('price_slider','../../properties/browsebysalebudget/'+check+'/'+state+'/'+city+'/'+locality+'/'+category, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('searchlocality','../../properties/getsearchlocality/'+check+'/'+str+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('dummysearchlocality','../../properties/emptydiv/'+str, {asynchronous:true, evalScripts:true});
	/*if(document.getElementById('PropertyFrom').value == "listproperty")
	{
		new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/null/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	if(document.getElementById('PropertyFrom').value == "showproperty")
	{
		new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/null/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}*/
	new Ajax.Updater('dynamic_map','../../properties/dynamicmap', {asynchronous:true, evalScripts:true});
	LoadAjaxCategory(str);
	new Ajax.Updater('category','../../properties/getcategory/'+check+'/'+state+'/'+str+'/null'+'/null'+'/null', {asynchronous:true, evalScripts:true});
	
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
}

function LoadAjaxCategory(str)
{
	
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('price_slider','../../properties/browsebysalebudget/'+check+'/'+state+'/'+city+'/'+locality+'/'+category, {asynchronous:true, evalScripts:true});
 	new Ajax.Updater('category','../../properties/getcategory/'+check+'/'+state+'/'+city+'/'+str+'/null'+'/null', {asynchronous:true, evalScripts:true});
	
	if(document.getElementById('PropertyFrom').value == "listproperty")
	{
		new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	if(document.getElementById('PropertyFrom').value == "showproperty")
	{
		new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
}
function LoadAjaxList()
{

	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('price_slider','../../properties/browsebysalebudget/'+check+'/'+state+'/'+city+'/'+locality+'/'+category, {asynchronous:true, evalScripts:true});
 	
	if(document.getElementById('PropertyFrom').value == "listproperty")
	{
		new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	if(document.getElementById('PropertyFrom').value == "showproperty")
	{	
		new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	}
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
}

function LoadAjaxByPrice(min, max)
{

//alert(min);
//alert(max);
//alert(minstr.match("NaN"));
if(isNaN(min) || isNaN(max))
{
	alert("There is no price range as per your search criteria");
	return false;
}/*	
else
{*/
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	if(state=="" && city=="" && locality=="" && category=="")
	{
		alert("Please select the City to proceed");
		return false;
	}
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//min = min * 100000;
	//max = max * 100000;
	new Ajax.Updater('loading','../../properties/loading', {asynchronous:true, evalScripts:true});
	if(document.getElementById('PropertyFrom').value == "listproperty")
	{
		new Ajax.Updater('listproperty','../../properties/dynamiclistproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+min+'/'+max, {asynchronous:true, evalScripts:true});
	}
	if(document.getElementById('PropertyFrom').value == "showproperty")
	{
		new Ajax.Updater('dynamicshowproperty','../../properties/dynamicshowproperty/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+min+'/'+max, {asynchronous:true, evalScripts:true});
	}
 	
	//new Ajax.Updater('searchstate','../../properties/getsearchstate/'+check+'/'+state, {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('searchcity','../../properties/getsearchcity/'+check+'/'+state, {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('searchlocality','../../properties/getsearchlocality/'+check+'/'+locality+'/'+city, {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('category','../../properties/getcategory/'+check+'/'+state+'/'+city+'/'+locality, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('loading','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
//}
}

function hidestatus(){
window.status="";
return true;
}

function register(pid)
{
// 		alert(pid);
	document.getElementById('reg').style.display = "none";
	new Ajax.Updater('register1','../../properties/register/'+pid+'', {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('register1','../../properties/register/'+pid, {asynchronous:true, evalScripts:true});
}

function regform()
{
	document.getElementById('regform').style.display = "none";
	document.getElementById('box').style.display = "none";
}

/*
* For validate the forms of selleraddproperty,agentaddproperty and actasanagentaddproperty thtml files -- 25/04/08 -- Baskaran.B
*/

function validation()
{
	var category = document.getElementById('SellPropertyCategory').value

	if(document.getElementById('SellPropertyCategory').value == '')
	{
		alert("Please select the Property Category");
		document.getElementById('SellPropertyCategory').focus();
		return false;
	}

	if(document.getElementById('SellPropertySubcategory').value == '')
	{
		alert("Please select the Property Subcategory");
		document.getElementById('SellPropertySubcategory').focus();
		return false;
	}

	if(document.getElementById('SellState').value == '')
	{
		alert("Please select the State");
		document.getElementById('SellState').focus();
		return false;
	}

	if(document.getElementById('SellCity').value == '')
	{
		alert("Please select the City");
		document.getElementById('SellCity').focus();
		return false;
	}

	if(document.getElementById('SellLocality').value == 'other')
	{
		if(document.getElementById('SellOther').value == '')
		{
			alert("Please enter the Other Locality");
			document.getElementById('SellOther').focus();
			return false;
		}
	}

	if(document.getElementById('SellPropertyCrore').value == 'more')
	{
		if(document.getElementById('SellAmt').value < 1000000000)
		{
			alert("Please enter the Amount More than 100 Crores");
			document.getElementById('SellAmt').focus();
			return false;
		}
	}

	if(document.getElementById('property_title').value == '')
	{
		alert("Please enter the Property Title");
		document.getElementById('property_title').focus();
		return false;
	}

	if(document.getElementById('SellPropertyOwnership').value == '0')
	{
		alert("Please select the Property Ownership");
		document.getElementById('SellPropertyOwnership').focus();
		return false;
	}

	if(category == '2' || category == '5')
	{
		if(document.getElementById('SellLandArea').value == '')
		{
			alert("Please enter Land area");
			document.getElementById('SellLandArea').focus();
			return false;
		}
	}

	if(category == '1' || category == '2')
	{
		if(document.getElementById('property_area').value == '')
		{
			alert("Please enter Built up area");
			document.getElementById('property_area').focus();
			return false;
		}
	}

	if(document.getElementById('property_contact_name').value == '')
	{
		alert("Please enter the Name");
		document.getElementById('property_contact_name').focus();
		return false;
	}

	if(document.getElementById('property_contact_mobile').value == '')
	{
		alert("Please enter the Mobile Number");
		document.getElementById('property_contact_mobile').focus();
		return false;
	}

	if(document.getElementById('property_contact_email').value == '')
	{
		alert("Please enter the Email Id");
		document.getElementById('property_contact_email').focus();
		return false;
	}
}

function enquiry()
{
	if(document.getElementById('ContentYourname').value == '')
	{
		alert("Please enter the Your Name");
		document.getElementById('ContentYourname').focus();
		return false;
	}

	if(document.getElementById('ContentPhone').value == '')
	{
		alert("Please enter the Phone Number");
		document.getElementById('ContentPhone').focus();
		return false;
	}

	if(document.getElementById('ContentEmail').value == '')
	{
		alert("Please enter the Email Id");
		document.getElementById('ContentEmail').focus();
		return false;
	}

	if(document.getElementById('ContentYourquery').value == '')
	{
		alert("Please enter the Your Query");
		document.getElementById('ContentYourquery').focus();
		return false;
	}

}

function crores(amt)
{
	if(amt == 'more')
	{
		document.getElementById('cr').style.display = 'inline';
	}
	else
	{
		document.getElementById('cr').style.display = 'none';
	}
	if(document.getElementById('opt_contactme').checked == true)
	{
		document.getElementById('cr').style.display = 'none';
		document.getElementById('SellPropertyCrore').selectedIndex = '';
		document.getElementById('SellPropertyLacs').selectedIndex = '';
		document.getElementById('SellPropertyThousand').selectedIndex = '';
	}
}

function showother()
{
	if(document.getElementById('SellLocality').value == 'other')
	{
		document.getElementById('other').style.display = 'inline';
	}
	else
	{
		document.getElementById('other').style.display = 'none';
	}
}

function imagepresent()
{
	if(document.getElementById('ImageFiledata').value == '')
	{
		alert("Please provide the image path");
		document.getElementById('ImageFiledata').focus();
		return false;		
	}
}

function clickbox()
{
	if(document.getElementById('chk').checked == true)
	{
		document.getElementById('cor').style.display = 'inline';
		document.getElementById('but').style.display = 'none';
	}
	if(document.getElementById('chk').checked == false)
	{
		document.getElementById('but').style.display = 'inline';
		document.getElementById('cor').style.display = 'none';
	}
}


function mypopup(id)
{	
	mywindow = window.open ("../../properties/showproperty/VP"+id,  "mywindow"+id,"status=1,scrollbars=1,resizable=no,width=540,height=800");
  mywindow.moveTo(0,0);
}

function mypopupbyid()
{	
	id=document.getElementById('property_city').value;
	if(id == "" )
		{
			alert("Please enter Property Id as VPxxx");
			return false;
		}else{
	mywindow = window.open ("../../properties/showproperty/"+id,  "mywindow"+id,"status=1,scrollbars=1,resizable=no,width=540,height=800");
  mywindow.moveTo(0,0);
  }
} 
function paginate(page)
{
	//alert("In paginate");
	//alert(page);
	//var urlSplit = url.split('=');
	//alert(urlSplit[1]);
	//var page = urlSplit[1];
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//document.getElementById('LoadingDiv').style.display = 'inline';
	new Ajax.Updater('LoadingDivAll','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivAllDown','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	//alert(""+url+"/"+check+"/"+str+"/null/"+locality+"/"+category+"/null"+"/null");
	new Ajax.Updater('pagination','../../properties/pagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	//new Ajax.Updater('pagination','../../properties/login/', {asynchronous:true, evalScripts:true});
		
	new Ajax.Updater('paginationdown','../../properties/pagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});

	new Ajax.Updater('dynamicpagelistproperty','../../properties/listingpaging/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	//document.getElementById('LoadingDiv').style.display = 'none';
	//new Ajax.Updater('dynamicPaginatedListProperty','../../properties/listingpaging/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivAll','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivAllDown','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	return false;
}

function freepaginate(page)
{
	//alert("In freepaginate");
	//alert(page);
	//var urlSplit = url.split('=');
	//alert(urlSplit[1]);
	//var page = urlSplit[1];
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//document.getElementById('LoadingDiv').style.display = 'inline';
	new Ajax.Updater('LoadingDivfree','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivfreeDown','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	//alert(""+url+"/"+check+"/"+str+"/null/"+locality+"/"+category+"/null"+"/null");
	new Ajax.Updater('freepagination','../../properties/freepagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});

	new Ajax.Updater('freepaginationdown','../../properties/freepagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	
	new Ajax.Updater('dynamicfreelistproperty','../../properties/freelistingpaging/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	//document.getElementById('LoadingDiv').style.display = 'none';
	//new Ajax.Updater('dynamicPaginatedListProperty','../../properties/listingpaging/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivfree','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivfreeDown','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	return false;
}

function commpaginate(page)
{
	//alert("In commpaginate");
	//alert(page);
	//var urlSplit = url.split('=');
	//alert(urlSplit[1]);
	//var page = urlSplit[1];
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//document.getElementById('LoadingDiv').style.display = 'inline';
	new Ajax.Updater('LoadingDivComm','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivCommDown','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	//alert(""+url+"/"+check+"/"+str+"/null/"+locality+"/"+category+"/null"+"/null");
	new Ajax.Updater('commpagination','../../properties/commpagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	
	new Ajax.Updater('commpaginationdown','../../properties/commpagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});

	new Ajax.Updater('dynamiccommlistproperty','../../properties/commlistingpaging/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	//document.getElementById('LoadingDiv').style.display = 'none';
	//new Ajax.Updater('dynamicPaginatedListProperty','../../properties/listingpaging/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivComm','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivCommDown','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	return false;
}

function paypaginate(page)
{
	//alert("In paypaginate");
	//alert(page);
	//var urlSplit = url.split('=');
	//alert(urlSplit[1]);
	//var page = urlSplit[1];
	var check	= document.getElementById('property_type_sale').checked;
	var state 	= document.getElementById('UserState').value;
	var city 	= document.getElementById('UserCitySelected').value;
	var locality	= document.getElementById('SellLocality').value;
	var category	= document.getElementById('PropertyPropertyCategory').value;
	
	if(state=="") {	state = "null"; }
	if(city=="") {	city = "null"; }
	if(locality=="") { locality = "null";}
	if(category=="") { category = "null";}
	//alert(check);alert(state);alert(city);alert(locality);alert(category);
	//document.getElementById('LoadingDiv').style.display = 'inline';
	new Ajax.Updater('LoadingDivPay','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivPayDown','../../properties/loadingimg', {asynchronous:true, evalScripts:true});
	//alert(""+url+"/"+check+"/"+str+"/null/"+locality+"/"+category+"/null"+"/null");
	new Ajax.Updater('paypagination','../../properties/paypagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	
	new Ajax.Updater('paypaginationdown','../../properties/paypagination/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});

	new Ajax.Updater('dynamicpaylistproperty','../../properties/paylistingpaging/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	//document.getElementById('LoadingDiv').style.display = 'none';
	//new Ajax.Updater('dynamicPaginatedListProperty','../../properties/listingpaging/'+check+'/'+str+'/null/'+locality+'/'+category+'/null'+'/null', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivPay','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	new Ajax.Updater('LoadingDivPayDown','../../sell/emptydiv', {asynchronous:true, evalScripts:true});
	return false;
}

function searchvalidation()
{
// 	alert("hi");
	if(document.getElementById('PropertyPropertyCategory').value == '')
	{
		alert("Please select the Property Category");
		document.getElementById('PropertyPropertyCategory').focus();
		return false;
	}
	if(document.getElementById('SellPropertySubcategory').value == '')
	{
		alert("Please select the Property Sub Category");
		document.getElementById('SellPropertySubcategory').focus();
		return false;
	}
	if(document.getElementById('SellState').value == '')
	{
		alert("Please select the State");
		document.getElementById('SellState').focus();
		return false;
	}
	if(document.getElementById('SellCity').value == '')
	{
		alert("Please select the City");
		document.getElementById('SellCity').focus();
		return false;
	}
	if(document.getElementById('save').checked == true)
	{
		if(document.getElementById('title').value == '')
		{
			alert("Please enter the title");
			document.getElementById('title').focus();
			return false;
		}
	}
}

function status_submit(chkid)
{
	var chk = chkid.value;
// 	alert(chk);
	new Ajax.Updater('soldchk1_'+chk,'../../properties/soldrent/'+chk+'', {asynchronous:true, evalScripts:true});
	document.getElementById('soldchk_'+chk).style.display = 'none';
	document.getElementById('soldchk1_'+chk).style.display = 'inline';
}

function requirementvalidation()
{
	if(document.getElementById('RequirementPropertyCategory').value == '')
	{
		alert("Please select the Property Category");
		document.getElementById('RequirementPropertyCategory').focus();
		return false;
	}

	if(document.getElementById('SellPropertySubcategory').value == '')
	{
		alert("Please select the Property Subcategory");
		document.getElementById('SellPropertySubcategory').focus();
		return false;
	}

	if(document.getElementById('RequirementState').value == '')
	{
		alert("Please select the State");
		document.getElementById('RequirementState').focus();
		return false;
	}

	if(document.getElementById('SellCity').value == '')
	{
		alert("Please select the City");
		document.getElementById('SellCity').focus();
		return false;
	}

	if(document.getElementById('SellLocality').value == 'other')
	{
		if(document.getElementById('SellOther').value == '')
		{
			alert("Please enter the Other Locality");
			document.getElementById('SellOther').focus();
			return false;
		}
	}

	if(document.getElementById('RequirementPropertyCrore').value == 'more')
	{
		if(document.getElementById('RequirementAmt').value < 1000000000)
		{
			alert("Please enter the Amount More than Crores");
			document.getElementById('RequirementAmt').focus();
			return false;
		}
	}
	if(document.getElementById('RequirementLikelyToBuy').value == '0')
	{
		alert("Please select Likely to Buy");
		document.getElementById('RequirementLikelyToBuy').focus();
		return false;
	}
}

function cleardate()
{
// 	alert("hi");
	document.getElementById('date-from').disabled = true;
}

function enabledate()
{
	document.getElementById('date-from').disabled = false;
}
function showAdditionalFeatures()
{
	var propertId;

	if(document.getElementById('SellId'))
	{
		 propertId = document.getElementById('SellId').value;
	}
	else
	{
		propertId = "null";
	}
	

	var category = document.getElementById('SellPropertyCategory').value;
	if(!category)
	{
		alert("Please select the Category first");
	}
	else
	{
		new Ajax.Updater('propertyFeatures','../../sell/propertyfeatures/'+category+'/'+propertId, {asynchronous:true, evalScripts:true});
		document.getElementById('additional_details_link').style.display = 'none';
		document.getElementById('additional_details').style.display = 'inline';
		//alert(category);
		
		if(category !='5'  )//land
		{
			document.getElementById('externalFeature').style.display = "inline";
			document.getElementById('flooring').style.display = 'inline';
		}
		if(category =='1' || category =='2' )
		{
			document.getElementById('bathroom').style.display = 'inline';
		}
		if(category =='1' || category =='2' )
		{
			document.getElementById('balcony').style.display = 'inline';
		}
		if(category !='5'  )
		{
			document.getElementById('furnishing').style.display = 'inline';
		}
		if(category !='5'  )
		{
			document.getElementById('total_floors').style.display = 'inline';
		}
		if(category !='5'  )
		{
			document.getElementById('property_on_floors').style.display = 'inline';
		}
		if(category =='1' || category =='2' )
		{
			document.getElementById('additional_rooms').style.display = 'inline';
		}
		if(category !='5'  )
		{
			document.getElementById('facing').style.display = 'inline';
		}
 		if(category !='3' && category !='4' )
 		{
			
 			document.getElementById('citycenter').style.display = 'inline';
			document.getElementById('school').style.display = 'inline';
		}
		
		
		
	}
}

function hideAdditionalFeatures()
{
	// This function is called in showSubCategory()
	document.getElementById('externalFeature').style.display = "none";
	document.getElementById('additional_details').style.display = "none";
	document.getElementById('flooring').style.display = "none";
	document.getElementById('bathroom').style.display = "none";
	document.getElementById('balcony').style.display = "none";
	document.getElementById('furnishing').style.display = "none";
	document.getElementById('total_floors').style.display = "none";
	document.getElementById('property_on_floors').style.display = "none";
	document.getElementById('additional_rooms').style.display = "none";
	document.getElementById('facing').style.display = "none";
	document.getElementById('citycenter').style.display = "none";
	document.getElementById('school').style.display = "none";
	document.getElementById('additional_details_link').style.display = "inline";
}

function sellerpricechange()
{
	//alert("hai");

	//new Ajax.Updater('dynamiccommlistproperty','../../properties/commlistingpaging/'+check+'/'+state+'/'+city+'/'+locality+'/'+category+'/'+page, {asynchronous:true, evalScripts:true});
	if(document.getElementById('property_type_rent').checked)
	{
		document.getElementById('crore_text').style.display = 'none';
		document.getElementById('crore_selectbox').style.display = 'none';
		document.getElementById('hundred_text').style.display = 'inline';
		document.getElementById('hundred_selectbox').style.display = 'inline';
	}
	
	if(document.getElementById('property_type_sale').checked)
	{
		document.getElementById('crore_text').style.display = 'inline';
		document.getElementById('crore_selectbox').style.display = 'inline';
		document.getElementById('hundred_text').style.display = 'none';
		document.getElementById('hundred_selectbox').style.display = 'none';
	}

}

function sellereditpricechange()
{
	//alert("hai");
	var check = document.getElementById('property_type_rent').checked;
	new Ajax.Updater('sellereditpricechange','../../sell/sellereditsimplepropertypricerow/'+check, {asynchronous:true, evalScripts:true});
	
}

function savepopup($vp)
{
	mywindow = window.open ("../../properties/savesearchtitle/"+$vp,  "mywindow","status=1,scrollbars=1,resizable=no,width=400,height=300");
 	mywindow.moveTo(0,0);
}
