/*
Clear the postal code text field on focus
*/
function clearfield()
	{
	document.forms.search.PC.value='';
	}
	
	/*
Validate the search form entries for postal code and subject
*/

function validate()
	{
	var zip = document.forms.search.PC.value;  
	var subject = document.forms.search.PROG.value;
	var flag_zip = false;
	var flag_sub = false;
	document.getElementById('error1').innerHTML = '';
	document.getElementById('error2').innerHTML = '';

	if (zip != null && (zip.length) == 5 && ((zip.indexOf(0) == 0) || (parseInt(zip) == zip)))
	{
		flag_zip = true;
	}	  
		if (subject != 'none' ) 
	{ 
		flag_sub = true;
	}
		   
	if (!(flag_zip))
		document.getElementById('error1').innerHTML = 'Valid Zip Required';
		
	if (!(flag_sub))	
		document.getElementById('error2').innerHTML = 'Subject Required';
		
	if (!(flag_zip && flag_sub))
		{}
	
	else 
		document.forms.search.submit();	
	}	
	
/*
Intercept the form values submitted from search form and pass them to the iframe
*/

function iframe(){
var queryString = window.top.location.search.substring(1);
var zip = "";
var prog = "";
var parameterName = "PC=";
if ( queryString.length > 0 ) {
// Find the beginning of the string PC
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
zip = queryString.substring ( begin, end );
}
}
parameterName = "PROG=";
if ( queryString.length > 0 ) {
// Find the beginning of the string PROG
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
prog = queryString.substring ( begin, end );
//alert(zip + prog);
}

}

var elem = document.getElementById("results");
var url = "http://l.lipsno.com/cgi/r?;n=203;c=211847;s=855;x=7936;f=200608021729150;u=j;z=TIMESTAMP;";
elem.src = "http://www.search-schools.net/2/quad.jsp?URL="+url+"&PROG="+prog+"&PC="+ zip;
}
/*
NOTE
REPLACE URL VARIABLE WITH PUBLISHER-SPECIFIC TRACKING URL
*/
