//banner by dates

function agent_locator()
{ 
	if (document.frm_agent.state.options[document.frm_agent.state.selectedIndex].value==0)
	{
		alert("Please select state here");
		document.frm_agent.state.focus();
	}
	else
	{
		document.frm_agent.submit();
	}
}

function plot_search()
{ 
	if (document.f1.sub_cat.options[document.f1.sub_cat.selectedIndex].value==0)
	{
		alert("Please select category here");
		document.f1.sub_cat.focus();
	}
	else
	{
		document.f1.submit();
	}
}

function CheckAll(chk)
{ 
for (var i=0;i < document.f1.elements.length;i++)
	{
		var e = document.f1.elements[i];
		if (e.type == "checkbox")
		{
			e.checked = chk.checked;
		}
	}
}

function CheckAll_frm1(chk)
{ 
for (var i=0;i < document.frm1.elements.length;i++)
	{
		var e = document.frm1.elements[i];
		if (e.type == "checkbox")
		{
			e.checked = chk.checked;
		}
	}
}

		
	function MyRecords()
	{
		if (document.frm1.Records.value=="")
		{
			alert("Please enter how many records you want onto page")
			document.frm1.Records.focus();
		}
		else if (isNaN(document.frm1.Records.value))
		{
			alert("Only numeric value is allowed here")
			document.frm1.Records.focus();
		}
	}		
	
	function check_dt1()
	{

		if (document.frm1.s1.options[document.frm1.s1.selectedIndex].value=="" || document.frm1.s2.options[document.frm1.s2.selectedIndex].value==""  || document.frm1.s3.options[document.frm1.s3.selectedIndex].value=="" )
		{
			alert("You must have to select date ");
			document.frm1.s1.focus();
		}
		else
		{
			document.frm1.submit();
		}

	}
// banner by dates

	function feature_request()
	{
		if(document.frm1.username.value.length<1)
		{
		 alert("Please fill User Name here");
		 document.frm1.username.focus();
		}	
		else if(document.frm1.prop_id.value.length<1)
		{
		 alert("Please fill Property ID here");
		 document.frm1.prop_id.focus();
		}	
		else
		{
			document.frm1.submit();
		}	 
	}
	
	
	function feature_member()
	{
		if(document.frm1.name.value.length<1)
		{
		 alert("Please fill Your Name here");
		 document.frm1.name.focus();
		}	
		else if(document.frm1.address.value.length<1)
		{
		 alert("Please fill address here");
		 document.frm1.address.focus();
		}	
		else if(document.frm1.phone.value.length<1)
		{
		 alert("Please fill phone no here");
		 document.frm1.phone.focus();
		}
		else if(document.frm1.email.value.length<1)
		{
		 alert("Please fill email address here");
		 document.frm1.email.focus();
		}	
		else if(document.frm1.email.value.indexOf('@') == -1)
		 {
		  alert("Please check your E-mail field.");
		  document.frm1.email.focus();
		 }
		else if(document.frm1.email.value.indexOf('.') == -1)
		 {
		  alert("Please check your E-mail field.");
		  document.frm1.email.focus();
		 }
		else
		{
			document.frm1.submit();
		}	 
	}
	
	
 function validate_email()
   {
    if(document.frm1.name.value.length<1)
    {
     alert("Please fill Your Name here");
     document.frm1.name.focus();
    }
    else if(document.frm1.phone.value.length<1)
    {
     alert("Please fill contact no. here");
     document.frm1.phone.focus();
    }
    else if(document.frm1.query.value.length<1)
    {
     alert("Please fill your query here");
     document.frm1.query.focus();
    }
	else
	{
	 document.frm1.submit();
	}
   }
   
// Update Property

 function validate_upproperty()
   {
    if(document.frm1.Title.value.length<1)
    {
     alert("Please fill required value here");
     document.frm1.Title.focus();
    }
    else if(document.frm1.price.value.length<1)
    {
     alert("Please fill price here");
     document.frm1.price.focus();
    }
    else if(isNaN(document.frm1.price.value))
    {
     alert("Please fill price in numeric only");
     document.frm1.price.focus();
    }
    else if(document.frm1.location.value.length<1)
    {
     alert("Please fill location here");
     document.frm1.location.focus();
    }
    else if(document.frm1.area.value.length<1)
    {
     alert("Please fill area here");
     document.frm1.area.focus();
    }
    else if(isNaN(document.frm1.area.value))
    {
     alert("Please fill area in numeric only");
     document.frm1.area.focus();
    }
	else 
	{
		document.frm1.submit();
	}
  }
// end of update property


// Update Profile

 function validate_upprofile()
   {
	   
    if(document.frm1.first.value.length<1)
    {
     alert("Please fill First Name here");
     document.frm1.first.focus();
    }
    else if(document.frm1.last.value.length<1)
    {
     alert("Please fill Last Name here");
     document.frm1.last.focus();
    }
/*    else if(document.frm1.city_display.value.length<1)
    {
     alert("Please fill city here");
    }
    else if(document.frm1.state_display.value.length<1)
    {
     alert("Please fill state here");
    }
*/	
    else if(document.frm1.address.value.length<1)
    {
     alert("Please fill address here");
     document.frm1.address.focus();
    }
    else if(document.frm1.email.value=="")
    {
     alert("Please fill Email Address");
     document.frm1.email.focus();
    }
    else if(document.frm1.email.value.indexOf('@') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
     }
    else if(document.frm1.email.value.indexOf('.') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
     }
	else if(document.frm1.phone.value.length<5)
    {
     alert("Please enter al least 5 characters to enter phone");
     document.frm1.phone.focus();
	}	

	else if(document.frm1.member_type.value == "0")
    {
		alert("Please Select Member Type");
		document.frm1.member_type.focus();
	}	
	else 
	{

		document.frm1.hidval.value=1;
		document.frm1.submit();
	}
	}
	
	///adding more blocks

function onemore(rname)
{
	var element=document.getElementById(rname);
	//element.style.display="block";
	if (element.style.display == "none")
	{
		element.style.display="block";
	}
	else
		element.style.display="none";

}

function moredet(id2)
{
	var element1=document.getElementById(id2);
	if (element1.style.display == "none")
	{
		element1.style.display="block";
	}
	else
		element1.style.display="none";
}

function moredet1(id2)
{
	var element1=document.getElementById(id2);
	if (document.form1.showhide.value == "yes")
	{
		if (element1.style.display == "none")
		{
			element1.style.display="block";
		}
		else
			element1.style.display="none";
	}
	else
	{
		element1.style.display="none";
		alert("No Construction Specification Present");
	}
		
}


// end of update profile

//Register Property
 function validate_property()
   {
/*
		if(document.frm1.plan.value<1)
		{
		 alert("Please select when are you planning");
		 document.frm1.plan.focus();
		}
		else*/
		
		if(document.frm1.CategoryIDs.options[document.frm1.CategoryIDs.selectedIndex].value == "")
		{
		 alert("Please select category from the list");
		 document.frm1.CategoryIDs.focus();
		}
		else if(document.frm1.sub_cat.options[document.frm1.sub_cat.selectedIndex].value == "Any Subcategory" || document.frm1.sub_cat.options[document.frm1.sub_cat.selectedIndex].value=="Doesn't matter" )
		{
		 alert("Please select a sub category from the list");
		 document.frm1.sub_cat.focus();
		}
		else if(document.frm1.sstate.value<1)
		{
		 alert("Please select a state from the list");
		 document.frm1.sstate.focus();
		}
		else if(document.frm1.city.options[document.frm1.city.selectedIndex].value == "All Cities" || document.frm1.city.options[document.frm1.city.selectedIndex].value=="Doesn't matter" )
		{
		 alert("Please select a city from the list");
		 document.frm1.city.focus();
		}
		else if(document.frm1.location.value.length<1)
		{
		 alert("Please enter location here");
		 document.frm1.location.focus();
		}
		
		else if(document.frm1.Title.value.length<1)
		{
		 alert("Please fill property title here");
		 document.frm1.Title.focus();
		}

		else if(document.frm1.area.value.length<1)
		{
		 alert("Please enter area here");
		 document.frm1.area.focus();
		}
		else if(isNaN(document.frm1.area.value))
		{
		 alert("Please specify only numeric here");
		 document.frm1.area.focus();
		}
		else if (document.frm1.price.value == "" && document.frm1.price_min)
	   {	
			if(document.frm1.price_min.value.length<1)
			{
			 alert("Please enter price here");
			 document.frm1.price_min.focus();
			}
			 else if(document.frm1.price_min.value.indexOf('.') != -1)
			 {
			  alert("Floating value is not allowed ! Please remove (.) dot used in price");
			  document.frm1.price_min.focus();
			 }
			else if(document.frm1.price_min.value.length>0 && isNaN(document.frm1.price_min.value))
			{
			 alert("Please fill price in numeric only");
			 document.frm1.price_min.focus();
			}
	   }
				
		else if(document.frm1.units.options[document.frm1.units.selectedIndex].value=="Select")
		{
		 alert("Please select unit here");
		 document.frm1.units.focus();
		}
/*		else if(document.frm1.landmark.value.length<1)
		{
		 alert("Please specify a landmark");
		 document.frm1.landmark.focus();
		}
*/
		else if(document.frm1.property_desc.value.length<1)
		{
		 alert("Description can't be blank");
		 document.frm1.property_desc.focus();
		}
		else 
		{
			document.frm1.hidval.value=1;
			document.frm1.submit();
		}
	}
//End of Register Property


// Add requirments

 function validate_requirement()
   {
		if(document.frm1.CategoryIDs.value<1)
		{
		 alert("Please select a category from the list");
		 document.frm1.CategoryIDs.focus();
		}
		else if(document.frm1.sstate.value<1)
		{
		 alert("Please select a state from the list");
		 document.frm1.sstate.focus();
		}
		else if(document.frm1.city.value == "")
		{
		 alert("Please select a city from the list");
		 document.frm1.city.focus();
		}
		else if(document.frm1.size.value.length<1)
		{
		 alert("Please specify area here");
		 document.frm1.size.focus();
		}
		else if(isNaN(document.frm1.size.value))
		{
		 alert("Please fill area in numeric only");
		 document.frm1.size.focus();
		}
		else if(document.frm1.unit.value<1)
		{
		 alert("Please select a unit");
		 document.frm1.unit.focus();
		}
		else if(document.frm1.description.value.length<1)
		{
		 alert("Description can't be blank");
		 document.frm1.description.focus();
		}
		else 
		{
			//document.frm1.hidval.value=1;
			document.frm1.submit();
		}
	}
//End of Register Property


// Register Agent
 function validate_register()
   {
 	 if(document.frm1.member_type.options[document.frm1.member_type.selectedIndex].value == "0")
    {
		alert("Please Select Member Type");
		document.frm1.member_type.focus();
		return false;
	}
    else if(document.frm1.first.value.length<1)
    {
     alert("Please fill First Name here");
     document.frm1.first.focus();
	 return false;
    }
    else if(document.frm1.last.value.length<1)
    {
     alert("Please fill Last Name here");
     document.frm1.last.focus();
	 return false;
    }
 /*   else if(document.frm1.city_display.value.length<1)
    {
     alert("Please fill city here");
    }
    else if(document.frm1.state_display.value.length<1)
    {
     alert("Please fill state here");
    }
*/
    else if(document.frm1.address.value.length<1)
    {
     alert("Please fill address here");
     document.frm1.address.focus();
	 return false;
    }
    else if(document.frm1.state.options[document.frm1.state.selectedIndex].value==0)
    {
     alert("Please select State here");
     document.frm1.state.focus();
	 return false;
    }
    else if(document.frm1.city.options[document.frm1.city.selectedIndex].text=="All Cities" || document.frm1.city.options[document.frm1.city.selectedIndex].text=="Doesn't matter")
    {
     alert("Please select City here");
     document.frm1.city.focus();
	 return false;
    }
		
    else if(document.frm1.email.value=="")
    {
     alert("Please fill Email Address");
     document.frm1.email.focus();
	 return false;
    }
    else if(document.frm1.email.value.indexOf('@') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
	  return false;
     }
    else if(document.frm1.email.value.indexOf('.') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
	  return false;
     }
	else if(document.frm1.phone.value.length<5)
    {
     alert("Please enter al least 5 characters to enter phone");
     document.frm1.phone.focus();
	 return false;
	}	

/*	else if(document.frm1.plan_display.value == "")
    {
		alert("Please Select plan");
	}			
*/
	else if(document.frm1.login.value.length<5)
    {
     alert("Please Enter al least 5 characters to create Login Name");
     document.frm1.login.focus();
	 return false;
	}	
    else if(document.frm1.password.value.length<5)
    {
     alert("Please enter al least 5 characters to create password");
     document.frm1.password.focus();
	 return false;
    }
    else if(document.frm1.password.value=="")
    {
     alert("Please fill confirm password");
     document.frm1.password.focus();
	 return false;
    }
    else if(document.frm1.password.value != document.frm1.password2.value)
    {
     alert("The password and Confirm password do not match");
     document.frm1.password2.focus();
	 return false;
    }
   	else if (!document.frm1.agree.checked)
	{
		alert("Please accept terms & conditions to proceed registration");	
		return false;
	}	
	else 
	{
		document.frm1.hidval.value=1;
		document.frm1.submit();
		return true;
	}
	}
//

function validate_member()
   { 
   if(document.frm1.first.value.length<1)
    {
     alert("Please fill First Name here");
     document.frm1.first.focus();
    }
    else if(document.frm1.last.value.length<1)
    {
     alert("Please fill Last Name here");
     document.frm1.last.focus();
    }
 
    else if(document.frm1.address.value.length<1)
    {
     alert("Please fill address here");
     document.frm1.address.focus();
    }
    else if(document.frm1.state.options[document.frm1.state.selectedIndex].value==0)
    {
     alert("Please select State here");
     document.frm1.state.focus();
    }
    else if(document.frm1.city.options[document.frm1.city.selectedIndex].text=="All Cities" || document.frm1.city.options[document.frm1.city.selectedIndex].text=="Doesn't matter")
    {
     alert("Please select City here");
     document.frm1.city.focus();
    }
	
    else if(document.frm1.email.value=="")
    {
     alert("Please fill Email Address");
     document.frm1.email.focus();
    }
    else if(document.frm1.email.value.indexOf('@') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
     }
    else if(document.frm1.email.value.indexOf('.') == -1)
     {
      alert("Please check your E-mail field.");
      document.frm1.email.focus();
     }
/*	else if(document.frm1.phone.value.length<5)
    {
     alert("Please enter al least 5 characters to enter phone");
     document.frm1.phone.focus();
	}	
*/
	else if(document.frm1.login.value.length<5)
    {
     alert("Please Enter al least 5 characters to create Login Name");
     document.frm1.login.focus();
	}	
    else if(document.frm1.password.value.length<5)
    {
     alert("Please enter al least 5 characters to create password");
     document.frm1.password.focus();
    }
    else if(document.frm1.password.value=="")
    {
     alert("Please fill confirm password");
     document.frm1.password.focus();
    }
    else if(document.frm1.password.value != document.frm1.password2.value)
    {
     alert("The password and Confirm password do not match");
     document.frm1.password2.focus();
    }
   	else if (!document.frm1.agree.checked)
	{
		alert("Please accept terms & conditions to proceed registration");	
	}
	else 
	{
		document.frm1.submit();
	}
	}
//
	
	function redirect()
	{
		var optionval;
		optionval=document.frm1.CategoryID.options[document.frm1.CategoryID.selectedIndex].value;
		if (optionval!=0)
		{
			document.frm1.stream.value=document.frm1.CategoryID.options[document.frm1.CategoryID.selectedIndex].text;
			document.frm1.submit();
		}
	}

	function search_options()
	{
		document.state.state_name.value=document.state.state.options[document.state.state.selectedIndex].text;
		document.state.submit();
	}
	function refresh_win()
	{
		document.f2.state.value=document.f1.state.options[document.f1.state.selectedIndex].value;
		document.f2.state_name.value=document.f1.state.options[document.f1.state.selectedIndex].text;
		document.f2.submit();
	}

	function refresh_win2()
	{
		document.frm1.state_name.value=document.frm1.state.options[document.frm1.state.selectedIndex].text;
		document.frm1.submit();
	}

	function dynamic_window(strUrl, WinWidth, WinHeight)
	{
		window.open(strUrl,"PopUp","width=" + WinWidth + ",height=" + WinHeight + ",scrollbars=yes,resizable=yes");
	}	
	
	function check_user(WinWidth, WinHeight)
	{
		var strUrl="check_user.php?login="+document.frm1.login.value;
		window.open(strUrl,"PopUp","width=" + WinWidth + ",height=" + WinHeight + ",scrollbars=yes,resizable=yes");
	}	
	
	function place_city()
	{
		window.opener.frm1.city_display.value=document.f1.city.options[document.f1.city.selectedIndex].text;
//		window.opener.frm1.city_name.value=document.f1.city.options[document.f1.city.selectedIndex].text;
		window.opener.frm1.city.value=document.f1.city.options[document.f1.city.selectedIndex].value;
		window.opener.frm1.state.value=document.f1.state.options[document.f1.state.selectedIndex].value;
		window.opener.frm1.state_display.value=document.f1.state.options[document.f1.state.selectedIndex].text;
//		window.opener.frm1.state_name.value=document.f1.state.options[document.f1.state.selectedIndex].text;
		window.close();
	}

	function plan(id, plan_name)
	{
		window.opener.frm1.plan_display.value=plan_name;
		window.opener.frm1.plan_name.value=plan_name;
		window.opener.frm1.plan.value=id;
		window.close();
	}
	function upgrade_plan(id,plan_name,amount)
	{
		document.frm2.p.value=id;
		document.frm2.amount.value=amount;
		document.frm2.package_name.value=plan_name;
		document.frm2.submit();
	}
	function pick_state(state_name,state_id)
	{
		document.f3.state_name.value=state_name;
		document.f3.state.value=state_id;
		document.f3.submit();
	}
 function del_confirm(i)
  {
	if(confirm("CLICK OK  -  \r\r ARE YOU SURE, YOU WANT TO DELETE IT\r"))
		{	
			window.location.href=i;
		}
  }	
 function del_submit(form)
  {
	if(confirm("CLICK OK  -  \r\r ARE YOU SURE, YOU WANT TO DELETE IT\r"))
		{	
			document[form].submit();
		}
  }		
  	
	function fetch_city()
	{
		document.f2.state.value=document.frm1.state.options[document.frm1.state.selectedIndex].value;
		document.f2.state_name.value=document.frm1.state.options[document.frm1.state.selectedIndex].text;
		document.f2.submit();
	}  


 function validate_demand()
   {
  if(document.frm1.state.options[document.frm1.state.selectedIndex].value==0)
    {
     alert("Please select state here");
     document.f1.state.focus();
    } 
    else if(document.frm1.city.options[document.frm1.city.selectedIndex].value==0)
    {
     alert("Please select city here");
     document.f1.city.focus();
    }
	else if(document.frm1.c_person.value.length<1)
    {
     alert("Please fill contact person here");
     document.frm1.c_person.focus();
    }
	else if(document.frm1.phone.value.length<1)
    {
     alert("Please fill phone here");
     document.frm1.phone.focus();
    }
	else if(document.frm1.description.value.length<1)
    {
     alert("Please describe your property here");
     document.frm1.description.focus();
    }
	else if(document.frm1.description.value.length>200)
    {
     alert("Maximum 200 characters are allowed here");
     document.frm1.description.focus();
    }
	else 
	{
		document.frm1.submit();
	}
	}

// add to directory validation

 function validate_directory()
   {
    if(document.frm1.business_cat.options[document.frm1.business_cat.selectedIndex].value==0)
    {
     alert("Please select business category here");
     document.frm1.business_cat.focus();
    }
    else if(document.frm1.company.value.length<1)
    {
     alert("Please fill company name here");
     document.frm1.company.focus();
    }
    else if(document.frm1.c_person.value.length<1)
    {
     alert("Please fill contact person here");
     document.frm1.c_person.focus();
    }
    else if(document.frm1.address.value.length<1)
    {
     alert("Please fill address here");
     document.frm1.address.focus();
    }
    else if(document.frm1.address.value.length>300)
    {
     alert("Maximum 300 characters are allowed in address field");
     document.frm1.address.focus();
    }
     else if(document.frm1.state.options[document.frm1.state.selectedIndex].value==0)
    {
     alert("Please select state here");
     document.frm1.state.focus();
    }     
     else if(document.frm1.city.options[document.frm1.city.selectedIndex].text=="All Cities")
    {
     alert("Please select city here");
     document.frm1.city.focus();
    }
 	else if(document.frm1.phone.value.length<1)
    {
     alert("Please fill phone here");
     document.frm1.phone.focus();
    }
   else if(document.frm1.email.value!="" && document.frm1.email.value.indexOf('@') == -1)
     {
      alert("Please check your e-mail field.");
      document.frm1.email.focus();
     }
    else if(document.frm1.email.value!="" && document.frm1.email.value.indexOf('.') == -1)
     {
      alert("Please check your e-mail field.");
      document.frm1.email.focus();
     }
	else if(document.frm1.service.value.length<1)
    {
     alert("Please describe your service you offered ");
     document.frm1.service.focus();
    }
	else if(document.frm1.service.value.length>200)
    {
     alert("Maximum 200 characters are allowed here");
     document.frm1.service.focus();
    }	 
	else 
	{
		document.frm1.submit();
	}
	}
///================================= State and City ============================================================

//  var S1="~South~East~West";

  function Arrangecity(form)
   {
//	val = document.f2.state;
  	val = document[form].state;
//   	gr=document.f2.city;
	   	gr=document[form].city;
	if (status=='city'){
	    return
      }

    if (val.options[0].value=='AllGP' && val.options[0].selected==true) {
		glen=val.length
		for (x=1;x<glen;x++){
       		val.options[x].selected=false
       	}
      }

	status='state'
	tarray=new Array()
	for (i=gr.length;i>0;i--) {
		gr.options[0] = null;
	}

	glen=val.length
	for (x=0;x<glen;x++){
       		if (val.options[x].selected==true){
			state= val.options[x].value;
			var state1=state.split(" ")			
			var state2=state1.join("_")			
			//city1=eval('document.f2.S'+ state2 +'.value');
	city1=eval('S'+ state2);
			var city2=city1.split("~")

					for (i=0;i<city2.length;i++) 
					{
					tlen=tarray.length
				    pexist=false

					for (k=0;k<tlen;k++)
					{
						if (tarray[k]==city2[i])
						{
							 pexist=true
							 break
						}
					}		
					if (pexist==false)
					tarray[tlen]=city2[i]
					}
			}
  	}

  				if (state =='--Select a Category--'){
  				    status=''
					alert(state)
  					var valOption = new Option("--Select a Category--","Colors");
					var valLen = gr.length;
					gr.options[0] = valOption;
				}

		  	for (i=1;i<tarray.length;i++) {
				var valOption = new Option(tarray[i],tarray[i]);
				var valLen = gr.length;
				gr.options[valLen] = valOption;
			}

			if (state !='AllGP'){
			    	var valLen=gr.length
					for (i=0;i<valLen;i++){
					}
			}else{
				gr.options[0].selected=true
			}

}


// ====================== Price Range =====================


function price_rent()
{
	document.frm1.price.options.length = 0;
	var option0= new Option("Select a Price Range","");
	var option1= new Option("Below 2,000","0-2000");
	var option2= new Option("2,000 to 4,000","2000-4000");
	var option3= new Option("4,000 to 6,000","4000-6000");
	var option4= new Option("6,000 to 8,000","6000-8000");
	var option5= new Option("8,000 to 10,000","8000-10000");
	var option6= new Option("10,000 to 15,000","10000-15000");
	var option7= new Option("15,000 to 20,000","15000-20000");
	var option8= new Option("20,000 to 25,000","20000-25000");
	var option9= new Option("Above 25,000","25000");
	
	for(var i=0;i<10;i++)
	{
		eval("document.frm1.price.options[i]=option" + i);
	}
}

function price_sell()
{
	document.frm1.price.options.length = 0;
	var option0= new Option("Select a Price Range","");
	var option1= new Option("Below 5 lacs","500000-1000000");
	var option2= new Option("5 to 10 lacs","500000-1000000");
	var option3= new Option("10 to 15 lacs","1000000-1500000");
	var option4= new Option("15 to 25 lacs","1500000-2500000");
	var option5= new Option("25 to 40 lacs","2500000-4000000");
	var option6= new Option("40 to 60 lacs","4000000-6000000");
	var option7= new Option("60 to 100 lacs","6000000-10000000");
	var option8= new Option("1 to 1.5 crores","10000000-15000000");
	var option9= new Option("1.5 to 2 crores","15000000-20000000");
	var option10= new Option("2.0 to 2.5 crores","20000000-25000000");
	var option11= new Option("above 2.5 crores","25000000");
	for(var i=0;i<12;i++)
	{
		eval("document.frm1.price.options[i]=option" + i);
	}
}

function price_both()
{
	document.frm1.price.options.length = 0;
	var option0= new Option("Select a Price Range","");
	var option1= new Option("Below 2,000","0-2000");
	var option2= new Option("2,000 to 4,000","2000-4000");
	var option3= new Option("4,000 to 6,000","4000-6000");
	var option4= new Option("6,000 to 8,000","6000-8000");
	var option5= new Option("8,000 to 10,000","8000-10000");
	var option6= new Option("10,000 to 15,000","10000-15000");
	var option7= new Option("15,000 to 20,000","15000-20000");
	var option8= new Option("20,000 to 25,000","20000-25000");
	var option9= new Option("Above 25,000","25000");
	var option10= new Option("Below 5 lacs","500000-1000000");
	var option11= new Option("5 to 10 lacs","500000-1000000");
	var option12= new Option("10 to 15 lacs","1000000-1500000");
	var option13= new Option("15 to 25 lacs","1500000-2500000");
	var option14= new Option("25 to 40 lacs","2500000-4000000");
	var option15= new Option("40 to 60 lacs","4000000-6000000");
	var option16= new Option("60 to 100 lacs","6000000-10000000");
	var option17= new Option("1 to 1.5 crores","10000000-15000000");
	var option18= new Option("1.5 to 2 crores","15000000-20000000");
	var option19= new Option("2.0 to 2.5 crores","20000000-25000000");
	var option20= new Option("above 2.5 crores","25000000");
	for(var i=0;i<21;i++)
	{
		eval("document.frm1.price.options[i]=option" + i);
	}
}



///================================= Category and SubCategory ============================================================

  function Arrangesub_cat(form)
   {
//	val = document.f2.CategoryID;
  	val = document[form].CategoryID;
//   	gr=document.f2.sub_cat;
	   	gr=document[form].sub_cat;
	if (status=='sub_cat'){
	    return
      }

    if (val.options[0].value=='AllGP' && val.options[0].selected==true) {
		glen=val.length
		for (x=1;x<glen;x++){
       		val.options[x].selected=false
       	}
      }

	status='CategoryID'
	tarray=new Array()
	for (i=gr.length;i>0;i--) {
		gr.options[0] = null;
	}

	glen=val.length
	for (x=0;x<glen;x++){
       		if (val.options[x].selected==true){
			CategoryID= val.options[x].value;
			var CategoryID1=CategoryID.split(" ")			
			var CategoryID2=CategoryID1.join("_")			
			//sub_cat1=eval('document.f2.S'+ CategoryID2 +'.value');
	sub_cat1=eval('SC'+ CategoryID2);
			var sub_cat2=sub_cat1.split("~")

					for (i=0;i<sub_cat2.length;i++) 
					{
					tlen=tarray.length
				    pexist=false

					for (k=0;k<tlen;k++)
					{
						if (tarray[k]==sub_cat2[i])
						{
							 pexist=true
							 break
						}
					}		
					if (pexist==false)
					tarray[tlen]=sub_cat2[i]
					}
			}
  	}

  				if (CategoryID =='--Select a Category--'){
  				    status=''
					alert(CategoryID)
  					var valOption = new Option("--Select a Category--","Colors");
					var valLen = gr.length;
					gr.options[0] = valOption;
				}

		  	for (i=1;i<tarray.length;i++) {
				var valOption = new Option(tarray[i],tarray[i]);
				var valLen = gr.length;
				gr.options[valLen] = valOption;
			}

			if (CategoryID !='AllGP'){
			    	var valLen=gr.length
					for (i=0;i<valLen;i++){
					}
			}else{
				gr.options[0].selected=true
			}

}



///================================= Special case of property registration ============================================================

  function picksub_cat(form)
   {
//	val = document.f2.CategoryID;
  	val = document[form].CategoryID;
//   	gr=document.f2.sub_cat;
	   	gr=document[form].sub_cat;
	if (status=='sub_cat')
	{
	    return
      }
	  
	  
// Show bed / bath
var rname="block1";	
var element=document.getElementById(rname);
var catval=document[form].CategoryID.value;

	if (catval==3)
	{
		if (element.style.display == "none")
		{
			element.style.display="block";
		}
	}
	else
	{
		element.style.display="none";
	}
	
// end of bed / bath show block

// Show / hide additional feature 1st block
var rname1="block2";	
var element1=document.getElementById(rname1);

	if (catval==3)
	{
		if (element1.style.display == "none")
		{
			element1.style.display="block";
		}
	}
	else
	{
		element1.style.display="none";
	}
	
// end of Show / hide additional feature 1st block

// Show / hide additional feature 2nd block
var rname2="block3";	
var element2=document.getElementById(rname2);

	if (catval==2)
	{
		if (element2.style.display == "none")
		{
			element2.style.display="block";
		}
	}
	else
	{
		element2.style.display="none";
	}
// end of Show / hide additional feature 2nd block

// Show / hide additional feature 2nd block
var rname3="block4";	
var element3=document.getElementById(rname3);

	if (catval==1 || catval==4)
	{
		if (element3.style.display == "none")
		{
			element3.style.display="block";
		}
	}
	else
	{
		element3.style.display="none";
	}
// end of Show / hide additional feature 2nd block


    if (val.options[0].value=='AllGP' && val.options[0].selected==true) {
		glen=val.length
		for (x=1;x<glen;x++){
       		val.options[x].selected=false
       	}
      }

	status='CategoryID'
	tarray=new Array()
	for (i=gr.length;i>0;i--) {
		gr.options[0] = null;
	}

	glen=val.length
	for (x=0;x<glen;x++){
       		if (val.options[x].selected==true){
			CategoryID= val.options[x].value;
			var CategoryID1=CategoryID.split(" ")			
			var CategoryID2=CategoryID1.join("_")			
			//sub_cat1=eval('document.f2.S'+ CategoryID2 +'.value');
	sub_cat1=eval('SC'+ CategoryID2);
			var sub_cat2=sub_cat1.split("~")

					for (i=0;i<sub_cat2.length;i++) 
					{
					tlen=tarray.length
				    pexist=false

					for (k=0;k<tlen;k++)
					{
						if (tarray[k]==sub_cat2[i])
						{
							 pexist=true
							 break
						}
					}		
					if (pexist==false)
					tarray[tlen]=sub_cat2[i]
					}
			}
  	}

  				if (CategoryID =='--Select a Category--'){
  				    status=''
					alert(CategoryID)
  					var valOption = new Option("--Select a Category--","Colors");
					var valLen = gr.length;
					gr.options[0] = valOption;
				}

		  	for (i=1;i<tarray.length;i++) {
				var valOption = new Option(tarray[i],tarray[i]);
				var valLen = gr.length;
				gr.options[valLen] = valOption;
			}

			if (CategoryID !='AllGP'){
			    	var valLen=gr.length
					for (i=0;i<valLen;i++){
					}
			}else{
				gr.options[0].selected=true
			}

}
