var seledit, selstate, goedit, gostate;

function init()
{
	seledit = document.getElementById('seleditions');
	selstate = document.getElementById('selstate');
	goedit = document.getElementById('goedit');
	gostate = document.getElementById('gostate');	
	seledit.options.selectedIndex=0;
	selstate.options.selectedIndex=0;
}

function sel_edition(seledit)
{
	eo = seledit.options;

	switch(eo[eo.selectedIndex].value)
	{
		case '2009':
			selstate.style.visibility='visible';
			goedit.style.visibility='hidden';
			gostate.style.visibility='visible';		
			break;
		
		default:
			goedit.style.visibility='visible';		
			gostate.style.visibility='hidden';
			selstate.style.visibility='hidden';
	}
}

function go_edition()
{
	eo = seledit.options;
	if(eo.selectedIndex < 1)
		alert('Please select an edition');
	else if (eo[eo.selectedIndex].value  == 'mathtriumphs')
		location.href= "/math/mathtriumphs/index.html"
	else if (eo[eo.selectedIndex].value  == 'mathconnects')
		location.href= "/math/mathconnects/index.html"
	else
		location.href= "/math/" + eo[eo.selectedIndex].value + "/student/"
	
	return false;
}

function go_edition_state()
{
	eo = seledit.options;
	so = selstate.options;
	
	if(eo.selectedIndex < 1)
	{
		alert('Please select an edition');
		return false;
	}
	
	if(so.selectedIndex < 1)
	{
		alert('Please select a state');
		return false;
	}
	
	location.href= "/math/" + eo[eo.selectedIndex].value + "/" + so[so.selectedIndex].value + '/';
	return false;
}

