// JavaScript Document


function calcDoorsDB () {
var style = document.doubledoorpricer.glass.value
var width = document.doubledoorpricer.width.value
var height = document.doubledoorpricer.height.value


//Size Validation

if (width < 901)
   {
   alert("Minumum Width 901mm");
   }
   
if (width > 1800)
   {
   alert("Maximum Width 1800mm");
   }
   
   
	
if (height < 1500)
   {
   alert("Minimum Height 1500mm");
   }

if (height > 2500)
   {
   alert("Maximum Height 2500mm");
   }

//------- CLEAR GLASS PRICING----------- //

if (style =='Clear')

{

// 900 -1200 
 
if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 591 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 614 } 
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 637 }
 
 // 1201 -1500

else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 635 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 663 } 
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 691 }


 // 1501 - 1600
 
else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 649 }
  
else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 679 } 
 
else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 709 }

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 664 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 695 } 
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 727 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 678 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 712 } 
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 745 }
 
}

//------- SATIN/CHINCHILLA GLASS PRICING----------- //

if (style == 'Satin' || style == 'Chinchilla')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 713 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 751 } 
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 789 }
 
 
else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 787 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 834 } 
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 882 }


 // 1501 - 1600
 
else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 812 }
  
else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 862 } 
 
else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 912 }

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 837 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 890 } 
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 943 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 861 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 918 } 
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 974 }
 
}

//------- BRONZE/GREEN/GREY GLASS PRICING----------- //

if (style == 'Bronze' || style == 'Green' || style == 'Grey')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 664 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 696 } 
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 728 }


else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 726 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 766 } 
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 805 }


 // 1501 - 1600
 
else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 747 }
  
else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 789 } 
 
else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 831 }

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 767 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 812 } 
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 857 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 788 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 835 } 
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 882 }
 
}

//------- CHINCHILLA_BRONZE GLASS PRICING----------- //

if (style == 'Chinchilla_Bronze')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 776 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 822 } 
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 868 }


else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 866 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 923 } 
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 980 }


 // 1501 - 1600
 
else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 896 }
  
else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 957 } 
 
else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1017 }

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 926 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 990 } 
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1055 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 956 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 1024 } 
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1092 }
 
}

//------- BLUE GLASS PRICING----------- //

if (style == 'Blue')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 692 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 728 } 
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 763 }


else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 761 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 805 } 
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 849 }


 // 1501 - 1600
 
else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 784 }
  
else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 831 } 
 
else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 878 }

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 807 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 857 } 
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 906 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 830 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 883 } 
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 935 }
 
}

 if (style == '-'){
alert("Please Select A Glass Style");
}

}


function extrasDB () {
 // Brilliant Star Design Check Box
if (document.doubledoorpricer.starcut.checked) {
document.doubledoorpricer.brill.value=99
		}
		
if (document.doubledoorpricer.starcut.checked == false) {
document.doubledoorpricer.brill.value=0
		}
 
// Hardware Radio Buttons
if (document.doubledoorpricer.hardware.checked) {
document.doubledoorpricer.h1.value=0
		}
		
// if (document.doubledoorpricer.hardware[1].checked) {
//		document.doubledoorpricer.h1.value=298
//	}
	
// if (document.doubledoorpricer.hardware[2].checked) {
//		document.doubledoorpricer.h1.value=298
//	} 
// Locking Radio Buttons
if (document.doubledoorpricer.lock[0].checked) {
		document.doubledoorpricer.lk.value=0
	} 
	
if (document.doubledoorpricer.lock[1].checked) {
		document.doubledoorpricer.lk.value=25
	} 
	
if (document.doubledoorpricer.lock[2].checked) {
		document.doubledoorpricer.lk.value=25
	} 
	
// Delivery Radio Buttons
if (document.doubledoorpricer.del[0].checked) {
		document.doubledoorpricer.deliv.value=0
	} 
	
if (document.doubledoorpricer.del[1].checked) {
		document.doubledoorpricer.deliv.value=30
	} 
	}



function calcPriceDB () {
var pricex = document.doubledoorpricer.finalprice.value
pricex = Number(pricex)
var hardware = document.doubledoorpricer.h1.value
hardware = Number(hardware)
var cutstar = document.doubledoorpricer.brill.value
cutstar = Number(cutstar)
var locking = document.doubledoorpricer.lk.value
locking = Number(locking)
var delivery = document.doubledoorpricer.deliv.value
delivery = Number(delivery)

document.doubledoorpricer.cost.value = pricex 

var total = (pricex + hardware + cutstar + locking + delivery)

document.doubledoorpricer.totalcost.value = total * 2

document.doubledoorpricer.half.value = total

// VAT

var vats = total * 0.15

//round up vat to two decimals
	var vatresult=Math.round(vats*100)/100
	//
vatresult = Number(vatresult)

document.doubledoorpricer.vatprice.value = vatresult

document.doubledoorpricer.wpvat.value = vatresult + total

document.doubledoorpricer.youpay.value = total


}





