// 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= 640 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 666 }
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 692 }
 
 // 1201 -1500

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


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

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 712 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 746 }
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 780 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 726 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 762 }
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 798 }
 
}

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

if (style == 'Satin')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 760 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 801 }
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 842 }
 
 
else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 834 }
  
else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 884 }
 
else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 933 }


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

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 882 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 938 }
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 993 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 907 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 965 }
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1023 }
 
}
//------- CHINCHILLA GLASS PRICING----------- //

if (style == 'Chinchilla')

{

if (width >= 900 && width <= 1200 && height >= 1500 && height <= 2000)
 {document.doubledoorpricer.finalprice.value= 796 }

else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250)
 {document.doubledoorpricer.finalprice.value= 841 }

else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500)
 {document.doubledoorpricer.finalprice.value= 886 }


else if (width >= 1201 && width <= 1500 && height >= 1500 && height <= 2000)
 {document.doubledoorpricer.finalprice.value= 878 }

else if (width >= 1201 && width <= 1500 && height >= 2001 && height <= 2250)
 {document.doubledoorpricer.finalprice.value= 933 }

else if (width >= 1201 && width <= 1500 && height >= 2251 && height <= 2500)
 {document.doubledoorpricer.finalprice.value= 988 }


 // 1501 - 1600

else if (width >= 1501 && width <= 1600 && height >= 1500 && height <= 2000)
 {document.doubledoorpricer.finalprice.value= 905 }

else if (width >= 1501 && width <= 1600 && height >= 2001 && height <= 2250)
 {document.doubledoorpricer.finalprice.value= 963 }

else if (width >= 1501 && width <= 1600 && height >= 2251 && height <= 2500)
 {document.doubledoorpricer.finalprice.value= 1022 }

 // 1601 - 1700

else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000)
 {document.doubledoorpricer.finalprice.value= 932 }

else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250)
 {document.doubledoorpricer.finalprice.value= 995 }

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= 960 }

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= 1089 }

}

//------- 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= 683 }
  
else if (width >= 900 && width <= 1200 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 714 }
 
else if (width >= 900 && width <= 1200 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 746 }


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


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

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 773 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 815 }
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 856 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 791 }
  
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= 878 }
 
}

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

if (style == 'Chinchilla_Bronze')

{

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


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


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

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 1043 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 1119 }
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1194 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 1077 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 1156 }
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 1236 }
 
}

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

if (style == 'Blue')

{

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


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


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

 // 1601 - 1700
 
else if (width >= 1601 && width <= 1700 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 828 }
  
else if (width >= 1601 && width <= 1700 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 877 }
 
else if (width >= 1601 && width <= 1700 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 925 }
 
 // 1701 - 1800
 
else if (width >= 1701 && width <= 1800 && height >= 1500 && height <= 2000) 
 {document.doubledoorpricer.finalprice.value= 849 }
  
else if (width >= 1701 && width <= 1800 && height >= 2001 && height <= 2250) 
 {document.doubledoorpricer.finalprice.value= 901 }
 
else if (width >= 1701 && width <= 1800 && height >= 2251 && height <= 2500) 
 {document.doubledoorpricer.finalprice.value= 952 }
 
}

 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.2

//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


}






