var lengthy;
var section = new Array();
var match;
function domlay_radio_multiple(id,toggle)
{
	if ( toggle == "TRUE" ) domlay_on(id);
	else domlay_off(id);
}

function domlay_radio(id,toggle)
{
	if ( toggle == "TRUE" ) domlay_on(id);
	else domlay_off(id);
}

function domlay(id) 
{
	//check and see if the id value is already in our section array. If it isn't, we display the div.
	//get the array length
	lengthy = section.length;
	var i = 0;
	do
	{
		//if we have the id in the array we make note of it, and elminate the value from the array.
		if ( id == section[i] ) {
			match = "yes";
			section[i] = 0;
		}
		i++;
	}
	while(i <= lengthy);
	
	//Show layer
	if (match!="yes") 
	{
		domlay_on(id);
	}
	//Hide layer
	else if (match=="yes")
	{
	    match = 0;
		domlay_off(id);
	}
}

function domlay_on(id)
{
	if (document.layers) document.layers[''+id+''].display = "block"
	else if (document.getElementById) document.getElementById(''+id+'').style.display = "block"	
	else if (document.all) document.all[''+id+''].style.display = "block"		
	//add the layer name to the section array if it's not already in there
	//Find out if the layer is visible
	//lengthy = section.length;
	var already_there = "no";
	var i = 0;
	do
	{
		//if we have the id in the array that means the div is visible, and we need to hide it. Otherwise we're all good.
		if ( id == section[i] ) {
			already_there = "yes";
		}
		i++;
	}
	while(i <= lengthy);
	
	if ( already_there != "yes" )
	{
		lengthy ++;
		section[lengthy] = id;
	}
}

function domlay_off(id)
{
	if (document.layers) document.layers[''+id+''].display = "none"
	else if (document.getElementById) document.getElementById(''+id+'').style.display = "none"
	else if (document.all) document.all[''+id+''].style.display = "none"			
}


function domlay_form(box,id) 
{
	//check and see if the id value is already in our section array. If it isn't, we display the div.
	//get the array length
	lengthy = section.length;
	var i = 0;
	do
	{
		//if we have the id in the array we make note of it, and elminate the value from the array.
		if ( id == section[i] ) {
			match = "yes";
			section[i] = 0;
		}
		i++;
	}
	while(i <= lengthy);
	
	//Show layer
	if (match!="yes") 
	{
		if (document.layers) document.layers[''+id+''].display = "block"
		else if (document.getElementById) document.getElementById(''+id+'').style.display = "block"	
		else if (document.all) document.all[''+id+''].style.display = "block"
		
		//check  the box
		//alert(box);
		var parentBox = eval("document.signup." + box);
		parentBox.checked = true;		
		
		//add the layer name to the section array
		lengthy ++;
		section[lengthy] = id;
	}
	//Hide layer
	else if (match=="yes")
	{
	    match = 0;

		//uncheck the box
		var parentBox = eval("document.signup." + box);
		parentBox.checked = false;		
		
		domlay_off(id);

	}
}
