// JavaScript Document

function display(selection) {}

function calcDoors () {
var style = document.doorpricer.glass.value
var width = document.doorpricer.width.value
var height = document.doorpricer.height.value

//Size Validation

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

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

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

if (style =='Clear')

{

if (width >= 600 && width <= 762 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value=348 }
  
else if (width >= 600 && width <= 762 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 362 } 
 
else if (width >= 600 && width <= 762 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 377 }

 // 763 - 838
 
else if (width >= 763 && width <= 838 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 359 }
  
else if (width >= 763 && width <= 838 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 375 } 
 
else if (width >= 763 && width <= 838 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 390 }

 // 839 - 900
 
else if (width >= 839 && width <= 900 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 368 }
  
else if (width >= 839 && width <= 900 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 385 } 
 
else if (width >= 839 && width <= 900 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 402 }
 
}

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

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

{

if (width >= 600 && width <= 762 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 426 }
  
else if (width >= 600 && width <= 762 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 450 } 
 
else if (width >= 600 && width <= 762 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 473 }

 // 763 - 838
 
else if (width >= 763 && width <= 838 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 444 }
  
else if (width >= 763 && width <= 838 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 471 } 
 
else if (width >= 763 && width <= 838 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 497 }

 // 839 - 900
 
else if (width >= 839 && width <= 900 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 460 }
  
else if (width >= 839 && width <= 900 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 488 } 
 
else if (width >= 839 && width <= 900 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 516 }
 
}

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

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

{

if (width >= 600 && width <= 762 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 394 }
  
else if (width >= 600 && width <= 762 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 415 } 
 
else if (width >= 600 && width <= 762 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 435 }

 // 763 - 838
 
else if (width >= 763 && width <= 838 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 410 }
  
else if (width >= 763 && width <= 838 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 432 } 
 
else if (width >= 763 && width <= 838 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 454 }

 // 839 - 900
 
else if (width >= 839 && width <= 900 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 423 }
  
else if (width >= 839 && width <= 900 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 447 } 
 
else if (width >= 839 && width <= 900 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 470 }
 
}


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

if (style == 'Chinchilla_Bronze')

{

if (width >= 600 && width <= 762 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 466 }
  
else if (width >= 600 && width <= 762 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 494 } 
 
else if (width >= 600 && width <= 762 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 523 }

 // 763 - 838
 
else if (width >= 763 && width <= 838 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 488 }
  
else if (width >= 763 && width <= 838 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 520 } 
 
else if (width >= 763 && width <= 838 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 552 }

 // 839 - 900
 
else if (width >= 839 && width <= 900 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 507 }
  
else if (width >= 839 && width <= 900 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 541 } 
 
else if (width >= 839 && width <= 900 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 575 }
 
}


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

if (style == 'Blue')

{

if (width >= 600 && width <= 762 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 412 }
  
else if (width >= 600 && width <= 762 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 435 } 
 
else if (width >= 600 && width <= 762 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 457 }

 // 763 - 838
 
else if (width >= 763 && width <= 838 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 430 }
  
else if (width >= 763 && width <= 838 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 454 } 
 
else if (width >= 763 && width <= 838 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 479 }

 // 839 - 900
 
else if (width >= 839 && width <= 900 && height >= 1500 && height <= 2000) 
 {document.doorpricer.finalprice.value= 444 }
  
else if (width >= 839 && width <= 900 && height >= 2001 && height <= 2250) 
 {document.doorpricer.finalprice.value= 470 } 
 
else if (width >= 839 && width <= 900 && height >= 2251 && height <= 2500) 
 {document.doorpricer.finalprice.value= 497 }
 
}

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


}


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



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

document.doorpricer.cost.value = pricex 

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

document.doorpricer.totalcost.value = total * 2

document.doorpricer.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.doorpricer.vatprice.value = vatresult

document.doorpricer.wpvat.value = vatresult + total

document.doorpricer.youpay.value = total


}




