 var unitpricedppp=0;
 var subtotaldpppval=0;

function digitalprintingphotopaper() {



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

var TR=document.createElement('tr');
var TD=document.createElement('td');


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

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

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

 dpppsize.options[0] = new Option('24\" x 100\'', '24\" x 100\'');
 dpppsize.options[1] = new Option('36\" x 100\'', '36\" x 100\'');
 dpppsize.options[2] = new Option('42\" x 100\'', '42\" x 100\'');
 dpppsize.options[3] = new Option('44\" x 100\’', '44\" x 100\’');
 dpppsize.options[4] = new Option('54\" x 100\'', '54\" x 100\'');
 dpppsize.options[5] = new Option('60\" x 100\'', '60\" x 100\'');

 

 
 
dpppsize.onchange=function(){dppp_GetUnitPrice(this.parentNode.parentNode.rowIndex);};

TD.appendChild(dpppsize);

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


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

var dpppcs = document.createElement('input');
 dpppcs.type = 'text'; 
 dpppcs.size=13; 
 dpppcs.id = "dppp_cus_size["+iteration+"]";
 dpppcs.name = "dppp_cus_size["+iteration+"]";

dpppcs.onclick=function(){};
dpppcs.onfocus=function(){startcustomesizedppp(this.parentNode.parentNode.rowIndex);};
dpppcs.onblur=function(){stopcustomesizedppp()};

TD2.appendChild(dpppcs); 



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

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

var dppq = document.createElement('input');
 dppq.type = 'text'; 
 dppq.size=13; 
 dppq.id = "dppp_quantity["+iteration+"]";
 dppq.name = "dppp_quantity["+iteration+"]";

dppq.onclick=function(){dppp_GetUnitPrice(this.parentNode.parentNode.rowIndex);};
dppq.onfocus=function(){startCaledpp(this.parentNode.parentNode.rowIndex);};
dppq.onblur=function(){stopCaldppp();};

TD3.appendChild(dppq);  

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

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

var dppup = document.createElement('input');
 dppup.type = 'hidden'; 
 dppup.value=''; 
 dppup.size=13;
 dppup.name = "dppp_uprice["+iteration+"]";
 dppup.id="dppp_uprice["+iteration+"]";
 
 
var dppupdiv = document.createElement('div');
dppupdiv.innerHTML = " ";
dppupdiv.name = "div_dppp_uprice"+iteration;
dppupdiv.id = "div_dppp_uprice"+iteration; 


 TD4.appendChild(dppup);
 TD4.appendChild(dppupdiv);

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

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

var dpppst = document.createElement('input');
 dpppst.type = 'hidden'; 
 dpppst.value=''; 
 dpppst.size=13; 
 dpppst.id = "dppp_st["+iteration+"]"; 
 dpppst.name="dppp_st["+iteration+"]"; 
 
var dppstdiv = document.createElement('div');
dppstdiv.innerHTML = " ";
dppstdiv.align = "right";
dppstdiv.name = "div_dppp_st"+iteration;
dppstdiv.id = "div_dppp_st"+iteration; 



 TD5.appendChild(dpppst);
 TD5.appendChild(dppstdiv);

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


TR.appendChild(TD);
TR.appendChild(TD2);
TR.appendChild(TD3);
TR.appendChild(TD4);
TR.appendChild(TD5);


document.getElementById('digitalprintingphotopaper').appendChild(TR);



}





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

	

function digitalprintingphotopaperremove()

{

  var tbl = document.getElementById('digitalprintingphotopaper');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);

}


/*********************************************************************************************************************************/






function dppp_GetUnitPrice(rownumber){

var dpppsize_id="dpppsize["+rownumber+"]";
var dppp_uprice_id="dppp_uprice["+rownumber+"]";
var dppp_uprice_div_id="div_dppp_uprice"+rownumber;

var dpppsize=document.getElementById(dpppsize_id).value;

	

			switch (dpppsize){

			case '24\" x 100\'':
			unitpricedppp = "40.00";
			break

			case '36\" x 100\'':
			unitpricedppp = "60.00";			
			break

			case '42\" x 100\'':
			unitpricedppp = "70.00";			
			break
			
			case '44\" x 100\’':
			unitpricedppp = "75.00";
			break

			case '54\" x 100\'':
			unitpricedppp = "90.00";			
			break
			
			case '60\" x 100\'':
			unitpricedppp = "100.00";			
			break


			}

	
	
document.getElementById(dppp_uprice_id).value=unitpricedppp;
document.getElementById(dppp_uprice_div_id).innerHTML=unitpricedppp;


}


/*---------------------------Sub Total--------------------------*/

var rownumberab;
function startCaledpp(rownumber){
rownumberab=rownumber;

interval = setInterval("subtotaldppp(rownumberab)",1);

 
}



function subtotaldppp(rownumberab){
	

	var unitpriceid="dppp_uprice["+rownumberab+"]";
	var guantityid="dppp_quantity["+rownumberab+"]";
	var subtotalid="dppp_st["+rownumberab+"]";
	var subtotaldivid="div_dppp_st"+rownumberab;


var unitpricevalue=document.getElementById(unitpriceid).value;
var guantityvalue=document.getElementById(guantityid).value;

	
var subtotal = unitpricevalue*guantityvalue;
 subtotaldpppval=roundNumber(subtotal,2);




document.getElementById(subtotalid).value=subtotaldpppval;
document.getElementById(subtotaldivid).innerHTML=subtotaldpppval;

	

	}

	

function stopCaldppp(){
  clearInterval(interval);
}



/*--------------------CUSTOME SIZE---------------------*/



var rownumberc;
function startcustomesizedppp(rownumbera){
rownumberc=rownumbera;
intervalPortrait = setInterval("dpppcustomeSize(rownumberc)",1);

}


function dpppcustomeSize(rownumberc){


var cussizeid="dppp_cus_size["+rownumberc+"]";
var sizeid="dpppsize["+rownumberc+"]";
var dppp_urice_id="dppp_uprice["+rownumberc+"]";
var dppp_uprice_div_id="div_dppp_uprice"+rownumberc;
var subtotalid="dppp_st["+rownumberc+"]";
var subtotaldivid="div_dppp_st"+rownumberc;

/*unitpricevalue1=document.getElementById(dppp_urice_id).value;
subtotalvalue1=document.getElementById(subtotalid).value;*/

var customesize=document.getElementById(cussizeid).value;
var dppsizeobject=document.getElementById(sizeid);

if (customesize==""){	

dppsizeobject.disabled=false; 
document.getElementById(dppp_urice_id).value=unitpricedppp;
document.getElementById(dppp_uprice_div_id).innerHTML=unitpricedppp;

document.getElementById(subtotalid).value=subtotaldpppval;
document.getElementById(subtotaldivid).innerHTML=subtotaldpppval;

	}

	else{		

document.getElementById(dppp_urice_id).value=" ";
document.getElementById(dppp_uprice_div_id).innerHTML=" ";

document.getElementById(subtotalid).value=" ";
document.getElementById(subtotaldivid).innerHTML=" ";

dppsizeobject.disabled=true;



}	

	}

	


function stopcustomesizedppp(){

clearInterval(intervalPortrait);

}



