<!--
// ============================================================================
// ======================= Classified Ventures, 2000 ==========================
// ============================================================================
	
   

// Determine whether to do a zipcode search or city/state
//     zipcode overrides city/state
function deterLoad()
{

theCity = window.document.qs.city.value;
theState =
window.document.qs.state.options[window.document.qs.state.selectedIndex].value;
theZip = window.document.qs.zip.value;
theZip = escape(theZip);



  if (theZip.length > 0)
  {  
       return loadZS();
	   
  }
  else if ( theState != "")
  {

       return loadQS();
  }
  
  else
  {
    alert("Please enter a \"city and state\" or \"zipcode\".");
    return false;
  }
  
  

}


function loadQS(w)
{
var theCity;
var theState;
var radius;
var bool;



 

theCity = window.document.qs.city.value;
theState = window.document.qs.state.options[window.document.qs.state.selectedIndex].value;
radius = window.document.qs.rad.options[window.document.qs.rad.selectedIndex].value;

		if(theCity == ""){
		alert("Please enter a City");
		document.qs.city.focus();
		return false;
		}
	
	
  
	
bool = validateForm(theState);
 if (bool == "n")
{
  return false;
}


else
{

theCity = escape(theCity);

  var qString;
  if (radius==null){
  qString = "http://www.apartments.com/Results.aspx?page=results&stype=city&city=" + theCity + "&state=" + theState+"&partner=" + PartnerValue;
  
  }else{
 
	qString = "http://www.apartments.com/Results.aspx?page=results&stype=city&city=" + theCity + "&state="+theState+"&rad="+radius+"&partner=" + PartnerValue;
  
	}
	
	window.document.location = qString;
	
  return false;
}

}

function validateForm(st)
{
var daState = st;

if (daState == "")
{
	alert("Please Select a State from the menu")
	return("n");
}

else
{
return("y");
}
}
//NxB
function loadZS()
{
	var theZip;
	var bool;
	
 

	theZip = document.qs.zip.value;
	
	theZip = escape(theZip);
radius = window.document.qs.rad.options[window.document.qs.rad.selectedIndex].value;
	if(theZip.length < 5)
	{
		alert("Please enter one/multiple 5 digit zip code/s seperated by commas");
		return false;
	}
	
		
	
	var qString;
	  if (radius==null){
	qString  = "http://www.apartments.com/Results.aspx?page=results&stype=zip&zip=" + theZip+"&partner=" + PartnerValue;	
	}else{
	qString  = "http://www.apartments.com/Results.aspx?page=results&stype=zip&zip=" + theZip+"&rad="+radius+"&partner=" + PartnerValue;	
	}
	window.document.location = qString;
	return false;
}








//~NxB
//-->

