<!--

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Confirm(title, confirm_text, url){
	var text = title + "\n";
	text += "----------------------------------------------------------------\n";
	text += confirm_text + "\n";
	text += "----------------------------------------------------------------\n";
	var doublecheck = confirm(text);
	if(doublecheck != true){
		return false;
	} else {
		document.location = url
	}
}

function showPopup(page,title,width,height,scrollbars){
	var strWindowURL = "popup.asp?section=" + page + "&title=" + title;
	var intWidth = 0;
	var intHeight = 0;
				
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		intWidth = document.body.clientWidth;
		intHeight = document.body.clientHeight;
	} else {
		intWidth = window.outerWidth;
		intHeight = window.outerHeight;
	}
	var intTop = 0;
	var intLeft = 0;
	var intResize  = 1; //0 = position specified above : 1 = dynamically positioned
	var intWindowWidth = width;
	var intWindowHeight = height;
	if(intResize == 1){
		intTop = ((intHeight - intWindowHeight) / 2);
		intLeft = ((intWidth - intWindowWidth) / 2);
	} else {
		intTop = 0;
		intLeft = 0;
	}
	var strWindowName = "Information";
	var strOptions = "toolbar=0" +
	",directories=0" +
	",status=0" +
	",menubar=0" +
	",resizable=no" +
	",scrollbars=" + scrollbars +
	",width=" + intWindowWidth +
	",height=" + intWindowHeight +
	",top=" + intTop +
	",left=" + intLeft;
	win2 = window.open(strWindowURL,strWindowName,strOptions);
	win2.focus();
}

function showProduct(id){

	var strText = "Expected delivery within 28 days";
	
	for (i = 0; i < arrProducts.length; i++){
		if (document.all||document.getElementById){
			obj = document.getElementById("cart_layer_" + arrProducts[i]);
		} else {
			obj = MM_findObj("cart_layer_" + arrProducts[i]);
		}
		if (obj != null){
			if (arrProducts[i] == id){
				v = "show";
				d = "block";
				if (obj.style){
					obj=obj.style;
					v=(v=='show')?'visible':(v='hide')?'hidden':v;
					obj.visibility=v;
					obj.display=d;
				}
	
				for (o = 0; o < arrProductOptions[i].length; o++){
					var arrOption = arrProductOptions[i][o].split("|");
					if (arrOption[1] == 'True'){
						strText = "Expected delivery within " + arrOption[4] + " day";
						if (parseInt(arrOption[4]) != 1){
							strText += "s";	
						}
					}
				}
				setText("cart_delivery_schedule_" + id,strText);
			
				MM_swapImage('large_image','','images/products/' + arrProductImages[i],1);
			} else {
				v = "hide";
				d = "none";
				if (obj.style){
					obj=obj.style;
					v=(v=='show')?'visible':(v='hide')?'hidden':v;
					obj.visibility=v;
					obj.display=d;
					//alert(v + "-" + d);
				}
			}
		}
	}
}

function changeOption(id,optionid){
	
	for (i = 0; i < arrProducts.length; i++){
		if(arrProducts[i] == id){
			for (o = 0; o < arrProductOptions[i].length; o++){
				var arrOption = arrProductOptions[i][o].split("|");
				if (parseInt(arrOption[0]) == optionid){
					strText = "Expected delivery within " + arrOption[4] + " day";
					if (parseInt(arrOption[4]) != 1){
						strText += "s";	
					}
					setText("cart_delivery_schedule_" + id,strText);
				}
			}
		}
	}
}

function changeProductOption(id){
	
	for (i = 0; i < arrProductOptions.length; i++){
		var arrOption = arrProductOptions[i].split("|");
		if (parseInt(arrOption[0]) == id){
			strText = "Expected delivery within " + arrOption[4] + " day";
			if (parseInt(arrOption[4]) != 1){
				strText += "s";	
			}
			setText("cart_delivery_schedule",strText);
		}
	}
}

var dblSubTotal = 0;

function updateShipping(id){
	
	for (i = 0; i < arrShippingOptions.length; i++){
		var arrOption = arrShippingOptions[i].split("|");
		if (arrOption[0] == id){
			dblTotal = dblSubTotal + parseFloat(arrOption[1]);
			dblTotal = formatPrice(dblTotal);
			setText("cart_shipping","&pound;" + arrOption[1]);
			setText("cart_total","&pound;" + dblTotal);
			break;
		}
	}
}

function formatPrice(thisPrice){
	TPrice = String(thisPrice)
	if(TPrice.indexOf('.') == -1){
		TPrice += ".00"
	} else {
		tempPrice = TPrice.split(".");
		if(tempPrice[1].length == 2){
			TPrice = thisPrice;
		} else {
			if(tempPrice[1].length < 2){
				Filler = "";
				for(var i = tempPrice[1].length; i < 2; ++i){
					Filler += "0";
				}
				TPrice = tempPrice[0] + "." + tempPrice[1] + Filler;
			} else {
				if(tempPrice[1].substring(2,3) >= 5){
					var tempPence = 0;
					if(tempPrice[1].substring(1,2) >= 9){
						if(tempPrice[1].substring(0,1) >= 9){
							tempPence = 100;
						} else {
							tempPence = parseFloat(tempPrice[1].substring(0,1)) + 1;
						}
					} else {
						tempPence = String(tempPrice[1].substring(0,1));
						tempPence += parseFloat(tempPrice[1].substring(1,2)) + 1;
						if(tempPence.length < 2){
							Filler = "";
							for(var i = tempPence.length; i < 2; ++i){
								Filler += "0";
							}
							tempPence += Filler;
						}
					}
					if(tempPence >= 100){
						TPrice = parseFloat(tempPrice[0]) + 1;
						TPrice = String(TPrice)
						if(TPrice.indexOf('.') == -1){
							TPrice += ".00"
						} else {
							tempPrice = TPrice.split(".");
							if(tempPrice[1].length == 2){
								TPrice = thisPrice;
							} else {
								if(tempPrice[1].length < 2){
									Filler = "";
									for(var i = tempPrice[1].length; i < 2; ++i){
										Filler += "0";
									}
									TPrice = tempPrice[0] + "." + tempPrice[1] + Filler;
								}
							}
						}
					} else {
						TPrice = tempPrice[0] + "." + tempPence;
					}
				} else {
					TPrice = tempPrice[0] + "." + tempPrice[1].substring(0,2);
				}
			}
		}
	}
	return TPrice
}

function setText(id,strText){

	if (document.all||document.getElementById){
		obj = document.getElementById(id)
	} else {
		obj = MM_findObj(id)
	}
	obj.innerHTML = strText;	
}

function submitForm(objForm){
	document.forms[objForm].submit();	
}

function GoWindowURL(url, name, width, height){
	var strWindowURL = url
	var intWidth = 0;
	var intHeight = 0;
				
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		intWidth = document.body.clientWidth;
		intHeight = document.body.clientHeight;
	} else {
		intWidth = window.outerWidth;
		intHeight = window.outerHeight;
	}
	var intTop = 0;
	var intLeft = 0;
	var intResize  = 1; //0 = position specified above : 1 = dynamically positioned
	var intWindowWidth = width;
	var intWindowHeight = height;
	if(intResize == 1){
		intTop = ((intHeight - intWindowHeight) / 2);
		intLeft = ((intWidth - intWindowWidth) / 2);
	} else {
		intTop = 0;
		intLeft = 0;
	}
	var strWindowName = name;
	var strOptions = "toolbar=0" +
	",directories=0" +
	",status=0" +
	",menubar=0" +
	",resizable=no" +
	",scrollbars=yes" +
	",width=" + intWindowWidth +
	",height=" + intWindowHeight +
	",top=" + intTop +
	",left=" + intLeft;
	win2 = window.open(strWindowURL,strWindowName,strOptions);
	win2.focus();
}

function showTerms(){
		GoWindowURL('terms.asp?section=print', 'Terms', 800, 400);
}

function goBack(){
	history.go(-1);
}

//-->