function hideAll()
{
	for(i=0;i<=4;i++)
	{
		if (document.getElementById('subnav'+i).childNodes)
		{
			
			var ul=document.getElementById('subnav'+i);
			for(z=0;z<ul.childNodes.length;z++)
			{
				if(ul.childNodes[z].style)
				{
					ul.childNodes[z].style.display='none';
				}
			}
		}
	}
}

function showMe(id)
{
	hideAll();
	var ul=document.getElementById('subnav'+id);
	for(z=0;z<ul.childNodes.length;z++)
	{
		if(ul.childNodes[z].style)
		{
			ul.childNodes[z].style.display='inline';
		}
	}
}


function setVal(id,val)
{
	if(document.getElementById(id))
	{
		document.getElementById(id).value=val;
	}
}






// race Admin

function showLeg(id)
{
	if(document.getElementById(id))
	{document.getElementById(id).style.display='inline'; }
}


function hideLeg(id)
{
	if(document.getElementById(id))
	{
		document.getElementById(id).style.display='none';
	}
}

function showLegs()
{
	var a = document.raceform.sportCount.selectedIndex;
	if( a == '0')
	{
		hideLeg('event1');
		hideLeg('event2');
		hideLeg('event3');
	}
	
	if( a == '1')
	{
		showLeg('event1');
		hideLeg('event2');
		hideLeg('event3');
	}
	
	if( a == '2')
	{
		showLeg('event1');
		showLeg('event2');
		hideLeg('event3');
	}
	
	if( a == '3')
	{
		showLeg('event1');
		showLeg('event2');
		showLeg('event3');
	}
}

function checkRequires()
{
	var msg='';
	if(document.raceform.sportCount.selectedIndex=='0')
	{
		 msg=" A race with no legs?";
		 //msg=document.raceform.sportCount.selectedIndex;
	}
	
	if(document.raceform.totaldist=='')
	{
		 msg=' No total distance?';
	}
	
	if (msg!='')
	{
		alert(msg);
	}
	else
	{
		document.raceform.submit();
	}
}


function selectedValue(selBox) 
{
  return selBox.options[selBox.selectedIndex].value;
}


function forceValue(selBox, val)
{
	selBox.options[selBox.selectedIndex].value=val;
}


