var products = new Array();

products[0] = new Array(
	'*Select a product*',
	'index.jsp',
	'All products in this category',
	'products_light.jsp',
	'Ultra Thin Regular',
	'products_light.jsp#UltraThinRegular',
	'Ultra Thin Regular with Wings',
	'products_light.jsp#UltraThinRegularWings');


products[1] = new Array(
	'*Select a product*',
	'index.jsp',
	'All products in this category',
	'products_moderate.jsp',
	'Ultra Thin Long',
	'products_moderate.jsp#UltraThinLong',
	'Ultra Thin Long with Wings',
	'products_moderate.jsp#UltraThinLongWings',
	'Dry Max Ultra Thin Regular with Wings',
	'products_moderate.jsp#UltraThinRegularWings',
	'Maxi',
	'products_moderate.jsp#Maxi',
	'Deodorant Maxi',
	'products_moderate.jsp#DeodorantMaxi',
	'Dry Max Maxi Regular with Wings', 
	'products_moderate.jsp#DryMaxMaxiRegularWings',
	'Super Maxi',
	'products_moderate.jsp#SuperMaxi');

	
products[2] = new Array(
	'*Select a product*',
	'index.jsp',
	'All products in this category',
	'products_heavy.jsp',
	'Dry Max Ultra Thin Overnight with Wings',
	'products_heavy.jsp#DryMaxUltraThinOvernightWings',
	'Long Super Maxi with Wings',
	'products_heavy.jsp#LongSuperMaxiWings',
	'Overnight Maxi with Wings',
	'products_heavy.jsp#OvernightMaxiWings');



products[3] = new Array(
	'*Select a product*',
	'index.jsp',
	'All products in this category',
	'products_overnight.jsp',
	'Overnight Maxi With Wings',
	'products_overnight.jsp#OvernightMaxiWithWings',
	'Overnight Maxi Maximum Protection',
	'products_overnight.jsp#OvernightMaxiMaximumProtection',
	'Overnight Ultra Thin With Wings',
	'products_overnight.jsp#OvernightUltraThinWithWings');
	
function init()
{
	optionTest = true;
	lgth = document.forms[0].productChoosen.options.length - 1;
	document.forms[0].productChoosen.options[lgth] = null;
	if (document.forms[0].productChoosen.options[lgth]) optionTest = false;
}

function setProductList(frm) {
  
 // if (!optionTest) return;
	var box = frm.catChoosen;
	var number = box.options[box.selectedIndex].value;
	var box2 = frm.productChoosen;
	if (!number) return;
	if(number == 0)
	{
		box2.options.length = 0;
		box2.options[0] = new Option("Select a Category","-1");
	}
	else
	{
		var list = products[number-1];
		box2.options.length = 0;
		for(i=0;i<list.length;i+=2)
		{
			box2.options[i/2] = new Option(list[i],list[i+1]);
		}
		box2.disabled = false;
	}
}


function goToPage(){

	var boxProd = document.productFinderForm.productChoosen;
	var numberProd = boxProd.value;

	if(numberProd!="null"){
		/* esta condição indica que o primeiro item do 
	    * ProductFinder não foi selecionado
	   	*/
		if(numberProd==0 || numberProd==-1) {
			alert("Please select a type of product.");
	  	}else{
	   		/* esta condição indica que o primeiro item do 
	    	* ProductFinder foi selecionado mas o segundo não foi
	   		*/
	   		if(numberProd=="index.jsp") {
	    		alert('Please select a product.');
			}else{
				document.productFinderForm.action = numberProd;
				document.productFinderForm.submit();
			} 	 	  
		}
	}
}



function isValidProductPage(frm)
{

	try{
		var boxProd = document.forms[0].productChoosen;
		var numberProd = boxProd.options[boxProd.selectedIndex].value;
		if(numberProd!="null")
		{
			frm.prodSubmit.disabled = true;
			frm.submit();
		}
	}
	catch(Exception)
	{
	}
	alert("Plesase choose a product first");
	return false;
}
