bVer = parseInt(navigator.appVersion);
if (!((navigator.appVersion.indexOf("MSIE") == -1)&&(navigator.appVersion.substring(0,3)-4.8<0))){
	sOut="";
	document.write("<style>");
	if (!(navigator.appVersion.indexOf("MSIE") == -1)) {
		document.write("div.localmenu {	width:133px; }");			
		document.write("div.rightcol {	width:551px; }");			
	} else {
		document.write("div.localmenu {	width:133px; }");			
		document.write("div.rightcol {	width:551px; }");			
	}
	document.write("div.localmenu {	margin: 30px 35px 30px 7px; }");
	document.write(".menu {background-image:url(../graphics4/a_up.gif);background-repeat:no-repeat;background-position:left; }");
	document.write(".menuselected {background-image:url(../graphics4/a_ov.gif);background-repeat:no-repeat;background-position:left; }");
	document.write("</style>");
} else {
//netscape <4.8 on PC
	sOut="This site works best with modern browsers. Some features may not work properly with Netscape 4.x. ";			
	document.write("<style>");
	document.write("div.localmenu {	width:133px; }");			
	document.write("div.rightcol {	width:551px }");			
	document.write("</style>");
}
function getObject(sID) {
if (document.layers) {
return document.layers[sID];
} else if (document.all) {
return document.all(sID).style;
} else if (document.getElementById) {
return document.getElementById(sID).style;
}
}

/* Function that swaps images. */
function di20(id, newSrc) {
var theImage = FWFindImage(document, id, 0);
if (theImage) {
theImage.src = newSrc;
}
}
/* Functions that track and set toggle group button states. */
function FWFindImage(doc, name, j) {
var theImage = false;
if (doc.images) {
theImage = doc.images[name];
}
if (theImage) {
return theImage;
}
if (doc.layers) {
for (j = 0; j < doc.layers.length; j++) {
theImage = FWFindImage(doc.layers[j].document, name, 0);
if (theImage) {
return (theImage);
}
}
}
return (false);
}

function makenumeric(strIn){
	s="";
	for (i=0;i<strIn.length;i++){
		c=strIn.charAt(i);
		if ((c=="1")||(c=="2")||(c=="3")||(c=="4")||(c=="5")||(c=="6")||(c=="7")||(c=="8")||(c=="9")||(c=="0")||(c==".")) s+=c;
	}
	if (s.length==0)s="0";
	return s;
}
function checknumber(sIn,sError){
	sIn.value=makenumeric(sIn.value);
	if (sIn.value==""){
		alert("Please enter "+sError+" then click 'Next' again.");
		return false;
	}
	else if (isNaN(parseFloat(sIn.value))) {
		alert("Please enter "+sError+" as a number ONLY then click 'Next' again.");
		return false;
	}
	return true;
}

function checklimits(sIn,sError,iMin,iMax){
	if (parseFloat(sIn.value)<iMin){
		alert("The "+sError+" must be higher than "+iMin+".");
		return false;
	}
	else if (parseFloat(sIn.value)>iMax) {
		alert("The "+sError+" must be less than "+iMax+".");
		return false;
	}
	return true;
}

function isempty(sIn,sError){
	if (sIn.value==""){
		alert("Please enter "+sError+" then click 'Next' again.");
		return false;
	}
	return true;
}
function checkemail(email){
	if(email.length < 7){
		alert("Your Email address does not appear long enough. Please fill it in then submit again.");
		return false;
	}
	else if(email.indexOf("@") == -1){
		alert("Your Email address does not appear well-formed. Please fill it in then submit again.");
		return false;
	}
	else if(email.indexOf("@") > email.lastIndexOf(".")){
		alert("Your Email address does not appear well-formed. Please fill it in then submit again.");
		return false;
	}

	return true;
}
function replaceString(sSrc, sFrom, sTo){
	sReturn=sSrc;
    iFromLen=sFrom.length;
    iToLen=sTo.length;
    iPos=0;
    iEnd=0;
    do {
        iPos=sReturn.indexOf(sFrom,iEnd);
        if (iPos!=-1) {
            sReturn = sReturn.substring(0,iPos)+sTo+sReturn.substring(iPos+iFromLen);
            iEnd=iPos+iToLen;
        }
    } while (iPos!=-1);
	return sReturn;

}
function readCookie(Name) {

var cookies = ' ' + document.cookie;
if (cookies.indexOf(' ' + Name + '=') == -1) return null;

var start = cookies.indexOf(' ' + Name + '=') + (Name.length + 2);
var finish = cookies.substring(start,cookies.length);
finish = (finish.indexOf(';') == -1) ? cookies.length : start + finish.indexOf(';');

return unescape(cookies.substring(start,finish));
}

function makeCookie(Name,Value,Expiry,Path,Domain,Secure) {
//if you want to save the cookie
if (Expiry != null && !isNaN(Expiry)) {
	var datenow = new Date();
	datenow.setTime(datenow.getTime() + 86400000*Expiry);
	Expiry = datenow.toGMTString();
//	alert(Expiry);
}
Expiry = (Expiry) ? '; expires='+Expiry : '';
Path = (Path)?'; path='+Path:'';
Domain = (Domain) ? '; domain='+Domain : '';
Secure = (Secure) ? '; secure' : '';

document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;

}
function addToBasket(sID,qty){
	removeFromBasket(sID);
	var sTemp=readCookie("basket");
	if (sTemp==null) sTemp="";
	sTemp=sTemp+","+sID+"|"+qty;
	makeCookie("basket",sTemp,365,'','',false);
}

function removeFromBasket(sID){
	var sFind=","+sID+"|";
	var sTemp=readCookie("basket")+"";
	var start=sTemp.indexOf(sFind);
	var finish = sTemp.substring(start+1,sTemp.length);
	if (finish.indexOf(',') == -1){
		if (start!=-1){
			sTemp=sTemp.substring(0,start);
		}
	}
	else {
		if (start!=-1){
			sTemp=sTemp.substring(0,start)+sTemp.substring(start + finish.indexOf(',')+1,sTemp.length);
		}
	}
	makeCookie("basket",sTemp,365,'','',false);
}
function emptyBasket(){
	makeCookie("basket","",365,'','',false);
	window.location.reload();
}

function moveCookie(sFrom,sTo){
	var sTemp=readCookie(sFrom);
	if (sTemp==null) sTemp="";
	makeCookie(sTo,sTemp,365,'','',false);
	makeCookie(sFrom,"",365,'','',false);
}

function popJerry(){
	var w = window.open("","_new","width=515,height=500,scrollbars=yes");
	w.location.href="jerrypop.htm";
	w.focus();
}

function popBogof(){
	var w = window.open("","_new","width=330,height=360,scrollbars=no");
	w.location.href="bogofpop.htm";
	w.focus();
}

function popBG1(){
	var w = window.open("","_new","width=760,height=372,scrollbars=no");
	w.location.href="bgpop1.htm";
	w.focus();
}
function popBG2(){
	var w = window.open("","_new","width=590,height=430,scrollbars=no");
	w.location.href="bgpop2.htm";
	w.focus();
}
function popVoucher(){
	var w = window.open("","_new","width=520,height=600,scrollbars=no");
	w.location.href="vouchers.htm";
	w.focus();
}