function copybillingaddres()

{

document.getElementById("Name2").value=document.getElementById("Name").value;

document.getElementById("saAddress").value=document.getElementById("baAddress").value;

document.getElementById("saCity").value=document.getElementById("baCity").value;

document.getElementById("saState").value=document.getElementById("baState").value;

document.getElementById("saZipcode").value=document.getElementById("baZipcode").value;

document.getElementById("saCountry").value=document.getElementById("baCountry").value;

}

function cleartext(){

document.getElementById("Name2").value="";

document.getElementById("saAddress").value="";

document.getElementById("saCity").value="";

document.getElementById("saState").value="";

document.getElementById("saZipcode").value="";

document.getElementById("saCountry").value="";

	

}

//--------------------------------------------------------------------------------------------------------------------------------	

	



function AddEndRow() {


var getTable = document.getElementById('canvasrolls');
var countRow = getTable.rows.length; 
var iteration=countRow;



var myTR=document.createElement('tr');
var myTD=document.createElement('td');





var sel = document.createElement('select');


 sel.name = "crp["+iteration+"]";
 sel.id="crp["+iteration+"]";
 sel.options[0] = new Option('62" Wide Unprimed', '62" Wide Unprimed');
 sel.options[1] = new Option('62" Wide Primed', '62" Wide Primed');
 sel.options[2] = new Option('83" Wide Primed', '83" Wide Primed');



sel.onblur=function(){quantitychecking2(iteration)}; 
sel.onchange=function(){onchangetest2(iteration);onchangctype2(iteration);calsubtotalcr2()}; 
myTD.appendChild(sel);







//------------------------------------------

var myTD2=document.createElement('td');

 var cat = document.createElement('select');
 cat.name = "crt["+iteration+"]";
 cat.id="crt["+iteration+"]";

 cat.options[0] = new Option('7 OZ', '7 OZ');
 cat.options[1] = new Option('10 OZ', '10 OZ');



cat.onchange=function(){onchangctype2(iteration);};
cat.onfocus=function(){startCalc2(iteration);};
cat.onblur=function(){stopCalc2();quantitychecking2(iteration)};



myTD2.appendChild(cat);



//--------------------------------------



var myTD3=document.createElement('td');
var sell = document.createElement('select');

 sell.name = "crl["+iteration+"]";

 sell.id="crl["+iteration+"]";

 sell.options[0] = new Option('By The Yard', 'By The Yard');

 sell.options[1] = new Option('6 Yard Roll', '6 Yard Roll');

 sell.options[2] = new Option('25 Yard Roll', '25 Yard Roll');

 sell.options[3] = new Option('50 Yard Roll', '50 Yard Roll');

 sell.options[4] = new Option('100 Yard Roll', '100 Yard Roll');

sell.onchange=function(){onchangctype2(iteration);};



sell.onfocus=function(){startCalc2(iteration);};

sell.onblur=function(){stopCalc2();quantitychecking2(iteration)};

myTD3.appendChild(sell);





//----------------------------------



var myTD4=document.createElement('td');

//myTD4.appendChild(document.createTextNode('sample text here 2 ...'));

var acq = document.createElement('input');

 acq.type = 'text';  

 acq.name = "acq["+iteration+"]";

 acq.id="acq["+iteration+"]";

 acq.size = 13; 

 

 acq.onfocus=function(){startCalc2(iteration);onchangctype2(iteration);};

 acq.onblur=function(){stopCalc2();}; 
 acq.onKeyPress=function(){return isNumberKey(event)};
 

 

myTD4.appendChild(acq);  

//-----------------------------

var myTD5=document.createElement('td');

//myTD5.appendChild(document.createTextNode('sample text here 2 ...'));



var up = document.createElement('input');

 up.type = 'hidden'; 

 up.value='';

 up.size=13;

 up.name = "acupdisplay["+iteration+"]";

 up.id = "acupdisplay["+iteration+"]";

 

 

upd = document.createElement('div');

upd.innerHTML = "";

upd.name = "divupcr"+iteration;

upd.id = "divupcr"+iteration; 

 

 

 myTD5.appendChild(up);

 myTD5.appendChild(upd); 



//---------------------------





var myTD6=document.createElement('td');

//myTD5.appendChild(document.createTextNode('sample text here 2 ...'));



var st = document.createElement('input');

 st.type = 'hidden'; 

 st.value=''; 

 st.size=13;

 st.id = "acsubt["+iteration+"]"; 

 st.name = "acsubt["+iteration+"]"; 

 

 std = document.createElement('div');

std.innerHTML = "";

std.align="right";

std.name = "divstcr"+iteration;

std.id = "divstcr"+iteration; 

 



 myTD6.appendChild(st);

  myTD6.appendChild(std);

//---------------------------

myTR.appendChild(myTD);

myTR.appendChild(myTD2);

myTR.appendChild(myTD3);

myTR.appendChild(myTD4);

myTR.appendChild(myTD5);

myTR.appendChild(myTD6);

/*myTR.appendChild(myTD7);*/

document.getElementById('canvasrolls').appendChild(myTR);

}

//-----------------------------------------------------------------		

	

function removeRowFromTable()

{

  var tbl = document.getElementById('canvasrolls');

  var lastRow = tbl.rows.length;

  if (lastRow > 2) tbl.deleteRow(lastRow - 1);

}





//------------------------------------------------------------------

	

function onchangcprimed(prm){		

		

var prim=prm;

var op1='62" Wide Unprimed';

var op2='62" Wide Primed';

var op3='83" Wide Primed';



var lb=document.getElementById("crt[]");

if(prim == op1){

	

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }

	

document.getElementById("crt[]").options[0]=new Option('7 OZ', '7 OZ');

document.getElementById("crt[]").options[1]=new Option('10 OZ', '10 OZ');

				}

else if(prim == op2){

	

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }

document.getElementById("crt[]").options[0]=new Option('7 OZ', '7 OZ');		

document.getElementById("crt[]").options[1]=new Option('10 OZ', '10 OZ');

document.getElementById("crt[]").options[2]=new Option('13 OZ', '13 OZ');	



	}

	

else{

		

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }

document.getElementById("crt[]").options[0]=new Option('14 OZ', '14 OZ');		

	}



}





//--------------------------------------------------------------------------------------------------------------------------------



var v;

	

	

function onchangctype(){

var tpr=document.getElementById("crp[]").value;

var ttype=document.getElementById("crt[]").value;

var llen=document.getElementById("crl[]").value;







switch (llen){

case 'By The Yard':



		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  v="4.80"; }	else if(tpr=='62" Wide Primed'){  v="8.50"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  v="6.25"; }	else if(tpr=='62" Wide Primed'){  v="8.80"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  v=""; }	else if(tpr=='62" Wide Primed'){  v="11.95"; }			

			break

			case '14 OZ':

			if(tpr=='83" Wide Primed'){v="15.00";	}	

			break

			}		

break





case '6 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  v="28.00"; }	else if(tpr=='62" Wide Primed'){  v="36.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  v="36.00"; }	else if(tpr=='62" Wide Primed'){  v="45.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  v=""; }	else if(tpr=='62" Wide Primed'){  v="55.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){v="80.00";	}	

			break

			

			}		

break

	

case '25 Yard Roll ':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  v="100.00"; }	else if(tpr=='62" Wide Primed'){  v="125.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  v="110.00"; }	else if(tpr=='62" Wide Primed'){  v="135.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  v=""; }	else if(tpr=='62" Wide Primed'){  v="175.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){v="270.00";	}	

			break

			

			}		

break	





case '50 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  v="180.00"; }	else if(tpr=='62" Wide Primed'){  v="195.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  v="225.00"; }	else if(tpr=='62" Wide Primed'){  v="255.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  v=""; }	else if(tpr=='62" Wide Primed'){  v="265.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){v="495.00";	}	

			break

			}		

break	





case '100 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  v="195.00"; }	else if(tpr=='62" Wide Primed'){  v="340.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  v="295.00"; }	else if(tpr=='62" Wide Primed'){  v="410.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){v="0"; }	else if(tpr=='62" Wide Primed'){  v="440.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){v="925.00";	}	

			break

			}		

break

	

	}

	

document.getElementById("acupdisplay[]").value=roundNumber(v,2);	

document.getElementById("crup").innerHTML=roundNumber(v,2);

	}

//------------------------------------------------------------------------------



function startCalc(){

  intervala = setInterval("calsubtotalcr()",1);

  intervalb = setInterval("onchangctype()",1);

  

}

function calsubtotalcr(){

	//prompt("fsdfsf")

	var q=document.getElementById("acq[]").value;

	var b=document.getElementById("acupdisplay[]").value;

var g=q*b;

//g=Math.round(g*100)/100



document.getElementById("acsubt[]").value=roundNumber(g,2);

document.getElementById("stCR").innerHTML=roundNumber(g,2);

	}



function stopCalc(){

  clearInterval(intervala);

  clearInterval(intervalb);

}

//--------------------------------------------------------------





function onchangetest2(getIteration){

	var ite=getIteration;

	var valname="crp["+ite+"]";

	var nType="crt["+ite+"]";

	

	var lb=document.getElementById(nType);

	

	var val=document.getElementById(valname).value;

	

	if(val =='62" Wide Unprimed'){

		

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }



document.getElementById(nType).options[0]=new Option('7 OZ', '7 OZ');

document.getElementById(nType).options[1]=new Option('10 OZ', '10 OZ');

				}

else if(val =='62" Wide Primed'){

	

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }

	

	

document.getElementById(nType).options[0]=new Option('7 OZ', '7 OZ');
document.getElementById(nType).options[1]=new Option('10 OZ', '10 OZ');
document.getElementById(nType).options[2]=new Option('13 OZ', '13 OZ');

	}

	

else{

		

for (var i=lb.options.length-1; i>=0; i--){

    lb.options[i] = null;

 }

document.getElementById(nType).options[0]=new Option('14 OZ', '14 OZ');		

	}

	

	}

	

	

	

//------------------------------------------------------------------------

/*

function onchangctype2(getit){

	var vp;

	var itn=getit;

	var crpname="crp["+itn+"]";

	var typeCR="crt["+itn+"]";

	var llen="crl["+itn+"]";

	var updisname="acupdisplay["+itn+"]";

	var divup="divupcr"+itn;



var tpr=document.getElementById(crpname).value;

var ttype=document.getElementById(typeCR).value;

var llen=document.getElementById(llen).value;





switch (llen){

	

	case 'By The Yard':

if(tpr==){	if(ttype == "7 OZ"){ vp="4.80"; 	}	else{ vp="6.25";	}		}



else if(tpr=='62" Wide Primed'){ if(ttype == "10 OZ"){	vp="8.80";} 	else{vp="11.95";} }



break



case '6 Yard Roll':

if(tpr=='62" Wide Unprimed'){	if(ttype == "7 OZ"){ vp="28.00"; 	}	else{ vp="36.00";	}		}



else if(tpr=='62" Wide Primed'){ if(ttype == "10 OZ"){	vp="45.00";} 	else{vp="55.00";} }



break





case '25 Yard Roll':

if(tpr=='62" Wide Unprimed'){	if(ttype == "7 OZ"){ vp="100.00"; 	}	else{ vp="110.00";	}		}



else if(tpr=='62" Wide Primed'){ if(ttype == "10 OZ"){	vp="135.00";} 	else{vp="175.00";} }



break



case '50 Yard Roll':

if(tpr=='62" Wide Unprimed'){	if(ttype == "7 OZ"){ vp="180.00"; 	}	else{ vp="225.00";	}		}



else if(tpr=='62" Wide Primed'){ if(ttype == "10 OZ"){	vp="255.00";} 	else{vp="265.00";} }



break



case '100 Yard Roll':

if(tpr=='62" Wide Unprimed'){	if(ttype == "7 OZ"){ vp="195.00"; 	}	else{ vp="295.00";	}		}



else if(tpr=='62" Wide Primed'){ if(ttype == "10 OZ"){	vp="410.00";} 	else{vp="440.00";} }



break

}

document.getElementById(updisname).value=vp;	

document.getElementById(divup).innerHTML=vp;	

	}

	*/

	



function onchangctype2(getit){

	var vp;

	var itn=getit;

	var crpname="crp["+itn+"]";

	var typeCR="crt["+itn+"]";

	var llen="crl["+itn+"]";

	var updisname="acupdisplay["+itn+"]";

	var divup="divupcr"+itn;



var tpr=document.getElementById(crpname).value;

var ttype=document.getElementById(typeCR).value;

var llen=document.getElementById(llen).value;





switch (llen){

case 'By The Yard':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="4.80"; }	else if(tpr=='62" Wide Primed'){  vp="8.50"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="6.25"; }	else if(tpr=='62" Wide Primed'){  vp="8.80"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="0"; }	else if(tpr=='62" Wide Primed'){  vp="11.95"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){vp="15.00";	}	

			break

			}		

break





case '6 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="28.00"; }	else if(tpr=='62" Wide Primed'){  vp="36.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="36.00"; }	else{  vp="45.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  vp=""; }	else if(tpr=='62" Wide Primed'){  vp="55.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){vp="80.00";	}	

			break

			}		

break

	

case '25 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="100.00"; }	else if(tpr=='62" Wide Primed'){  vp="125.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="110.00"; }	else if(tpr=='62" Wide Primed'){  vp="135.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  vp=""; }	else if(tpr=='62" Wide Primed'){  vp="175.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){vp="270.00";	}	

			break

			}		

break	





case '50 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="180.00"; }	else if(tpr=='62" Wide Primed'){  vp="195.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="225.00"; }	else if(tpr=='62" Wide Primed'){  vp="255.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  vp=""; }	else if(tpr=='62" Wide Primed'){  vp="265.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){vp="495.00";	}	

			break

			}		

break	





case '100 Yard Roll':

		

			switch (ttype){

			case '7 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="195.00"; }	else if(tpr=='62" Wide Primed'){  vp="340.00"; }			

			break

			

			case '10 OZ':

			if(tpr=='62" Wide Unprimed'){  vp="295.00"; }	else if(tpr=='62" Wide Primed'){  vp="410.00"; }			

			break

			

			case '13 OZ':

			if(tpr=='62" Wide Unprimed'){  vp=""; }	else if(tpr=='62" Wide Primed'){  vp="440.00"; }			

			break

			

			case '14 OZ':

			if(tpr=='83" Wide Primed'){vp="925.00";	}	

			break

			}		

break

	

	}

	

document.getElementById(updisname).value=roundNumber(vp,2);

document.getElementById(divup).innerHTML=roundNumber(vp,2);	

	}

//------------------------------------------------------------------------------





//------------------------------------------------------------------------------

var subtotalIteration;

function startCalc2(getiteration){

	

	subtotalIteration=getiteration;

	

  intervala = setInterval("calsubtotalcr2()",1);

  //intervalb = setInterval("onchangctype()",1);

  

}

function calsubtotalcr2(){

	

	var subname="acsubt["+subtotalIteration+"]";

	var subtotaldiv="divstcr"+subtotalIteration;

	var crqname="acq["+subtotalIteration+"]";

	var upname=	"acupdisplay["+subtotalIteration+"]";

	

	var q=document.getElementById(crqname).value;

	var b=document.getElementById(upname).value;

var g=b*q;

//g=Math.round(g*100)/100



document.getElementById(subname).value=roundNumber(g,2);

document.getElementById(subtotaldiv).innerHTML=roundNumber(g,2);

	}



function stopCalc2(){

  clearInterval(intervala);

 // clearInterval(intervalb);

}

//--------------------------------------------------------------



//-------------------Check Quantity-----------------	



function quantitychecking1(){

var q=document.getElementById("acq[]").value;



if(q==""){

alert("PLEASE ENTER QUANTITY")	

	}	

	}

	

function quantitychecking2(){
var getTable = document.getElementById('canvasrolls');
var countRow = getTable.rows.length;
var iteration=countRow-2;

var qId="acq["+iteration+"]";
var q=document.getElementById(qId).value;



if(q==""){

alert("PLEASE ENTER QUANTITY")	

	}	

	}