// JavaScript Document

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}


function submitform()
{ 
  
  /*if(document.drop_list.SubCat.value!="") {
   var  varNav=document.drop_list.SubCat.value;
   varNav=varNav.replace("/dubai_properties/en/","") + ".html";
   document.drop_list.action=varNav;
   document.drop_list.submit();
   }
  else
  { 
   alert("Please select 'SubCat'");
   return false;
  }*/
  
  var varFlag=0;
  var varNav;
  
  // if both dropdowns are not selected
  if((document.drop_list.Category.value=="") && (document.drop_list.SubCat.value=="")) {
	alert("Please select 'Project Type'");
	document.drop_list.Category.focus();
	varFlag=0;
	return false;
   }
   
  //if both dropdowns are selected
  else if((document.drop_list.Category.value!="") && (document.drop_list.SubCat.value!="")) { 
   varNav=document.drop_list.SubCat.value;
   varFlag=1;
   
   }
   
   //if only category dropdown is selected
   else if((document.drop_list.Category.value!="") && (document.drop_list.SubCat.value=="")) { 
   varNav=document.drop_list.Category.value;
   varFlag=1;
   }
   
   //if at least one dropdown is selected then submit the page
   if(varFlag==1)
    {
	 varNav=varNav.replace("/dubai_properties/en/","") + ".html";
     document.drop_list.action=varNav;
     document.drop_list.submit();
	 }
  
  return true; 
}