//import java.util.*;   
var vlSaves = 0;
var xxx;
xxx = "bob";
function calc_price()
{
 var price_value = 0;
 var qty = 0;
 var saves = false;
  
  var washfold18lbs_price = 24.95;
  var WashFold25lbs_price = 33.95;
  var lsuit_price = 11.55;
  var lblouse_price = 5.95;
  var lskirt_price = 5.95;
  var lpants_price = 6.45;  
  var ldress_price = 13.75;
  var levening_price = 22.75;
  var lsweaters_price = 6.50;
  var lblazers_price = 6.95;
  var loj_price = 12.50;
  var lwinter_price = 16.95;
  var lscarfs_price = 5.95;
  var lshawls_price = 5.95;
  var msuit_price = 11.55;
  var m3suit_price = 17.60;
  var mshirts_price = 2.85;  
  var mdcshirts_price = 4.95;
  var mpants_price = 6.95;
  var mvests_price = 5.95;
  var msweaters_price = 6.50;
  var mblazers_price = 6.95;
  var mjackets_price = 16.95;
  var mwinter_price = 16.95;
  var mties_price = 4.95;
  var mscarfs_price = 5.95;
  var hdrapes_price = 18.50;
  var hblanket_price = 27.50;
  var hquilt_price = 38.50;
  var hbedSheet_price = 13.75;
  var hpillowCase_price = 4.40;
  var hduvetCover_price = 18.70;
  
  //Laundry Folding 18lbs
 //if (document.getElementById("WashFold18lbs").checked)
  //{
//	  price_value = price_value + washfold18lbs_price;
//	  qty = qty + 1;
//	 }
  
    //Laundry Folding 25lbs
 //if (document.getElementById("WashFold25lbs").checked)
  //{
//	  price_value = price_value + WashFold25lbs_price;
//	  qty = qty + 1;
//	 }
 
//*************NOT NEEDED ANY MORE BECAUSE WASH AND FOLD FIELDS TAKEN OUT******************** 
//  	   price_value = price_value + washfold18lbs_price * parseFloat(document.getElementById("WashFold18lbs").value);
//	   qty = qty + parseFloat(document.getElementById("WashFold18lbs").value);
	   
//	   price_value = price_value + WashFold25lbs_price * parseFloat(document.getElementById("WashFold25lbs").value);
//	   qty = qty + parseFloat(document.getElementById("WashFold25lbs").value);

  
  //***********************Ladies************************
	  //Suits
	   price_value = price_value + lsuit_price * parseFloat(document.getElementById("2pcstQtyW").value);
	   qty = qty + parseFloat(document.getElementById("2pcstQtyW").value);
	   
	   //Blouses
	   price_value = price_value + lblouse_price * parseFloat(document.getElementById("BlouseQtyW").value);
	   qty = qty + parseFloat(document.getElementById("BlouseQtyW").value);	   
	   
	   //Skirts
	   price_value = price_value + lskirt_price * parseFloat(document.getElementById("SkirtQtyW").value);	   
	   qty = qty + parseFloat(document.getElementById("SkirtQtyW").value);	   
	   
	   //Pants
	   price_value = price_value + lpants_price * parseFloat(document.getElementById("PantsQtyW").value);	   	   
	   qty = qty + parseFloat(document.getElementById("PantsQtyW").value);	   	   
	   
	   //Dresses
	   price_value = price_value + ldress_price * parseFloat(document.getElementById("DressQtyW").value);	   	   	   
	   qty = qty + parseFloat(document.getElementById("DressQtyW").value);	   	   
	   
	   //Evening Dresses
	   price_value = price_value + levening_price * parseFloat(document.getElementById("EvGwnQtyW").value);	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("EvGwnQtyW").value);	   	   
	   	   
	   //Sweaters
	   price_value = price_value + lsweaters_price * parseFloat(document.getElementById("SweaterQtyW").value);	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("SweaterQtyW").value);	   	   
	   	   
	   //Blazers
	   price_value = price_value + lblazers_price * parseFloat(document.getElementById("BlazerQtyW").value);	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("BlazerQtyW").value);	   	   
	   	   
	   //Outer Jackets
	   price_value = price_value + loj_price * parseFloat(document.getElementById("OutJcktQtyW").value);	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("OutJcktQtyW").value);	   	   
	   
	   //Winter Coats
	   price_value = price_value + lwinter_price * parseFloat(document.getElementById("WntrCoatQtyW").value);	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("WntrCoatQtyW").value);	   	   
	   	   
   	   //Scarfs
	   price_value = price_value + lscarfs_price * parseFloat(document.getElementById("ScarfQtyW").value);	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("ScarfQtyW").value);	   	   
	   	   
   	   //Shawls
	   price_value = price_value + lshawls_price * parseFloat(document.getElementById("shawlQty").value);	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("shawlQty").value);	   	   
	   
   	   //Other Womens
	   price_value = price_value + parseFloat(document.getElementById("otherPriceW").value) * parseFloat(document.getElementById("lotherQty").value);	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("lotherQty").value);	   	   
	   	   
  //***********************Mens************************
	  //2pc Suits
	   price_value = price_value + msuit_price * parseFloat(document.getElementById("2pcstQtyM").value);
	   qty = qty + parseFloat(document.getElementById("2pcstQtyM").value);	   	   
	   
	  //3pc Suits
	   price_value = price_value + m3suit_price * parseFloat(document.getElementById("3pcstQtyM").value);	   
	   qty = qty + parseFloat(document.getElementById("3pcstQtyM").value);	   	   
	   	   
	  //Shirts
	   price_value = price_value + mshirts_price * parseFloat(document.getElementById("lShirttQtyM").value);	   	   
	   qty = qty + parseFloat(document.getElementById("lShirttQtyM").value);	   	   
	   	   
	  //Dryclean Shirts
	   price_value = price_value + mdcshirts_price * parseFloat(document.getElementById("dShirtQtyM").value);	   	   	   
	   qty = qty + parseFloat(document.getElementById("dShirtQtyM").value);	   	   
	   
	  //Pants
	   price_value = price_value + mpants_price * parseFloat(document.getElementById("PantsQtyM").value);	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("PantsQtyM").value);	   	   
	   	   
	  //Vests
	   price_value = price_value + mvests_price * parseFloat(document.getElementById("BlazerQtyM").value);	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("BlazerQtyM").value);	   	   
	   
	  //Sweaters
	   price_value = price_value + msweaters_price * parseFloat(document.getElementById("2pcstQtyW17").value);	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("2pcstQtyW17").value);	   	   
	   	   
	  //Sweaters
	   price_value = price_value + mblazers_price * parseFloat(document.getElementById("mblazerQty").value);	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("mblazerQty").value);	   	   
	   	   
	  //Jackets
	   price_value = price_value + mjackets_price * parseFloat(document.getElementById("mjacketQty").value);	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("mjacketQty").value);	   	   
	   	   
	  //Winter Coats
	   price_value = price_value + mwinter_price * parseFloat(document.getElementById("mwntctQty").value);	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("mwntctQty").value);	   	   

	  //Ties
	   price_value = price_value + mties_price * parseFloat(document.getElementById("mtieQty").value);	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("mtieQty").value);	   	   
	   
	  //Scarfs
	   price_value = price_value + mscarfs_price * parseFloat(document.getElementById("mscarfQty").value);	   	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("mscarfQty").value);	   	   
	   	   
   	   //Other Mens
	   price_value = price_value + parseFloat(document.getElementById("otherW22").value) * parseFloat(document.getElementById("motherQty").value);	   	   	   	   	   	   	   	   	   	   
	   qty = qty + parseFloat(document.getElementById("motherQty").value);	   	   

  //Drapes
 if (document.getElementById("hdrapes").checked)
  {
	  price_value = price_value + hdrapes_price;	  
	  qty = qty + 1;	  
	 }
	 
  //Blankets
 if (document.getElementById("hblanket").checked)
  {
	  price_value = price_value + hblanket_price;
	  qty = qty + 1;	  
	 }	 
	 
  //Comforters Quilts
 if (document.getElementById("hquilt").checked)
  {
	  price_value = price_value + hquilt_price;
	  qty = qty + 1;	  
	 }
	 
  //Bed Sheets
 if (document.getElementById("hbedSheet").checked)
  {
	  price_value = price_value + hbedSheet_price;
	  qty = qty + 1;	  
	 }	
	 
  //Pillowcases
 if (document.getElementById("hpillowCase").checked)
  {
	  price_value = price_value + hpillowCase_price;
	  qty = qty + 1;	  
	 }		 
	 
  //Duvet Covers
 if (document.getElementById("hduvetCover").checked)
  {
	  price_value = price_value + hduvetCover_price;
	  qty = qty + 1;	  
	 }	  	 	 	 
	   


price_value = Math.round(price_value*100)/100;

  document.getElementById("total").value = qty;
  document.getElementById("SubTotal").value = "$"+price_value;
  calcShip();
}
function calc_deliverydate()
	{
	var PickupDate=document.getElementById("pickupDate").value;
	var x =new Date(PickupDate);
	x.setDate(x.getDate() + 2);
	var delDate;
	var lMonth=x.getMonth()+1;
	var lDay =x.getDate();
	var lYear=x.getFullYear();
	delDate=lMonth+"/" + lDay+"/" + lYear;
//	var expiration="12/25/2008";
//	var expiration=parseFloat(document.getElementById("pickupdate").value);
	// Get a Calendar for current locale and time zone
//	Calendar cal = Calendar.getInstance();  
	// Get a Date object that represents 30 days from now
//	Date today = document.getElementById("pickupDate").value;                   // Current date
//	cal.setTime(today);                        // Set it in the Calendar object
//	cal.add(Calendar.DATE, 2);                // Add 30 days
//	Date expiration = cal.getTime();           // Retrieve the resulting date
	//alert ("this date is");
  document.getElementById("deliveryDate").value = delDate;
	calcDeliveryOption();
	}
function calcShip()
{
var num=document.form1.SubTotal.value;
num = num.toString().replace(/\$|\,/g,'');
 if (document.form1.delivery[0].checked){
 	document.form1.shipPrice.value="$0.00";
	
	
	document.form1.price.value =num2money(parseFloat(num))
		
 }
 if (document.form1.delivery[1].checked){
 	document.form1.shipPrice.value="$10.00";
	document.form1.price.value =num2money(parseFloat(num) +10);	
 }
 
 if (document.form1.delivery[2].checked){
 	document.form1.shipPrice.value="$25.00";
	document.form1.price.value =num2money(parseFloat(num)+25);	
 }

}

function num2money(num) {

  num = num.toString().replace(/\$|\,/g,'');
  if(isNaN(num))
  num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10)
  cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
  num = num.substring(0,num.length-(4*i+3))+','+
  num.substring(num.length-(4*i+3));
  return (((sign)?'':'-') + "$" + num + '.' + cents);

}

function calcDeliveryOption() {
	var PickupDate=new Date(document.getElementById("pickupDate").value);
	var DeliveryDate=new Date(document.getElementById("deliveryDate").value);
	var valDiff=DeliveryDate.getDate()- PickupDate.getDate()
	
	
	if (valDiff<2) {
		document.form1.delivery[1].checked=true;
		document.form1.hdelivery.value=document.form1.delivery[1].value;
	}
	
	if (valDiff<1) {
		document.form1.delivery[2].checked=true;
		document.form1.hdelivery.value=document.form1.delivery[2].value;
	}
	
	if (valDiff>=2) {
		document.form1.delivery[0].checked=true;
		document.form1.hdelivery.value=document.form1.delivery[0].value;
	}
	
	calcShip();
}