<!--
function textfieldOnblur(target,obj,defaultTxt){
	if(target.value == defaultTxt || target.value == ""){
		target.value = obj;
	}
}

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_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_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 popupLaunch(popUrl){
	newWindow=window.open(popUrl,'newWin','toolbar=no');
	//newWindow.focus();
}

if (document.getElementById){
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('.submenuSub{display: none;}\n')
	document.write('</style>\n')
}

function menuControl(parent,childId,url){
	/*
	© Exentrix Ltd 2004. All rights reserved. "Cascading Menu Control" Function Developed by Imran Khan.
	*/
	if(document.getElementById){
		var parentObj = document.getElementById(parent);
		var parentDivContent = document.getElementById("masterdiv").getElementsByTagName("span");
		if(parent){
			if(parentObj.style.display != "block"){
				for (i=0; i<parentDivContent.length; i++){
					if (parentDivContent[i].className=="submenu"){
						parentDivContent[i].style.display = "none";
					}
				}

				parentObj.style.display = "block";
			}
			else{
				if(!childId){
					parentObj.style.display = "none";
				}
			}
		}
		if(childId && document.getElementById(childId)){
			var childObj = document.getElementById(childId);
			var childDivContent = document.getElementById("masterdiv").getElementsByTagName("span");
			if(childObj.style.display != "block"){
				//var ikfeedback = '';
				for(x=0; x<childDivContent.length; x++){
					if (childDivContent[x].className=="submenuSub"){
						childDivContent[x].style.display = "none";
						//ikfeedback = ikfeedback + childDivContent[x].id + ', ';
					}
				}
				//alert(ikfeedback);
				childObj.style.display = "block";
			}
			else{
				childObj.style.display = "none";
			}
		}
	}
	
	if(url){
		window.location.href = 'shop.php?id_cat='+ url +'&sectionName=';
	}
}

function LiveConnect(flashId,varName,args){
   document[flashId].SetVariable(varName, args);
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '£' + num + '.' + cents);
}


function deliveryPrice(){
	totalInCart = Number(document.formCheckout.totInCart.value)-1;
	deliveryCostPerUnit = Number(document.formCheckout.deliveryType.value);
	discountDelivery = Number(deliveryCostPerUnit) * Number(totalInCart)/2;
	fullDelivery = Number(deliveryCostPerUnit) * 1;
	totalDeliveryCost = Number(discountDelivery) + Number(fullDelivery);
	//alert(totalDeliveryCost);
	document.formCheckout.delivery.value = formatCurrency(totalDeliveryCost);
	//document.formCheckout.totalPriceBox.value = formatCurrency(Number(document.formCheckout.deliveryType.value) + Number(document.formCheckout.defaultTotalPrice.value));
	document.formCheckout.totalPriceBox.value = formatCurrency(totalDeliveryCost + Number(document.formCheckout.defaultTotalPrice.value));		
}

function changeCountry(){
	//alert(document.formCheckout.country.options[document.formCheckout.country.selected.value].value);
	if(document.formCheckout.country.value=="United Kingdom"){
		document.getElementById('deliveryType').selectedIndex = 0;
		deliveryPrice();
	}
	else{
		document.getElementById('deliveryType').selectedIndex = 1;
		deliveryPrice();
		//alert(document.formCheckout.country.value);
	}
}

function changeHat(){
	//window.location.assign('store_item_details.php?id_prod='+id_prod); 
	document.changeHatForm.submit();
}

function shop_swap_preview(target,src,id_prodimg, bigImg) {
	document.targetImg.src= src;
	document.tempVar.id_prodimg.value = id_prodimg;
	document.tempVar.imgPop.value = bigImg;
	//alert(document.tempVar.imgPop.value);
}


function itemPreview(status){
	if(status=='hide'){
		//document.getElementById("targetImg").src = "images/spacer.gif";
		//document.getElementById("imgPreview").style.visibility = "hidden";
		document.getElementById("imgPreview").style.display = "none";
		for (var i=0; i<document.all.length; i++) {
		 o = document.all(i)
		 if (o.type == 'select-one' || o.type == 'select-multiple') {
		  // todo: add check for select in div?
		  if (o.style) o.style.display = 'inline';
		 }
		}
	}
	else{
		document.getElementById("targetImgBig").src = document.tempVar.imgPop.value;		
		image_1 = new Image();
		image_1.src = document.tempVar.imgPop.value;
		
		//document.getElementById("imgPreview").style.visibility = "visible";
		document.getElementById("imgPreview").style.display = "block";
			//document.getElementById("imgPreview").style.width = image_1.width + 28;
			//document.getElementById("imgPreview").style.height = image_1.height + 28;
			for (var i=0; i<document.all.length; i++) {
			 o = document.all(i)
			 if (o.type == 'select-one' || o.type == 'select-multiple') {
			  // todo: add check for select in div?
			  if (o.style) o.style.display = 'none';
			 }
			}
			//alert(document.getElementById("imgPreview").style.width);

	}
}
//-->