var d;
var base;

var qb1=0 ;
var qb2=0 ;
var qb3=0 ;

var priceB1 = 0;
var priceB2 = 0;
var priceB3 = 0;

var total1 = 0;
var total2 = 0;
var total3 = 0;
var Total;


function doCalc(theItem){

	//switchDescription(theItem);

	d = document.theForm;

	qbottle1=0;
	qbottle2=0;
	qbottle3=0;
	
	Bottles =0;
	
	runningTotal = 0;
	PriceBottle1 = 0;
	PriceBottle2 = 0;
	PriceBottle3 = 0;

	PriceTotal1 = 0;
	PriceTotal2 = 0;
	PriceTotal3 = 0;
	
	Total=0;
	
	qbottle1 = parseInt(eval(d.qb1.value))
    qbottle2 = parseInt(eval(d.qb2.value))
	qbottle3 = parseInt(eval(d.qb3.value))

//   Calculation Total number of bottles 
	 Bottles += qbottle1;
	 Bottles += qbottle2;
	 Bottles += qbottle3;

	 if (Bottles<12)
	 {	var bottle1 = 18.00;
		var bottle2 = 11.00;
		var bottle3 = 11.00;
	 } 
	 else 
	 {	var bottle1 = 16.00;
		var bottle2 = 10.00;
		var bottle3 = 10.00;
	 } 
	d.Bottles.value= Bottles
	//Calculation for bottle 1 
	PriceBottle1 += bottle1 * qbottle1; 
	d.priceB1.value ="$"+ PriceBottle1;	 
	//alert(Bottles);
	//alert(bottle1);
	//alert(d.priceB1.value);
	
	//Calculation for bottle 2 
	PriceBottle2 += bottle2 * qbottle2;  
	d.priceB2.value ="$"+ PriceBottle2;


	//Calculation for bottle 3 
	PriceBottle3 += bottle3 * qbottle3; 
	d.priceB3.value ="$"+ PriceBottle3;

//alert(Bottles);

	 Total += PriceBottle1 ;
	 Total += PriceBottle2 ;
	 Total += PriceBottle3 ;

	  if ((Bottles)>11)
	 { //alert(Bottles);
	  //alert(Total);
	 Total = Math.floor((Total*0.90)*100) ;
	 Total = Total/100 ;
	 }

	d.total1.value=  Total; 
	}
/////////////////////////////////////////////////////////////////////////////////////////////
function doCalc2(theItem){

	//switchDescription(theItem);

	d = document.theForm;

	qbottle1=0;
	qbottle2=0;
	qbottle3=0;
	
	Bottles =0;
	
	runningTotal = 0;
	PriceBottle1 = 0;
	PriceBottle2 = 0;
	PriceBottle3 = 0;

	PriceTotal1 = 0;
	PriceTotal2 = 0;
	PriceTotal3 = 0;
	
	Total=0;
	
	qbottle1 = parseInt(eval(d.qb1.value))
    qbottle2 = parseInt(eval(d.qb2.value))
	qbottle3 = parseInt(eval(d.qb3.value))

//   Calculation Total number of bottles 
	 Bottles += qbottle1;
	 Bottles += qbottle2;
	 Bottles += qbottle3;
	//alert(Bottles);
	 if (Bottles==1 || Bottles==3 || Bottles==5 || Bottles==7 || Bottles==9 || Bottles==11)
	{ alert ("TOTAL BOTTLES MUST EQUAL 2,4,6,8, 10,12, OR more")
	  d.qb1.focus();
	 }

	 if (Bottles<12)
	 {	var bottle1 = 18.00;
		var bottle2 = 11.00;
		var bottle3 = 11.00;
	 } 
	 else 
	 {	var bottle1 = 16.00;
		var bottle2 = 10.00;
		var bottle3 = 10.00;
	 } 
	d.Bottles.value= Bottles
	//Calculation for bottle 1 
	PriceBottle1 += bottle1 * qbottle1; 
	d.priceB1.value ="$"+ PriceBottle1;	 
	//alert(Bottles);
	//alert(bottle1);
	//alert(d.priceB1.value);
	
	//Calculation for bottle 2 
	PriceBottle2 += bottle2 * qbottle2;  
	d.priceB2.value ="$"+ PriceBottle2;


	//Calculation for bottle 3 
	PriceBottle3 += bottle3 * qbottle3; 
	d.priceB3.value ="$"+ PriceBottle3;

//alert(Bottles);

	 Total += PriceBottle1 ;
	 Total += PriceBottle2 ;
	 Total += PriceBottle3 ;

	  if ((Bottles)>11)
	 { //alert(Bottles);
	  //alert(Total);
	 Total = Math.floor((Total*0.90)*100) ;
	 Total = Total/100 ;
	 }

	d.total1.value=  Total; 
	}
/////////////////////////////////////////////////////////////////////////////////////////////
function init(){
	d = document.theForm;
	
}

function switchDescription(selectedItem){
	// first set all to hidden
	descs = new Array('qb1Div','qb2Div','qb3Div','qb4Div','qb5Div','qb6Div','qb7Div');
	for(x=0; x < 7; x++){
		if(document.getElementById){
			document.all[descs[x]].style.visibility = "hidden";
		}
		else{
			str = "document.layers.";
			str += descs[x];
			str += ".visibility = 'hidden'";
			eval(str);
		}
	}
	if(document.getElementById){
		document.all[selectedItem].style.visibility = "visible";
	}
	else{
		str = "document.layers.";
		str += selectedItem;
		str += ".visibility = 'visible'";
		eval(str);
	}
}
