// JavaScript Document

var  onProd =1;
function ToggleCol(id){
	obj = document.getElementById('tdHead_'+id);
	if(id!=onProd){
		if(obj.className=='menuOn')
			obj.className='menuOff';
		else
			obj.className='menuOn';
	}
}
function ToggleRowDisplayOne(id)
{
     try
     {
       for(i=1;i<=6;i++){
	   		document.getElementById('tdBody_'+i).style.display = "none";
			document.getElementById('tdHead_'+i).className = "menuOff";
	   }
	   
		document.getElementById('tdBody_'+id).style.display = "block";
		document.getElementById('tdHead_'+id).className = "menuOn";			
		onProd = id;
		if(id==6 || id==1)
			document.getElementById('td_price').style.display = "block";
		else
			document.getElementById('td_price').style.display = "none";
		
				return false;

	 }
     catch( expError )
     {
          alert( expError.number + "   " + expError.description );
     }
}

function calculate(){
	frm = window.document.frmCalc;
	tmp = frm.height1.options[frm.height1.selectedIndex].value;
	height2 = frm.height2.options[frm.height2.selectedIndex].value;
	width2 = frm.width2.options[frm.width2.selectedIndex].value;
	
	tmp = parseFloat(tmp) + parseFloat(eval(height2)); 

	for (var i=0; i<hlist.length; i++){
		if(tmp <= hlist[i] )	{
			height1 = hlist[i];
			//if(height2!=0 && i!=(hlist.length-1))
				//height1 = hlist[(i+1)];
			break;
		}
			
	}
	tmp = frm.width1.options[frm.width1.selectedIndex].value;
	tmp = parseFloat(tmp) + parseFloat(eval(width2));
	for (var i=0; i<wlist.length; i++){
		if(tmp <= wlist[i] )	{
			width1  = wlist[i];
			//if(width2!=0 && i!=(wlist.length-1))
				//width1 = wlist[(i+1)];
			break;
		}
			
	}
	pvalue = price[height1][width1];
	
	ans =  pvalue*val;
	if(salePrice!=0){
		sale_ans = ans * ((100-salePrice)/100);
		sale_ans += pcharge;
		sale_ans = sale_ans.toFixed(2);
		document.getElementById("answer1").innerHTML= "<strong>Sales Price: $" + sale_ans + "</strong>";	
		ans += pcharge;
		ans = ans.toFixed(2);
		document.getElementById("answer").innerHTML= "<strong>Price: $" + ans + "</strong>";
	}else{ 
	    ans += pcharge;
		ans = ans.toFixed(2);
		document.getElementById("answer2").innerHTML= "<strong>Price: $" + ans + "</strong>";
	}
}

