// JavaScript Document
function rollOver(thisSrc)
{
	thisSrc.src = thisSrc.src.replace('_off', '_on');
}

function rollOut(thisSrc)
{
	thisSrc.src = thisSrc.src.replace('_on', '_off');
}

function show_layer(this_layer, layers)
{
	var num_layers = layers.length;
	//alert(num_layers);
	for(i = 0; i < num_layers; i++)
	{
		if(this_layer == layers[i])
		{
			action = 'show';	
		}
		else
		{
			action = 'hide';
		}
		//alert(layers[i]);
		show_hide_layer(document.getElementById(layers[i]), action);
		
	}
	/*
	
	if(this_layer == '' && action == 'hide' && default_selected != null && mOver != "true")
	{
		//show_hide_layer(open_selected, 'show');
		//add_selected(default_selected, 'add');
	}
	*/
}

function show_hide_layer(this_layer, action)
{
	//alert(this_layer);
	switch(action)
	{
		case 'show':
			this_layer.style.display = 'block';
		break
		
		case 'hide':
			this_layer.style.display = 'none';
		break;
	}
}

function switch_selected(this_tab, tabs)
{

	var num_tabs = tabs.length;

	for( i = 0; i < num_tabs; i++)
	{
		switch(tabs[i] == this_tab.id)
		{
			case true:
				if(this_tab.className.indexOf('selected') == -1)
				{
					this_tab.className = 'selected';
				}
			break;
			
			default:
				if(document.getElementById(tabs[i]).className.indexOf('selected') != -1)
				{
					document.getElementById(tabs[i]).className = document.getElementById(tabs[i]).className.replace('selected', '');
				}
			break;
		}
	}
}

function add_selected(thislink, action)
{
	switch(action)
	{
		case 'add':
			if(thislink.className.search('selected') == -1)
			{
				thislink.className = thislink.className + ' selected';
			}
		break;
		
		case 'remove':
				thislink.className = thislink.className.replace('selected', '');
		break;
	}
}

function reset_default_selected()
{
	//alert(default_parent.id);
	if(mOver != "true" && default_parent != null)
	{
		add_selected(default_parent, 'add');
		show_hide_layer(default_open_menu, 'show');
		add_selected(default_child, 'add');
	}
}
