function qtyset()
{
	document.form1.qty1.value=document.form1.qty.value
	document.form1.qty2.value=document.form1.qty.value
	document.form1.qty3.value=document.form1.qty.value
	document.form1.qty4.value=document.form1.qty.value
}

function Generate_String(theElement,price)
	{

	document.getElementById("button11").style.display='';
	document.getElementById("checoutimg").style.display='';
	document.getElementById("tick1").style.display='';
	document.getElementById("tick2").style.display='';
	document.getElementById("tick3").style.display='';
	document.getElementById("addall").style.display='';

		document.getElementById("product1").value="";
		document.getElementById("product2").value="";
		document.getElementById("product3").value="";
		document.getElementById("product4").value="";
		var fostock="0.00"
		var fodacron="0.00"
		var foFulldacron="0.00"
		var ttlamt="0.00"
		var theForm = theElement.form;
		var cart_string="";
	    var dimension="";
		var WrapTick=""
		 
		for(z=0; z<theForm.length;z++)
		{
		
			if (theForm[z].type=="text" ||  theForm[z].type=="select-one" || theForm[z].type=="select-multiple" || theForm[z].type=="radio" || theForm[z].type=="checkbox")
			{

 				if (theForm[z].value!="" && theForm[z].name!="product1" && theForm[z].name!="qty" && theForm[z].name!="qty1" && theForm[z].name!="subtotal" && theForm[z].name!="foamt" &&theForm[z].name!="stock" && theForm[z].name!="dactot")
				{
					if (cart_string!="")
					{
						var sep=" : ";
					}
					else
					{
						var sep="  ";
					}
					//if(theForm[z].checked==true && theForm[z].type=="radio")
					if(theForm[z].checked==true && theForm[z].type=="radio")
						{
							//alert(document.getElementById(theForm[z].name).innerHTML+":::"+theForm[z].value)*************;
							dimension=document.getElementById(theForm[z].name).innerHTML+" "+theForm[z].value;
						}					
						if(theForm[z].type!="radio" && theForm[z].type!="checkbox"  && document.getElementById(theForm[z].name).innerHTML!="")
						{
							if (document.getElementById(theForm[z].name).innerHTML=="Shape" || document.getElementById(theForm[z].name).innerHTML=="Foam")
							{
								var selIndex = theForm[z].selectedIndex;	
								cart_string=cart_string+sep+document.getElementById(theForm[z].name).innerHTML+"="+theForm[z].options[selIndex].text;	
							}
							else
							{
							cart_string=cart_string+sep+document.getElementById(theForm[z].name).innerHTML+"="+theForm[z].value;	
							}
						}
						
				}
			}
		}
		
		try
		{	
			
			if(document.form1.checkbox.checked==true)
			{
				var tickinfo=" : Add Allowance :  yes ";
			
				subtotal8Amt= document.getElementById("subtotal8").value;
				foamt7Amt=document.getElementById("foamt7").value;
				dactot6Amt=document.getElementById("dactot6").value;

				subtotacalcAmt= document.getElementById("stotalallowanceamount").value;
				foamt7calcAmt=document.getElementById("foamt7allowanceamount").value;
				dactot6calcAmt=document.getElementById("dactot6allowanceamount").value;

				document.getElementById("subtotal8").value=(parseFloat(subtotal8Amt) + parseFloat(subtotacalcAmt)).toFixed(2);
				document.getElementById("foamt7").value=(parseFloat(foamt7Amt) + parseFloat(foamt7calcAmt)).toFixed(2);
				document.getElementById("dactot6").value=(parseFloat(dactot6Amt) + parseFloat(dactot6calcAmt)).toFixed(2);
			//	alert(subtotal8Amt + "::" + foamt7Amt + "::" + dactot6Amt)				
			}
			else
			{
				var tickinfo="";
			}
			document.getElementById("product1").value=dimension+cart_string+" : No Wrapping"+tickinfo;
			document.getElementById("product2").value=dimension+cart_string;
			document.getElementById("product3").value=dimension+cart_string;
			document.getElementById("product4").value=dimension+cart_string;			
			
			//alert(document.form1.foamt.value);
			fostock=document.form1.foamt.value;
			document.form1.price2.value=document.form1.foamt.value;
			document.getElementById("foamtorg").value=document.form1.foamt.value;
			document.getElementById("product2").value=document.getElementById("product2").value+" : "+document.getElementById("qty2").innerHTML+tickinfo;
			
			fodacron=document.form1.stock.value;
			document.form1.price3.value=document.form1.stock.value;
			document.getElementById("product3").value=document.getElementById("product3").value+" : "+document.getElementById("qty3").innerHTML+tickinfo;
			
			foFulldacron=document.form1.dactot.value;
			document.form1.price4.value=document.form1.dactot.value;
			document.getElementById("dactotorg").value=document.form1.dactot.value;
			document.getElementById("product4").value=document.getElementById("product4").value+" : "+document.getElementById("qty4").innerHTML+tickinfo;

			//document.form1.subtotal.value=formatNumber(parseFloat(document.form1.subtotal.value)+parseFloat(fostock)+parseFloat(fodacron)+parseFloat(foFulldacron),'0.00',false);
			document.form1.price1.value=document.form1.subtotal.value;
			document.getElementById("subtotalorg").value=document.form1.subtotal.value;



		}
		catch(e){}
	} 
	
	
	
var separator = ",";  // use comma as 000's separator
  var decpoint = ".";  // use period as decimal point
  var percent = "%";
  var currency = "$";  // use dollar sign for currency

 function formatNumber(number, format, print) {  // use: formatNumber(number, "format")
    if (print) document.write("formatNumber(" + number + ", \"" + format + "\")<br>");

    if (number - 0 != number) return null;  // if number is NaN return null
    var useSeparator = format.indexOf(separator) != -1;  // use separators in number
    var usePercent = format.indexOf(percent) != -1;  // convert output to percentage
    var useCurrency = format.indexOf(currency) != -1;  // use currency format
    var isNegative = (number < 0);
    number = Math.abs (number);
    if (usePercent) number *= 100;
    format = strip(format, separator + percent + currency);  // remove key characters
    number = "" + number;  // convert number input to string

     // split input value into LHS and RHS using decpoint as divider
    var dec = number.indexOf(decpoint) != -1;
    var nleftEnd = (dec) ? number.substring(0, number.indexOf(".")) : number;
    var nrightEnd = (dec) ? number.substring(number.indexOf(".") + 1) : "";

     // split format string into LHS and RHS using decpoint as divider
    dec = format.indexOf(decpoint) != -1;
    var sleftEnd = (dec) ? format.substring(0, format.indexOf(".")) : format;
    var srightEnd = (dec) ? format.substring(format.indexOf(".") + 1) : "";

     // adjust decimal places by cropping or adding zeros to LHS of number
    if (srightEnd.length < nrightEnd.length) {
      var nextChar = nrightEnd.charAt(srightEnd.length) - 0;
      nrightEnd = nrightEnd.substring(0, srightEnd.length);
      if (nextChar >= 5) nrightEnd = "" + ((nrightEnd - 0) + 1);  // round up

 // patch provided by Patti Marcoux 1999/08/06
      while (srightEnd.length > nrightEnd.length) {
        nrightEnd = "0" + nrightEnd;
      }

      if (srightEnd.length < nrightEnd.length) {
        nrightEnd = nrightEnd.substring(1);
        nleftEnd = (nleftEnd - 0) + 1;
      }
    } else {
      for (var i=nrightEnd.length; srightEnd.length > nrightEnd.length; i++) {
        if (srightEnd.charAt(i) == "0") nrightEnd += "0";  // append zero to RHS of number
        else break;
      }
    }

     // adjust leading zeros
    sleftEnd = strip(sleftEnd, "#");  // remove hashes from LHS of format
    while (sleftEnd.length > nleftEnd.length) {
      nleftEnd = "0" + nleftEnd;  // prepend zero to LHS of number
    }

    if (useSeparator) nleftEnd = separate(nleftEnd, separator);  // add separator
    var output = nleftEnd + ((nrightEnd != "") ? "." + nrightEnd : "");  // combine parts
    output = ((useCurrency) ? currency : "") + output + ((usePercent) ? percent : "");
    if (isNegative) {
      // patch suggested by Tom Denn 25/4/2001
      output = (useCurrency) ? "(" + output + ")" : "-" + output;
    }
    return output;
  }

  function strip(input, chars) {  // strip all characters in 'chars' from input
    var output = "";  // initialise output string
    for (var i=0; i < input.length; i++)
      if (chars.indexOf(input.charAt(i)) == -1)
        output += input.charAt(i);
    return output;
  }

  function separate(input, separator) {  // format input using 'separator' to mark 000's
    input = "" + input;
    var output = "";  // initialise output string
    for (var i=0; i < input.length; i++) {
      if (i != 0 && (input.length - i) % 3 == 0) output += separator;
      output += input.charAt(i);
    }
    return output;
  }	

function TickInfo(stotal,foamt7,dactot6)
{

	
	if(document.form1.checkbox.checked==true)
	{		
		


		stotal=document.form1.price1.value;
		foamt7=document.form1.price2.value;
		dactot6=document.form1.price4.value;
		
		if (stotal!="")
		{
			stotalallowamount=(parseFloat(stotal) * 7)/100;
			stotal = parseFloat(stotal) +  parseFloat(stotalallowamount);
		}
		else
		{
			stotal=0.00
		}
		if (foamt7!="")
		{
			foamt7allowamount=(parseFloat(foamt7) * 7)/100;
			foamt7 = parseFloat(foamt7) + parseFloat(foamt7allowamount);
		}
		else
		{
			foamt7=0.00
		}
		if (dactot6!="")
		{
			dactot6allowamount=(parseFloat(dactot6) * 7)/100;
			dactot6 = parseFloat(dactot6) + parseFloat(dactot6allowamount);
		}
		else
		{
			dactot6=0.00
		}

		//alert(stotalallowamount + "::" + foamt7allowamount+ "::" + dactot6allowamount)

		
		
		


		document.getElementById("subtotal8").value=stotal.toFixed(2);
		document.getElementById("foamt7").value=foamt7.toFixed(2);
		document.getElementById("dactot6").value=dactot6.toFixed(2);

		document.form1.price1.value=stotal.toFixed(2);
		document.form1.price2.value=foamt7.toFixed(2);
		document.form1.price4.value=dactot6.toFixed(2);

		document.form1.stotalallowanceamount.value=stotalallowamount;
		document.form1.foamt7allowanceamount.value=foamt7allowamount;
		document.form1.dactot6allowanceamount.value=dactot6allowamount;



		document.form1.chkyes.value=" : Allowance"	
		document.getElementById("product1").value=document.getElementById("product1").value+document.form1.chkyes.value;
		document.getElementById("product2").value=document.getElementById("product2").value+document.form1.chkyes.value;
		document.getElementById("product3").value=document.getElementById("product3").value+document.form1.chkyes.value;
		document.getElementById("product4").value=document.getElementById("product4").value+document.form1.chkyes.value;
	}
	else
	{

		document.getElementById("subtotal8").value=document.getElementById("subtotalorg").value;
		document.getElementById("foamt7").value=document.getElementById("foamtorg").value;
		document.getElementById("dactot6").value=document.getElementById("dactotorg").value;
		document.form1.price1.value=document.getElementById("subtotalorg").value;
		document.form1.price2.value=document.getElementById("foamtorg").value;
		document.form1.price4.value=document.getElementById("dactotorg").value;

		document.form1.stotalallowanceamount.value=0;
		document.form1.foamt7allowanceamount.value=0;
		document.form1.dactot6allowanceamount.value=0;

		document.form1.chkyes.value	=" ";
		document.getElementById("product1").value=document.getElementById("product1").value.replace(' : Add Allowance :  yes ','');
		document.getElementById("product2").value=document.getElementById("product2").value.replace(' : Add Allowance :  yes ','');
		document.getElementById("product3").value=document.getElementById("product3").value.replace(' : Add Allowance :  yes ','');
		document.getElementById("product4").value=document.getElementById("product4").value.replace(' : Add Allowance :  yes ','');
	}	
	
	
}

