<!--
// JavaScript Document

function addToCart(frm)
{
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth - 208; // position left
	var t = midScreenHeight - 150; // position top
	var quantity = frm.quantity.value;
	var product = frm.product.value;
	var originTable = frm.originTable.value;
	var charlen = quantity.length + product.length + originTable.length;
	var winFeatures = ("width=416,height=350,left="+l+",top="+t+",scrollbars=1,resizeable=1");
	var winURL = "addcart.asp?cartaction=add&product="+product+"&quantity="+quantity+"&originTable="+originTable+"&charlen="+charlen;
	
	if(!popWin || popWin.closed)
	{
  		popWin = window.open(winURL, 'popWin', winFeatures);
 	}
 	else
	{
  		popWin.location = winURL;
  		popWin.focus();
 	}
	//window.opener.location.reload();
}

function moreInfo(frm)
{
	frm = eval("document['"+frm+"']")
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth - 208; // position left
	var t = midScreenHeight - 280; // position top
	var product = frm.product.value;
	var winFeatures = ("width=416,height=575,left="+l+",top="+t+",scrollbars=1,resizeable=1");
	var winURL = "moreinfo.asp?id="+product;
	
	if(!popWin || popWin.closed)
	{
  		popWin = window.open(winURL, 'popWin', winFeatures);
 	}
 	else
	{
  		popWin.location = winURL;
  		popWin.focus();
 	}
}

function moreInfoLink(prodCode)
{
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth - 208; // position left
	var t = midScreenHeight - 280; // position top
	var product = prodCode;
	var winFeatures = ("width=416,height=575,left="+l+",top="+t+",scrollbars=1,resizeable=1");
	var winURL = "moreinfo.asp?id="+product;
  	var	popWin = window.open(winURL, 'popWin', winFeatures);
  	popWin.focus();
}

function productInKit(productCode)
{
	//frm = eval("document['"+frm+"']")
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth + 218; // position left
	if ((l + 260) > (screen.availWidth))
	{
		l = screen.availWidth - 270;
	}
	var t = midScreenHeight - 200; // position top
	var product = productCode;
	var winFeatures = ("width=260,height=400,left="+l+",top="+t+",scrollbars=1,resizeable=1");
	var winURL = "productkit.asp?id="+product;
	
	popWin2 = window.open(winURL, 'popWin2', winFeatures);
 	popWin2.focus();
}

//----------------------------
// utility function to test for invalid input
//---------------------
function checkCartQuantities(frm)
{
	var elQuant, i;
	var upperLimit = (frm.productLines.value) - 1;
	for(i=1; i <= upperLimit; i++)
	{
		//alert(i);
		//alert(eval('frm.uQuantity'+i+'.value'));
		elQuant = eval('frm.uQuantity'+i);
		if (isNaN(elQuant.value) || elQuant.value < 1 || elQuant.value == "")
		{
			alert("Please enter a numeric value.");
			elQuant.select();
			return false;
		}/**/
	}
	return true;
}

function updateCartOnSubmit(frm)
{
	return checkCartQuantities(frm);
}

//end of shopping cart methods
function resizeBoxes2(){
if (document.cart.cartaction)
{
	if (document.cart.cartaction.value == "viewcart"){}
	if (document.cart.cartaction.value == "emptycart"){}
	if (document.cart.cartaction.value == "del"){}
	if (document.cart.cartaction.value == "checkout"){}
	if (document.cart.cartaction.value == "checkout2")
		{	
		if(nameCode==1 ){
			document.cart.bname.size=25;
			document.cart.bcompany.size=25;
			//document.cart.baddress.cols=24;
			document.cart.baddress.size=25;
			document.cart.baddress2.size=25;
			document.cart.btown.size=25;
			document.cart.bcounty.size=25;
			document.cart.bpostcode.size=10;
			document.cart.bemail.size=25;
			document.cart.btel.size=25;
			document.cart.bfax.size=25;}
		else if(versionCode>=5){
			document.cart.bname.size=25;
			document.cart.bcompany.size=25;
			//document.cart.baddress.cols=24;
			document.cart.baddress.size=25;
			document.cart.baddress2.size=25;
			document.cart.btown.size=25;
			document.cart.bcounty.size=25;
			document.cart.bpostcode.size=10;
			document.cart.bemail.size=25;
			document.cart.btel.size=25;
			document.cart.bfax.size=25;}
	}
	if (document.cart.cartaction.value == "checkout3")
	{	
		if(nameCode==1 ){
			document.cart.dname.size=25;
			//document.cart.daddress.cols=24;
			document.cart.daddress.size=25;
			document.cart.daddress2.size=25;
			document.cart.dtown.size=25;
			document.cart.dcounty.size=25;
			document.cart.dpostcode.size=10;
			document.cart.dtel.size=25;}
		else if(versionCode>=5){
			document.cart.dname.size=25;
			//document.cart.daddress.cols=24;
			document.cart.daddress.size=25;
			document.cart.daddress2.size=25;
			document.cart.dtown.size=25;
			document.cart.dcounty.size=25;
			document.cart.dpostcode.size=10;
			document.cart.dtel.size=25;}
	}
	if (document.cart.cartaction.value == "checkout4")
	{	
		if(nameCode==1 ){
			document.cart.comments.cols=20;}
		else if(versionCode>=5){
			document.cart.comments.cols=20;}
	}
	if (document.cart.cartaction.value == "processemail")
	{	
		if (document.cart.bemail){
			if(nameCode==1 ){
				document.cart.bemail.size=25;}
			else if(versionCode>=5){
				document.cart.bemail.size=25;}
		}
	}
	if (document.cart.cartaction.value == "thankyou"){}
	if (document.cart.cartaction.value == "printShopCart"){}
	if (document.cart.cartaction.value == "processemail"){}
}
}

var popWin = null;
function popUp(popUrl, popWinName, popWidth, popHeight)
{
 if(!popWin || popWin.closed) {
  popWin = window.open(popUrl, popWinName,
config="width="+popWidth+",height="+popHeight+",scrollbars=yes,resizable=yes");
 }
 else {
  popWin.location = popUrl;
  popWin.resizeTo(popWidth, popHeight);
  popWin.focus();
 }
}

function bvalid(){
var submit_me=0;
var my_form=document.cart;
if(my_form.bname.value=="" || my_form.bname.value==" "){
	alert("Please enter your name.");
	my_form.bname.focus();
	submit_me=1;}
if((my_form.baddress.value=="" || my_form.baddress.value==" ") && submit_me==0){
	alert("Please enter your address.");
	my_form.baddress.focus();
	submit_me=1;}
if((my_form.btown.value=="" || my_form.btown.value==" ") && submit_me==0){
	alert("Please enter your town name.");
	my_form.btown.focus();
	submit_me=1;}
if((my_form.bpostcode.value=="" || my_form.bpostcode.value==" ") && submit_me==0){
	alert("Please enter your postcode.");
	my_form.bpostcode.focus();
	submit_me=1;}	
if((my_form.btel.value=="" || my_form.btel.value==" ") && submit_me==0){
	alert("Please enter your telephone number.");
	my_form.btel.focus();
	submit_me=1;}		
if(my_form.bemail.value=="")
{
	//this is ok, offline payment
}
else
{
	if(notValidEmail(my_form.bemail.value) && submit_me==0){
		alert("Please enter a valid e-mail address.")
		my_form.bemail.select();
		submit_me=1;}
}
if(submit_me==0){my_form.submit();}
}

function dvalid(){
var submit_me=0;
var my_form=document.cart;
if(my_form.dname.value=="" || my_form.dname.value==" "){
	alert("Please enter your name.");
	my_form.dname.focus();
	submit_me=1;}
if((my_form.daddress.value=="" || my_form.daddress.value==" ") && submit_me==0){
	alert("Please enter your address.");
	my_form.daddress.focus();
	submit_me=1;}
if((my_form.dtown.value=="" || my_form.dtown.value==" ") && submit_me==0){
	alert("Please enter your town name.");
	my_form.dtown.focus();
	submit_me=1;}
if((my_form.dpostcode.value=="" || my_form.dpostcode.value==" ") && submit_me==0){
	alert("Please enter your postcode.");
	my_form.dpostcode.focus();
	submit_me=1;}	
if((my_form.dtel.value=="" || my_form.dtel.value==" ") && submit_me==0){
	alert("Please enter your telephone number.");
	my_form.dtel.focus();
	submit_me=1;}
if(submit_me==0){my_form.submit();}
}

function notValidEmail(pString){
var dotpos=pString.indexOf('.');
var atpos=pString.indexOf('@');
	if(atpos == -1 || (pString=="") || (pString==" ") || (pString.length < 6)){
		return true;
	}
	else if(dotpos + 1 == atpos){
		return true;
	}
	else{
		var emailterm=pString.substring(atpos, (pString.length));
		if(emailterm.indexOf('.')==-1 || emailterm.length < 2){
			return true;}
		else return false;
	}

}

/*
This script is written by Eric (Webcrawl@usa.net)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function printit(){  
if (window.print) {
		window.print() ;  
	} else {
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}
//-->
