function indexSearchHideRentList(C,D)
{
	var A=document.forms[C].elements;
	for(var B=0;B<A.length;B++)
	{
		var E=A[B].id;
		if(E.indexOf(D)>=0)
		{
			A[B].style.display="none"
		}
	}
}
function setCityValues()
{
	if(document.getElementById("cityId2")!=null)
	{
		lastSelectedCity=document.getElementById("cityId2").value;
		var A=document.getElementById("cityId2");
		if(lastSelectedCity!="")
		{
			A.value=lastSelectedCity
		}
	}
}
function indexSearchRentBuyDisplay(F,E,D)
{
	var C=F.form.id;checkButtonValue=F.value;
	if(checkButtonValue=="R")
	{
		var A=document.forms[C].elements;
		for(var B=0;B<A.length;B++)
		{
			var G=A[B].id;
			if(G.indexOf(E)>=0)
			{
				A[B].style.display="none"
			}
			var G=A[B].id;
			if(G.indexOf(D)>=0)
			{
				A[B].style.display=""
			}
		}
	}
	else
	{
		if((checkButtonValue=="B")||(checkButtonValue=="S"))
		{
			var A=document.forms[C].elements;
			for(var B=0;B<A.length;B++)
			{
				var G=A[B].id;
				if(G.indexOf(D)>=0)
				{
					A[B].style.display="none"
				}
				var G=A[B].id;
				if(G.indexOf(E)>=0)
				{
					A[B].style.display=""
				}
			}
		}
	}
}
function checkBudgetMax(D,H)
{
	var C=document.getElementById(D);
	var F=document.getElementById(D).selectedIndex;
	var G=document.getElementById(H);
	var E=document.getElementById(H).selectedIndex;
	
	if((E<F)&(E!=0))
	{
		alert("Please enter the Maximum Range correctly. The upper limit cannot be less than the lower limit.");
		var B=document.getElementById(H);
		for(r=0;r<B.options.length;r++)
		{
			var A=B.options[r];
			var I=A.text;
			if(I=="Max")
			{
				A.selected=true
			}
			else
			{
				document.getElementById(H).selectedIndex=B.options[0].text
			}
		}
	}
}
function onLoad()
{
	
	document.getElementById("budget").checked=true;

	for(var A=0;A<document.forms["form1"].elements["listType"].length;A++)
	{
		var B=document.forms["form1"].elements["listType"];

		if(B[A].value=="S")
		{
			B[A].checked=true
		}
	}
	if(document.forms["form1"].elements["listType2"]!=null)
	{
		for(var A=0;A<document.forms["form1"].elements["listType2"].length;A++)
		{
			var B=document.forms["form1"].elements["listType2"];
			
			if(B[A].value=="S")
			{
				B[A].checked=true
			}
		}
	}
	if(document.forms["form1"].elements["listType3"]!=null)
	{
		for(var A=0;A<document.forms["form1"].elements["listType3"].length;A++)
		{
			var B=document.forms["form1"].elements["listType3"];if(B[A].value=="A")
			{
				B[A].checked=true
			}
		}
	}
	
}
function setTileVal(A)
{
	if(A==2)
	{
		formName="form2";
		cityId="form2:cityId";
		stateId="form2:stateId";
		localityId="form2:localities";
		indexSearchHideRentList("form2","_rent")
	}
	else
	{
		if(A==3)
		{
			formName="form3";
			cityId="form3:cityId";
			stateId="form3:stateId";
			localityId="form3:localities";
			indexSearchHideRentList("form3","_rent")
		}
		else
		{
			if(A==4)
			{
				formName="form4";
				cityId="form4:cityId";
				stateId="form4:stateId";
				localityId="form4:localities"
			}
			else
			{
				if(A==5)
				{
					formName="form5";
					cityId="form5:cityId";
					stateId="form5:stateId";
					localityId="form5:localities"
				}
				else
				{
					formName="form1";
					cityId="form1:cityId";
					stateId="form1:stateId";
					localityId="form1:localities";
					indexSearchHideRentList("form1","_rent")
				}
			}
		}
	}
	
	setCityValues()
}
function searchByID()
{
	
	var E=".";
	var D=document.getElementById("propertyId");
	var A=D.value;
	var C=D.value;
	for(var B=0;B<A.length;B++)
	{
		if(E.indexOf(A.charAt(B))!=-1)
		{
			alert("Please enter a valid Id for Search");
			return false
		}
	}
	if(A==""||A==null)
	{
		alert("Please enter a valid Id for Search");
		return false
	}
	if(isNaN(C))
	{
		alert("Please enter a valid Id for Search");
		return false
	}
	else
	{
		if(C<2000000)
		{
			window.open("<%=basePath%>jsp/property/propertyListing.jsp?PROPERTYID="+D.value+"","error","toolbar=0,menubar=0,directories=0,scrollbars=1,left=100,top=100,resizable=yes,width=950,height=650")
		}
		else
		{
			window.open("<%=basePath%>jsp/requirements/requirementsView.jsp?rfnum="+D.value+"","error","toolbar=0,menubar=0,directories=0,scrollbars=1,left=100,top=100,resizable=yes,width=950,height=650")
		}
	}
	return true
}
function showLink(ctr)
{
	onLoad();
	
	setTileVal(ctr);

	var divd="";
	var divdTD="";
	
	for(i=1;i<=1;i++)
	{
		
		if(document.getElementById("div"+i)!=null)
		{
			divd=eval("div"+i);
			if(i==ctr)
			{
				divd.style.visibility="visible";
				divd.style.display="block"
			}
			else
			{
				divd.style.visibility="hidden";
				divd.style.display="none"
			}
		}
	}
	
}
function submitForm(B)
{
	var A;
	if(document.all)
	{
		A=window.event.keyCode
	}
	else
	{
		if(document.layers)
		{
			A=B.which
		}
		else
		{
			A=B.keyCode
		}
	}
	if(A==13)
	{
		searchByID();
		return false
	}
	else
	{
		return true
	}
}
/*function agentofweek()
{
	var A="/property/faces/jsp/indexBanner.jsp";
	var C=A+"?promotionTypeRefNo=21001&promotionDefRefNo=50168";
	var B=document.getElementById("hiddenpt").value;
	if(B!=null&&B!="null")
	{
		C=C+"&propertyTypeRefNo="+B
	}
	xmlhttp.open("GET",C,async);
	xmlhttp.onreadystatechange=updateagentOfTheWeek;
	xmlhttp.send(null);
	if(moz)
	{
		updateagentOfTheWeek()
	}
}
function updateagentOfTheWeek()
{
	if(xmlhttp.readyState==4)
	{
		var B=document.getElementById("agentOfTheWeek");
		B.style.visibility="visible";
		B.style.display="block";
		var A=xmlhttp.responseText;
		B.innerHTML=A
	}
}
function addbanner50154()
{
	var A="http://www.magicbricks.com/property/faces/jsp/indexBanner.jsp";
	var C=A+"?promotionTypeRefNo=21001&promotionDefRefNo=50154";
	var B=document.getElementById("hiddenpt").value;
	if(B!=null&&B!="null")
	{
		C=C+"&propertyTypeRefNo="+B
	}
	xmlhttp.open("GET",C,false);
	xmlhttp.onreadystatechange=updateaddbanner50154;
	xmlhttp.send(null);
	if(moz)
	{
		updateaddbanner50154()
	}
}
function updateaddbanner50154()
{
	if(xmlhttp.readyState==4)
	{
		var B=document.getElementById("addbanner50154");
		B.style.visibility="visible";
		B.style.display="block";
		var A=xmlhttp.responseText;
		B.innerHTML=A
	}
}*/