function SetVal (Field,Text,Value) 
{
	Field.text=Text;
	Field.value=Value;
}

function VerifyInput()
{
	var mode=document.storewidesearch.mode.options;
	var i=mode.selectedIndex;
	if (mode[i].value == "invalid")
	{
		mode.selectedIndex = 4 
	}
}

function ResetMenu(typeindex,modeindex) 
{
	var type=document.storewidesearch.type.options;
	var mode=document.storewidesearch.mode.options;
	var i=type.selectedIndex;
	var x=mode.selectedIndex;
	
	if(type[i].value == "author" || type[i].value == "00author") 
	{
		mode.length = 1;
		SetVal(mode[0],"Books","00books")
	}

	if(type[i].value == "artist" || type[i].value == "01artist") 
	{
		mode.length = 2;
		SetVal(mode[0],"Popular music","00music")
		SetVal(mode[1],"Classical music","01classical")
	}

	if(type[i].value == "actor" || type[i].value == "director" || type[i].value == "02actor" || type[i].value == "03director") 
	{
		mode.length = 2;
		SetVal(mode[0],"DVD","00dvd")
		SetVal(mode[1],"VHS","01vhs")
	}

	if(type[i].value == "keyword" || type[i].value == "manufacturer" || type[i].value == "04keyword" || type[i].value == "05manufacturer") 
	{
		mode.length = 17;
		SetVal(mode[0],"Books","00books")
		SetVal(mode[1],"DVD","01dvd")
		SetVal(mode[2],"Video","02vhs")		
		SetVal(mode[3],"Popular Music","03music")		
		SetVal(mode[4],"Classical Music","04classical")
		SetVal(mode[5],"--------------","invalid")	
		SetVal(mode[6],"Baby","06baby")
		SetVal(mode[7],"Camera & Photo","07photo")
		SetVal(mode[8],"Computers","08pc-hardware")
		SetVal(mode[9],"Computer & Video Games","09videogames")
		SetVal(mode[10],"Electronics","10electronics")
		SetVal(mode[11],"Kitchen & Housewares","11kitchen")
		SetVal(mode[12],"Magazines","12magazines")
		SetVal(mode[13],"Outdoor Living","13garden")
		SetVal(mode[14],"Software","14software")
		SetVal(mode[15],"Tools & Hardware","15universal")
		SetVal(mode[16],"Toys & Games","16toys")
	}

	if (typeindex)
	{
		type.selectedIndex = typeindex ;
		ResetMenu("",modeindex);
	}
	
	if (modeindex)
	{
		mode.selectedIndex = modeindex ;
	}
}