
window.name = "Main"


function WhenPageIsLoaded(temp)
{
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		temp.style.textDecoration='underline';
		temp.style.color='blue';
	}
}

function ClearHighlights()
{
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		window.document.globaled.zipcode.style.backgroundColor='';
		window.document.globaled.city.style.backgroundColor='';
		window.document.globaled.itemname.style.backgroundColor='';
		window.document.globaled.state.style.backgroundColor='';
		institutions.style.backgroundColor='';
	}
}


function BrowseCity()
{
	var that_number = window.document.globaled.State.selectedIndex
	State = window.document.globaled.State.options[that_number].value
	StateName = window.document.globaled.State.options[that_number].text

	if (State == '')
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			ClearHighlights();
			window.document.globaled.state.style.backgroundColor='#ffffcc';
		}
		alert('SEARCH TIP:\nPlease select a state, before you browse for a city.');
		window.document.globaled.State.focus();
	}
	else{

		window.open('city_popup.asp?STABBR=' + State + '&STATENAME=' + StateName,'CityWindow','width=330,height=350, screenX=0,screenY=0,top=0,left=0,scrollbars=yes,resizable=no');
	}
}



function MoreInfo(LinkData)
{
	window.open(LinkData,'NCESSCH','width=440,height='+ (screen.height-60) +',screenX=0,screenY=0,top=0,left=0,scrollbars=yes,resizable=yes');
}



function CheckAll()
{


	if ((window.document.globaled.School.checked == true) && (window.document.globaled.PrivSchool.checked == true) && (window.document.globaled.College.checked == true) && (window.document.globaled.Library.checked == true))
	{		
		window.document.globaled.School.checked = false;
		window.document.globaled.PrivSchool.checked = false;
		window.document.globaled.College.checked = false;
		window.document.globaled.Library.checked = false;
	}
	else
	{
		window.document.globaled.School.checked = true;
		window.document.globaled.PrivSchool.checked = true;
		window.document.globaled.College.checked = true;
		window.document.globaled.Library.checked = true;
	}
}



function Searching(Value1)
{
	document.globaled.Status.value = Value1;
}

function RecordsFound(Value2)
{
	document.globaled.Records.value = Value2;
}



function changeAltstate()
{
	if (document.globaled.State.options[document.globaled.State.selectedIndex].value == 'DC')
	{
		document.globaled.city.value = "Washington";
	}

	if (document.globaled.State.options[document.globaled.State.selectedIndex].value == 'PW')
	{
		document.globaled.city.value = "Koror";
	}

	if (document.globaled.State.options[document.globaled.State.selectedIndex].value == 'AS')
	{
		document.globaled.city.value = "Pago Pago";
	}

}



function formvalidation(thisform)
{
	if (document.globaled.State.options[document.globaled.State.selectedIndex].value =='OTHER')
	{
		temp = confirm(document.globaled.State.options[document.globaled.State.selectedIndex].text + " cannot be searched from\nSearch for Schools, Colleges, and Libraries.\n\n  -  To perform a different search, click CANCEL.\n  -  To search using Search for Public Schools, click OK.");

		if (temp == true)
		{
			window.location.href = '/ccd/schoolsearch/';
			return false;
		}
		else
		{
			document.globaled.State.selectedIndex = 0;
			return false;
		}
	}
	else if ((document.globaled.city.value == '') && (document.globaled.zipcode.value == '') && (document.globaled.itemname.value == ''))
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			ClearHighlights();
			window.document.globaled.zipcode.style.backgroundColor='#ffffcc';
			window.document.globaled.city.style.backgroundColor='#ffffcc';
			window.document.globaled.itemname.style.backgroundColor='#ffffcc';
		}
		alert("SEARCH TIP:\nThis search tool requires a Name, City, or Zip Code to begin searching.")
		window.document.globaled.city.focus();
		return false;
	}		
	else
	{
		if ((document.globaled.School.checked == false) && (document.globaled.PrivSchool.checked == false) && (document.globaled.College.checked == false) && (document.globaled.Library.checked == false))
		{
			if (navigator.appName == 'Microsoft Internet Explorer')
			{
				ClearHighlights();
				institutions.style.backgroundColor='#ffffcc';
			}

			temp = confirm("SEARCH TIP:\nTo continue with search, at least one of four types of Institutions,\nfound on the right side of the search tool, must be selected. \n\n  -  To manually select an institution, click CANCEL.\n  -  To automatically select all institutions and continue search, click OK.");

			if (temp == 1)
			{
				CheckAll();
				ClearHighlights();
				return true;
			}
			else
			{
				return false;
			}

		}
		else
		{
			if ((document.globaled.zipcode.value.length < 5) && (document.globaled.zipcode.value != ''))
			{
				if (navigator.appName == 'Microsoft Internet Explorer')
				{
					ClearHighlights();
					window.document.globaled.zipcode.style.backgroundColor='#ffffcc';
				}

				alert("SEARCH TIP:\nThis search tool requires a Zip Code to be a 5 digit number.")
				window.document.globaled.zipcode.focus();
				return false;
			}
			else
			{
				return true;
			}
		}
	}
}


function OnOff(temp)
{
    
    var temp2;
    temp2 = document.getElementById(temp);
    
    if (temp2.style.display=='none')
	{
		temp2.style.display='inline';
	}
	else
	{
		temp2.style.display='none';
	}

}


function OnOnly(temp)
{
	if (temp.style.display=='none')
	{
		temp.style.display='inline'
	}
}
