 function isInt(x) {
   var y=parseInt(x);
   if (isNaN(y)) return false;
   return x==y && x.toString()==y.toString();
 } 

function checkBskt(v){
if(!isInt(v.quantity.value)){
	alert("Please enter the number you wish to buy");
return false;
}
return true;
}

function submitBskt(v){
if(!isInt(v.quantity.value)){
	alert("Please enter the number you wish to buy");
return false;
}
return true;
}


function matchUp(){
x=document.checkout;	
x.del_title.value=x.title.value;	
x.del_firstname.value=x.firstname.value;	
x.del_surname.value=x.surname.value;	
x.del_email.value=x.email.value;	
x.del_telno.value=x.telno.value;	
x.del_postcode.value=x.postcode.value;	
x.del_address1.value=x.address1.value;	
x.del_address2.value=x.address2.value;	
x.del_address3.value=x.address3.value;	
x.del_address4.value=x.address4.value;	
x.del_town.value=x.town.value;	
x.del_county.value=x.county.value;	
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=455,height=400,left = 415,top = 312');");
}
function popUpMap(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=645,height=400,left = 415,top = 312');");
}


function popUpImg(URL, x, y) { 
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+x+",height="+y+",left = 415,top = 312');");
}
function checkoutForm(x){
err="";
	if(x.firstname.value==""){
		err=err+"\nFirstname";
	}	
	if(x.surname.value==""){
		err=err+"\nSurname";
	}	
	if(x.email.value==""){
		err=err+"\nEmail";
	}	
	if(x.postcode.value==""){
		err=err+"\nPost Code";
	}	
	if(x.address1.value==""){
		err=err+"\nAddress";
	}	
	if(x.town.value==""){
		err=err+"\nTown";
	}	
	if(x.county.value==""){
		err=err+"\nCounty";
	}
	
	if(err!=""){
	alert("Please complete the following fields:" + err);
		return false;
	}else{
		return true;
	}
	
	}
	
	
	
function findBillAddress(inputString)
{
	if (inputString != ''){
		// disable the button
		toggleFormButton(true);
		// clear the form
		clearform();
		// submit the form and data
	    document.GBillForm.inputString.value = inputString;
		document.GBillForm.submit();
	}else{
		alert("Please enter your postal code");	
	}
}

function findDelAddress(inputString)
{
	if (inputString != ''){
		// disable the button
		toggleFormButtonDel(true);
		// clear the form
		//clearform();
		// submit the form and data
	    document.GDelForm.inputString.value = inputString;
		document.GDelForm.submit();
	}else{
		alert("Please enter your postal code");	
	}
}
function toggleFormButton(status) {
	var theform = document.checkout;
	if (document.all || document.getElementById) {
		var tempobj = theform.searchbutton;
		if (status == true)
			tempobj.value = 'Searching...';
		else
			tempobj.value = 'Find Address';	
			document.getElementById('postcodeover').style.visibility = 'visible';
			document.getElementById('postcodetext').style.visibility = 'visible';
		//tempobj.disabled = status;
	}
}

function toggleFormButtonDel(status) {
	var theform = document.checkout;
	if (document.all || document.getElementById) {
		var tempobj = theform.searchbuttondel;
		if (status == true)
			tempobj.value = 'Searching...';
		else
			tempobj.value = 'Find Address';	
			document.getElementById('postcodeoverdel').style.visibility = 'visible';
			document.getElementById('postcodetextdel').style.visibility = 'visible';
		//tempobj.disabled = status;
	}
}
function clearform(){
	var theform = document.checkout;
	//theform.organisation.value="";
	theform.address1.value="";
	theform.address2.value="";
	theform.address3.value="";
	theform.address4.value="";
	theform.town.value="";
	theform.county.value="";
	//theform.postcode.value="";
}