

 
 
function Change(ctlName, event,sel)
{
	if (event =='over' && sel == 0)
	{
		//document.all(ctlName).style.border = 'thin blue outset';
		document.all(ctlName).style.cursor = 'hand';
		document.all(ctlName).style.background = 'navy';
		document.all(ctlName).style.color = '#c6eff7';
	}
	else if (event =='over' && sel == 1)
	{
		//document.all(ctlName).style.border = 'thin navy outset';
		document.all(ctlName).style.cursor = 'hand';
		document.all(ctlName).style.background = 'navy';
		document.all(ctlName).style.color = '#c6eff7';
	}
	else
	{
		//document.all(ctlName).style.border = 'thin white solid';
		document.all(ctlName).style.background = '#c6eff7';
		document.all(ctlName).style.color = 'navy';
	}
}

function isblanks(s)	{
	for(var i = 0; i < s.length; i++){
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
	}
	return true;
}


function disablehospitalfromcity()	{


//document.search.county.selectedIndex != 0



		document.search.hospital.disabled = true;
		if (document.search.city.selectedIndex == 0 || document.search.city.selectedIndex == document.search.city.length - 1) {
			document.search.hospital.disabled = false;
			if (document.search.county.selectedIndex != 0 && document.search.county.selectedIndex != document.search.county.length - 1 ) {
				document.search.hospital.disabled = true;
			}
		}
}



function disablehospitalfromcounty()	{
		document.search.hospital.disabled = true;
		if (document.search.county.selectedIndex == 0  || document.search.county.selectedIndex == document.search.county.length - 1 ) {
			document.search.hospital.disabled = false;
			if (document.search.city.selectedIndex != 0   && document.search.city.selectedIndex != document.search.city.length - 1) {
				document.search.hospital.disabled = true;
			}
		}
}
function disablecitycounty()	{
	document.search.city.disabled = true;
	document.search.county.disabled = true;
	if (document.search.hospital.selectedIndex == 0  || document.search.hospital.selectedIndex == document.search.hospital.length - 1) {
		document.search.city.disabled = false;
		document.search.county.disabled = false;
	}
}


function reactivate()	{

		document.search.city.disabled = false;
		document.search.county.disabled = false;
		document.search.hospital.disabled = false;
}


function verify(f)	{
	var nonemptyfield;
	nonemptyfield = 0;
//if (document.search.county.selectedIndex != 0 && document.search.county.selectedIndex != document.search.county.length - 1 ) 
//{
//if (document.search.hospital.selectedIndex == 0 || document.search.hospital.selectedIndex == document.search.hospital.length - 1 ) 
//{
				//alert('np') ;
//}
//}


	for(var i = 0; i < f.length; i++)
	{
		var e = f.elements[i];


if (( e.name == "county") && ( e.selectedIndex != 0)  && (e.selectedIndex != e.options.length - 1) )
		{
return verify2(f) ;
		}

if (( e.name == "city") && ( e.selectedIndex != 0)  && (e.selectedIndex != e.options.length - 1) )
		{
return verify22(f) ;
		}



		if (e.type == "text")
		{
			if ((e.value == null) || (e.value == '') || isblanks(e.value))
				continue;
			else {
				nonemptyfield = nonemptyfield + 1;
				break;
				}
		}
		if ((e.type == 'select-one') || (e.type == 'select-multiple'))
		{
			if ( (e.selectedIndex == 0)  || (e.selectedIndex == e.options.length - 1))
			{

				for(var g = 1; g < e.options.length - 1 ; g++)
				{					
					if (e.options[g].selected)					
					{
						nonemptyfield = nonemptyfield + 1;						
						//alert(e.options[g].text);
						break;
					}
				
				}
				if (nonemptyfield > 0 )
				{
					break;
				}
				else
				{				
				continue;
				}
				
			}
			else	
			{
				nonemptyfield = nonemptyfield + 1;
				break;
			}
		}
	}
	if (nonemptyfield == 0){
		alert('Please enter at least one criteria field for search.');
		return false;
		}
	else 
		return true;
}


function verify2(f)	
{
	var nonemptyfield;
	nonemptyfield = 0;



	for(var i = 0; i < f.length; i++)
	{
		var e = f.elements[i];


//if ((e.name != "county") && (e.name != "city")) 

if (e.name != "county") 

{

		

		if (e.type == "text")
		{
			if ((e.value == null) || (e.value == '') || isblanks(e.value))
				continue;
			else {
				nonemptyfield = nonemptyfield + 1;
				break;
				}
		}
		if ((e.type == 'select-one') || (e.type == 'select-multiple'))
		{
			if ( (e.selectedIndex == 0)  || (e.selectedIndex == e.options.length - 1))
			{

				for(var g = 1; g < e.options.length - 1 ; g++)
				{					
					if (e.options[g].selected)					
					{
						nonemptyfield = nonemptyfield + 1;						
						//alert(e.options[g].text);
						break;
					}
				
				}
				if (nonemptyfield > 0 )
				{
					break;
				}
				else
				{				
				continue;
				}
				
			}
			else	
			{
				nonemptyfield = nonemptyfield + 1;
				break;
			}
		}
}


	}



	if (nonemptyfield == 0){
		alert('Please enter at least one more criteria field for search.');
		return false;
		}
	else 
		return true;
}

function verify22(f)	
{
	var nonemptyfield;
	nonemptyfield = 0;



	for(var i = 0; i < f.length; i++)
	{
		var e = f.elements[i];


if  (e.name != "city")
{

		

		if (e.type == "text")
		{
			if ((e.value == null) || (e.value == '') || isblanks(e.value))
				continue;
			else {
				nonemptyfield = nonemptyfield + 1;
				break;
				}
		}
		if ((e.type == 'select-one') || (e.type == 'select-multiple'))
		{
			if ( (e.selectedIndex == 0)  || (e.selectedIndex == e.options.length - 1))
			{

				for(var g = 1; g < e.options.length - 1 ; g++)
				{					
					if (e.options[g].selected)					
					{
						nonemptyfield = nonemptyfield + 1;						
						//alert(e.options[g].text);
						break;
					}
				
				}
				if (nonemptyfield > 0 )
				{
					break;
				}
				else
				{				
				continue;
				}
				
			}
			else	
			{
				nonemptyfield = nonemptyfield + 1;
				break;
			}
		}
}


	}



	if (nonemptyfield == 0){
		alert('Please enter at least one more criteria field for search.');
		return false;
		}
	else 
		return true;
}
