﻿

function delivery_amend(courier)

{
	parent.frames[0].location = 'order_screen.asp?courier=' + courier
}

function setprice()
{

var country = document.TheForm.country.value.toUpperCase()

switch (country)
		{
		case "UK":
				return true;
		case "U K":
				return true;
		case "U.K":
				return true;
		case "U.K.":
				return true;
		case "UNITED KINGDOM":
				return true;
		case "UNITEDKINGDOM":
				return true;
		case "UNITED.KINGDOM":
				return true;
		case "UNITED.KINGDOM.":
				return true;
		case "ENGLAND":
				return true;
		case "SCOTLAND":
				return true;
		case "WALES":
				return true;
		case "GREAT BRITAIN":
				return true;
		case "GREATBRITAIN":
				return true;
		case "GREAT BRITAIN":
				return true;
		case "GB":
				return true;
		case "G.B.":
				return true;
		case "G B":
				return true;
		case "G.B":
				return true;
		case "NORTHERN IRELAND":
				return true;
		case "NORTHERNIRELAND":
				return true;
		case "NIRELAND":
				return true;
		case "N.IRELAND":
				return true;
		case "N IRELAND":
				return true;
		default:
				document.TheForm.show_price_top.value="£4.50"
				document.TheForm.show_price_order.value="£4.50"
				document.TheForm.indprice.value="4.50"		
		
		
		}

}

function stop()
{
document.TheForm.Firstname.focus()

}

function postal()
{
var firstname = document.TheForm.Firstname.value
var address1 = document.TheForm.address1.value
var address2 = document.TheForm.address2.value
var postcode = document.TheForm.PostCode.value
var county = document.TheForm.County.value
var emailchk = document.TheForm.Email.value
//var bedquantity = document.TheForm.vtFormDescriptionInput.value
var cardno = document.TheForm.vtFormCardNoInput.value
var cardexpiryMonth = document.TheForm.vtFormExpireMonthInput.value
var cardexpiryYear = document.TheForm.vtFormExpireYearInput.value
var cardstartMonth = document.TheForm.vtFormValidFromMonthInput.value
var cardstartYear = document.TheForm.vtFormValidFromYearInput.value
var cardsecurityno = document.TheForm.vtFormCvvInput.value

if (!firstname)
{
alert('Please Enter Name!')
document.TheForm.Firstname.focus()
}
else
{
	if (!address1)
	{
		alert('Please Enter Address Line 1!')
		document.TheForm.address1.focus()
	}
	else
	{
		if (!address2)
		{
			alert('Please Enter Address Line 2!')
			document.TheForm.address2.focus()
		}
		else
		{
			if (!county)
			{
				alert('Please Enter County!')
				document.TheForm.County.focus()
			}
			else
			{
				if (!postcode)
				{
					alert('Please Enter PostCode!')
					document.TheForm.PostCode.focus()
				}
				else
				{
					if (!emailchk)
					{
						alert('Email Address Must be Entered!')
						document.TheForm.Email.focus()
					}
					else
					{
						/*document.TheForm.action="order_screen.asp?process=yes"*/
						document.forms.paypal_form.submit()																						
					}					
				}
			}
		}
	}
}





}
function Total()
{
var vetbed_quantity = document.TheForm.vtFormDescriptionInput.value
var vetbed_price = document.TheForm.indprice.value
document.TheForm.final_quantity.value = vetbed_quantity
document.TheForm.vtFormAmountInput.value =  vetbed_quantity * vetbed_price
amountFormat();
}
function doReset(){
	document.TheForm.Firstname.value =  "";
	document.TheForm.address1.value = "" ;	
	document.TheForm.address2.value = "" ;	
	document.TheForm.address3.value = "" ;	
	document.TheForm.County.value =  "";
	document.TheForm.Town.value =  "";
	document.TheForm.country.value =  "";
	document.TheForm.postcode.value =  "";
	document.TheForm.telnum1.value =  "";
	document.TheForm.Email.value = "" ;		
	/*document.TheForm.vtFormRefInput.value =  "";
	document.TheForm.vtFormDescriptionInput.value =  "";
	document.TheForm.vtFormAmountInput.value =  "0.00";
	document.TheForm.vtFormCardNoInput.value =  "";
	document.TheForm.vtFormCvvInput.value =  "";
	document.TheForm.vtFormIssueNoInput.value =  "";
	document.TheForm.company.value =  "";
	//document.TheForm.vtFormCurrencyInput.value =  "gbp";*/
  }


function amountFormat(){
/*
	amountTest = new RegExp("^[0-9]+[\.]+[0-9]$")
	var amount = document.forms.TheForm.vtFormAmountInput.value
	len1 = amount.length  
	len2=len1-1
	lastChar = amount.substring(len2,len1);SecondLastChar = amount.substring(len2-1,len1-1);if (SecondLastChar == "."){
		document.forms.TheForm.vtFormAmountInput.value = 
		amount+"0";}
		else{
		document.forms.TheForm.vtFormAmountInput.value = amount+".00";
		}
	if (amount == ""){
	amount = "0";
	}


	if (!amountTest.test(amount))	
	{  
		if (lastChar == "."){
		document.forms.TheForm.vtFormAmountInput.value = 
		amount+"00";}
		else{
		document.forms.TheForm.vtFormAmountInput.value = 
		amount+".00"				;
		}}*/
}


function emailFormat(){
	email = document.TheForm.email.value
	email = email.toLowerCase()
	document.TheForm.email.value = 
email



;
} function
checkMaxInput(form){
maxLen = 255; // max number of characters allowed in text area
	if (form.address1.value.length > 
	maxLen){
		form.address1.value =  
	form.address1.value.substring(0,
maxLen);
}
} function checkForm(){
var agree=  confirm("Are you sure you wish to continue?");
	if(agree)	
	document.TheForm.submit() ;
	else 
	return
false;
}


function checkForm2(){
	amount =  document.TheForm.vtFormAmountInput.value;
	if (amount < 50){
		return true;}
	else{
		var agree=  confirm("Are you sure you wish to continue?");
			if (agree) return true
			; else return
	false
;
}
} function
clear_textbox(){
	if (document.TheForm.vtFormAmountInput.value == "0.00")
	document.TheForm.vtFormAmountInput.value = "";
} 
 


function print_order(body)
{

    var OrderPrintWindow = window.open('','Order_Window','resizable=yes,width=550');    
    OrderPrintWindow.document.write('<html><head><title>Printable Order</title><link href=\"styles/Order_Print.css\" type=\"text/css\" rel=\"Stylesheet\"/>');    
    OrderPrintWindow.document.write('</head><body class=\"page_body\">');
    OrderPrintWindow.document.write(body);    
    OrderPrintWindow.document.write('</body></html>');

}

function autoprint()
{

    setTimeout('window.print()',1000);
    setTimeout('window.close()',5000);
}


function nopic()
{
    alert('p');
}