function AddEndRow_instock() {

 

var getTable3 = document.getElementById('tableInstock');

var countRow3 = getTable3.rows.length; 

var iteration3=countRow3;





var isTR=document.createElement('tr');



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

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

 sel.name = "InStksize["+iteration3+"]";

 sel.id="InStksize["+iteration3+"]";

 sel.options[0] = new Option('36x48', '36x48');

 sel.options[1] = new Option('30x40', '30x40');

 sel.options[2] = new Option('24x36', '24x36');

 



sel.onchange=function(){onchangeInstockSize2(iteration3);UnitPriceis2(iteration3)};

sel.onfocus=function(){startCal_is2(iteration3)}

sel.onblur=function(){stopCal_is2()};

isTD.appendChild(sel);







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

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

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

 cSize.type = 'text'; 

 cSize.value=''; 

 cSize.size=13; 

 cSize.name = "InStkCusSize["+iteration3+"]";

 cSize.id="InStkCusSize["+iteration3+"]";





cSize.onfocus=function(){startcus_is2(iteration3);}; 

cSize.onblur=function(){stopcus_is();};

isTD2.appendChild(cSize);



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



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



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

 Ino.type = 'text'; 

 Ino.value=''; 

 Ino.size=13; 

 Ino.name = "InStkINo["+iteration3+"]";

 Ino.id="InStkINo["+iteration3+"]";

 

 Ino.onfocus=function(){startCal_is2(iteration3)}; 

 Ino.onblur=function(){stopCal_is2()};





isTD3.appendChild(Ino);





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



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



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

 streching.name = "InStkStreching["+iteration3+"]";

 streching.id="InStkStreching["+iteration3+"]";

 streching.options[0] = new Option('NON', 'NON');

 streching.options[1] = new Option('3/4" Bar', '3/4" Bar');

 streching.options[2] = new Option('Gallery-3/4" Bar', 'Gallery-3/4" Bar');

 streching.options[3] = new Option('Gallery- 1-1/2" Bar', 'Gallery- 1-1/2" Bar');

 

 streching.onchange=function(){onchangeInstockSize2(iteration3);UnitPriceis2(iteration3)};

 streching.onfocus=function(){startCal_is2(iteration3)}; 

 streching.onblur=function(){stopCal_is2();};



isTD4.appendChild(streching);  

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

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



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

 catP.name = "InStkCatPrice["+iteration3+"]";

 catP.id="InStkCatPrice["+iteration3+"]";

 catP.options[0] = new Option('25.00', '25.00');

 catP.options[1] = new Option('28.00', '28.00');

 catP.options[2] = new Option('60.00', '60.00');

 catP.options[3] = new Option('85.00', '85.00');

 

 catP.onchange=function(){UnitPriceis2(iteration3)}; 

 catP.onfocus=function(){startCal_is2(iteration3)};

 catP.onblure=function(){stopCal_is2();};

 

 isTD5.appendChild(catP);







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

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

 quantity.type = 'text'; 

 quantity.value=''; 

 quantity.size=13; 

 quantity.id = "InStkQuntity["+iteration3+"]"; 

 quantity.name="InStkQuntity["+iteration3+"]"; 

 

quantity.onclick=function(){checkItemNumberIA2(iteration3);}

quantity.onfocus=function(){UnitPriceis2(iteration3);startCal_is2(iteration3);};  

quantity.onblur=function(){stopCal_is2()};  



 isTD6.appendChild(quantity);

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



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





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

 up.type = 'hidden'; 

 up.value=''; 

 up.size=13;

 //st.disabled='disabled';

 up.id = "InStkArtUnitPriceDisplay["+iteration3+"]";  

 up.name = "InStkArtUnitPriceDisplay["+iteration3+"]";  

 

 

var upd = document.createElement('div');

upd.innerHTML = "";

upd.name = "divupst"+iteration3;

upd.id = "divupst"+iteration3;  

 

isTD7.appendChild(up);

isTD7.appendChild(upd);

  

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

  

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



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

 st.type = 'hidden'; 

 st.value=''; 

 st.size=13; 

 st.id = "InStkArtSubTotalDis["+iteration3+"]";  

 st.name = "InStkArtSubTotalDis["+iteration3+"]";  

 

var std = document.createElement('div');

std.innerHTML = "";

std.align="right";

std.name = "divstis"+iteration3;

std.id = "divstis"+iteration3;  

 

isTD8.appendChild(st);

isTD8.appendChild(std);

  

  

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



isTR.appendChild(isTD);

isTR.appendChild(isTD2);

isTR.appendChild(isTD3);

isTR.appendChild(isTD4);

isTR.appendChild(isTD5);

isTR.appendChild(isTD6);

isTR.appendChild(isTD7);

isTR.appendChild(isTD8);



document.getElementById('tableInstock').appendChild(isTR);



}





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

	

function removeRow_instock()

{

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

  var lastRow = tbl.rows.length;

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

}

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



function onchangeInstockSize2(getit){



var sizeID="InStksize["+getit+"]";

var pricId="InStkCatPrice["+getit+"]";

var Sizeis=document.getElementById(sizeID).value;

var Price=document.getElementById(pricId);



switch (Sizeis){

case '36x48':

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

    Price.options[i] = null;}



Price.options[0]=new Option('25.00', '25.00');

Price.options[1]=new Option('28.00', '28.00');

Price.options[2]=new Option('60.00', '60.00');

Price.options[3]=new Option('85.00', '85.00');



break



case '30x40':

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

    Price.options[i] = null;}

Price.options[0]=new Option('22.00', '22.00');

Price.options[1]=new Option('24.00', '24.00');

Price.options[2]=new Option('57.00', '57.00');

break



case '24x36':

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

    Price.options[i] = null;}

Price.options[0]=new Option('12.00', '12.00');

Price.options[1]=new Option('13.00', '13.00');

Price.options[2]=new Option('17.00', '17.00');

Price.options[3]=new Option('32.00', '32.00');

Price.options[4]=new Option('42.00', '42.00');



break

}

}

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



function onchangeInstockSize(){

var Sizeis=document.getElementById('InStksize[]').value;

var Price=document.getElementById('InStkCatPrice[]');



switch (Sizeis){

case '36x48':

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

    Price.options[i] = null;}



Price.options[0]=new Option('25.00', '25.00');

Price.options[1]=new Option('28.00', '28.00');

Price.options[2]=new Option('60.00', '60.00');

Price.options[3]=new Option('85.00', '85.00');



break



case '30x40':

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

    Price.options[i] = null;}

Price.options[0]=new Option('22.00', '22.00');

Price.options[1]=new Option('24.00', '24.00');

Price.options[2]=new Option('57.00', '57.00');

break



case '24x36':

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

Price.options[i] = null;}

Price.options[0]=new Option('12.00', '12.00');

Price.options[1]=new Option('13.00', '13.00');

Price.options[2]=new Option('17.00', '17.00');

Price.options[3]=new Option('32.00', '32.00');

Price.options[4]=new Option('42.00', '42.00');



break

}

}

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

function UnitPriceis2(tera){

	

	

var priceid="InStkCatPrice["+tera+"]";

var priceupid="InStkArtUnitPriceDisplay["+tera+"]";

var priceupdivid="divupst"+tera;

var strechingId="InStkStreching["+tera+"]";

var sizevalId="InStksize["+tera+"]";



var Price=document.getElementById(priceid).value;

var streching=document.getElementById(strechingId).value;

var sizeval=document.getElementById(sizevalId).value;





if (streching=='NON'){

document.getElementById(priceupid).value=roundNumber(Price,2);

document.getElementById(priceupdivid).innerHTML=roundNumber(Price,2);

	}



else if(streching=='3/4" Bar'){
	
	

switch (sizeval){

case '36x48':

Price=parseFloat(Price)+9.00;

break



case '30x40':

Price=parseFloat(Price)+8.00;

break





case '24x36':

Price=parseFloat(Price)+5.00;

break



	}	

	

document.getElementById(priceupid).value=roundNumber(Price,2);
document.getElementById(priceupdivid).innerHTML=roundNumber(Price,2);

	}
	
else if(streching=='Gallery-3/4" Bar'){
	
switch (sizeval){

case '36x48':

Price=parseFloat(Price)+(9.00*2);

break



case '30x40':

Price=parseFloat(Price)+(8.00*2);

break





case '24x36':

Price=parseFloat(Price)+(5.00*2);

break



	}	

	

document.getElementById(priceupid).value=roundNumber(Price,2);
document.getElementById(priceupdivid).innerHTML=roundNumber(Price,2);	
	}
	
else if(streching=='Gallery- 1-1/2" Bar'){
	
switch (sizeval){

case '36x48':

Price=parseFloat(Price)+(9.00*3);

break



case '30x40':

Price=parseFloat(Price)+(8.00*3);

break





case '24x36':

Price=parseFloat(Price)+(5.00*3);

break



	}	

	

document.getElementById(priceupid).value=roundNumber(Price,2);
document.getElementById(priceupdivid).innerHTML=roundNumber(Price,2);	
	}



}



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

function UnitPriceis(){

var Price=document.getElementById('InStkCatPrice[]').value;

var streching=document.getElementById('InStkStreching[]').value;

var sizeval=document.getElementById('InStksize[]').value;



if (streching=="NON"){

document.getElementById('InStkArtUnitPriceDisplay[]').value=roundNumber(Price,2);

document.getElementById('isaUP').innerHTML=roundNumber(Price,2);

	}



else if(streching=='3/4" Bar'){
	
	

switch (sizeval){

case '36x48':

Price=parseFloat(Price)+9.00;

break



case '30x40':

Price=parseFloat(Price)+8.00;

break





case '24x36':

Price=parseFloat(Price)+5.00;

break



	}	

	

document.getElementById('InStkArtUnitPriceDisplay[]').value=roundNumber(Price,2);
document.getElementById('isaUP').innerHTML=roundNumber(Price,2);

	}
	
else if(streching=='Gallery-3/4" Bar'){
	
switch (sizeval){

case '36x48':

Price=parseFloat(Price)+(9.00*2);

break



case '30x40':

Price=parseFloat(Price)+(8.00*2);

break





case '24x36':

Price=parseFloat(Price)+(5.00*2);

break



	}	

	

document.getElementById('InStkArtUnitPriceDisplay[]').value=roundNumber(Price,2);
document.getElementById('isaUP').innerHTML=roundNumber(Price,2);	
	}
	
else if(streching=='Gallery- 1-1/2" Bar'){
	
switch (sizeval){

case '36x48':

Price=parseFloat(Price)+(9.00*3);

break



case '30x40':

Price=parseFloat(Price)+(8.00*3);

break





case '24x36':

Price=parseFloat(Price)+(5.00*3);

break



	}	

	

document.getElementById('InStkArtUnitPriceDisplay[]').value=roundNumber(Price,2);
document.getElementById('isaUP').innerHTML=roundNumber(Price,2);	
	}



}

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



function startCal_is(){

  intervalis = setInterval("subtotalis()",1); 

}



function subtotalis(){

var quantity=document.getElementById('InStkQuntity[]').value;

var up=document.getElementById('InStkArtUnitPriceDisplay[]').value;





var subt=quantity*up;

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

subt=roundNumber(subt,2);

document.getElementById('InStkArtSubTotalDis[]').value=roundNumber(subt,2);

document.getElementById('isaST').innerHTML=roundNumber(subt,2);

}





function stopCal_is(){

  clearInterval(intervalis);  

}

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



var itera;



function startCal_is2(iteration){

itera=iteration;

  intervalis2 = setInterval("subtotalis2()",1); 

}



function subtotalis2(){

var quantityID="InStkQuntity["+itera+"]";

var UpId="InStkArtUnitPriceDisplay["+itera+"]";

var subtDisId="InStkArtSubTotalDis["+itera+"]";

var subtDisDIvId="divstis"+itera;



var quantity=document.getElementById(quantityID).value;

var up=document.getElementById(UpId).value;



var subt=quantity*up;

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

subt=roundNumber(subt,2);

document.getElementById(subtDisId).value=roundNumber(subt,2);

document.getElementById(subtDisDIvId).innerHTML=roundNumber(subt,2);

}





function stopCal_is2(){

  clearInterval(intervalis2);  

}



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



function startcus_is(){



  intervalis2 = setInterval("cussize_is()",1); 

}



function cussize_is(){

var cusSize=document.getElementById('InStkCusSize[]').value;



if(cusSize==""){

document.getElementById('InStksize[]').disabled=false;

}

else{

document.getElementById('InStksize[]').disabled=true;

//document.getElementById('InStksize[]').value="";

document.getElementById('InStkArtUnitPriceDisplay[]').value="";

document.getElementById('isaUP').innerHTML="";

document.getElementById('InStkArtSubTotalDis[]').value="";

document.getElementById('isaST').innerHTML="";

	}



}





function stopcus_is(){

  clearInterval(intervalis2);  

}



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



var itr;

function startcus_is2(iter){

itr=iter;

  intervalis2 = setInterval("cussize_is2()",1); 

}



function cussize_is2(){

var cusSizeId="InStkCusSize["+itr+"]";

var SizeId="InStksize["+itr+"]";



var up="InStkArtUnitPriceDisplay["+itr+"]";

var updiv="divupst"+itr;

var st="InStkArtSubTotalDis["+itr+"]";

var stdiv="divstis"+itr;





var cusSize=document.getElementById(cusSizeId).value;



if(cusSize==""){

document.getElementById(SizeId).disabled=false;

}

else{

document.getElementById(SizeId).disabled=true;

//document.getElementById(SizeId).value="";



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

document.getElementById(updiv).innerHTML="";

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

document.getElementById(stdiv).innerHTML="";

	}



}





function stopcus_is2(){

  clearInterval(intervalis2);  

}





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



//------------------------------Check Item Number----------------------



function checkItemNumberIA(){	



var itemNumberval=document.getElementById("InStkINo[]").value;



if(itemNumberval==""){

alert("PLEASE ENTER THE ITEM NUMBER BEFORE ADD QUANTITY")	

	}

	

	}

	

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



function checkItemNumberIA2(itera){	



var ItemNumberId="InStkINo["+itera+"]";



var itemNumber=document.getElementById(ItemNumberId).value;	



if (itemNumber==""){

alert("PLEASE ENTER THE ITEM NUMBER BEFORE ADD QUANTITY")	

	}	

	

	}





//---------------------End Item Number--------------------------------





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



function quantitycheckINS1(){

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



if(q==""){

alert("PLEASE ENTER QUANTITY")	

	}	

	}

	

function quantitycheckINS2(){
var getTable3 = document.getElementById('tableInstock');
var countRow3 = getTable3.rows.length; 
var iteration=countRow3-2;
	

var qId="InStkQuntity["+iteration+"]";

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



if(q==""){

alert("PLEASE ENTER QUANTITY")	

	}	

	}