// We run this survey for validating the select box when// search type does not equal state.function searchSelect(){	if(!document.theForm.resultComplete)	{   		if(document.theForm.survey.selectedIndex >= 0)   		{      		document.theForm.submit();    		}   		else    		{	 		return;   		}	} 	else	{	    document.theForm.submitter.click();	}}// This one is used when searchType is state.function stateSelect(){	if(!document.theForm.resultComplete)	{   		if(document.theForm.survey.selectedIndex >= 0 && document.theForm.state.selectedIndex > 0)   		{     		document.theForm.submit();   		}		else    		{	 		return;   		}	}	else	{	    document.theForm.submitter.click();	}}// Full validation of the form when "Run Report" is clicked. // This behaves differently depending on the search type, so pass that in.function validateForm(searchType){   if(searchType == "market")   {        if(document.theForm.survey.selectedIndex < 0)   		{      		alert("Select a survey.\n");			return;   		}		if(document.theForm.market.selectedIndex == 0)		{			alert("Select a market.\n");			return;		}		document.theForm.submit();	}	if(searchType == "state")	{        if(document.theForm.survey.selectedIndex < 0)   		{      		alert("Select a survey.\n");			return;   		}		if(document.theForm.market.selectedIndex == 0)		{			alert("Select a market.\n");			return;		}		if(document.theForm.state.selectedIndex == 0)		{			alert("Select a state.\n");			return;		}		document.theForm.submit();   }}// Figure out what the survey name is for any given survey code.// Pass in the survey code, get back the full survey name.function surveyName(code){   var season, year, first, last, f = "";   var seasons = new Array("Winter", "Spring", "Summer", "Fall");      first = code.slice(0,2);   last  = code.slice(2,4);        first = first.toLowerCase();         year = "20" + last;            for(var i=0;i<seasons.length;i++)   {      f = seasons[i].slice(0,2);	  f = f.toLowerCase();	  if(f == first)	  {	     season = seasons[i];	  }    }        return(season + " " + year);}// Mimicks a reset button to reset the form back to its original state.function formReset(){	location.replace("mktdefs.asp");}
