



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.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
if (document.forms[0]&&document.forms[0].hidden){
if (document.forms[0].hidden.value!=MM_swapImage.arguments[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];}}}else{
  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 change(item,image){
	document.all['winebeer'].src='images/nav/winebeer.gif';
	document.all['fruitveg'].src='images/nav/fruit_veg.gif';
	document.all['deli'].src='images/nav/deli.gif';
	document.all['meat'].src='images/nav/quality_meat.gif';
	document.all['bakery'].src='images/nav/bakery.gif';
	document.all['dairy'].src='images/nav/chilled_dairy.gif';
	document.all['frozen'].src='images/nav/frozen_foods.gif';
	document.all['nuts'].src='images/nav/nuts.gif';
		document.all['dietary'].src='images/nav/dietaryNew.gif';
	document.all['grocery'].src='images/nav/grocery_food.gif';
	document.all['grocery2'].src='images/nav/grocery_non_food.gif';
	document.all['personalcare'].src='images/nav/personal_care.gif';
	document.all['baby'].src='images/nav/baby_needs.gif';
	document.all['variety'].src='images/nav/variety.gif';
	document.all['pets'].src='images/nav/petfoods.gif';
	document.all['members'].src='images/nav/quickshop.gif';

	document.all[item].src=image;
	document.forms[0].hidden.value=item;
}

function on(item,id){
	document.all[id].src='images/'+item+'_on.gif';
}

function off(item,id){
	document.all[id].src='images/'+item+'.gif';
}

function up(id){
	document.forms[id].q.value=parseInt(document.forms[id].q.value)+1;
}

function down(id){
	if (parseInt(document.forms[id].q.value)>1){
		document.forms[id].q.value=parseInt(document.forms[id].q.value)-1;
	}
}

function add(id){
	//if (document.all['tr'+id]){
	//	document.all['tr'+id].style.backgroundColor='#F4FCFF';
	//}
	document.forms[id].action = 'trolley.php?f=ADD';
	//document.forms[id].submit();
	top.trolley.document.location.href='trolley.php?f=ADD&id='+document.forms[id].id.value+'&q='+document.forms[id].q.value;
}

function addPopup(id){
	//document.forms[id].action = 'trolley.php?f=ADD';
	//alert('Got here ... '+document.forms[id].id.value+', '+document.forms[id].q.value);
	window.opener.parent.trolley.document.location.href='trolley.php?f=ADD&id='+document.forms[id].id.value+'&q='+document.forms[id].q.value;
	window.close();
}

function fav(id){
	//if (document.all['tr'+id]){
	//	document.all['tr'+id].style.backgroundColor='#FFF8F5';
	//}
	document.forms[id].action = 'trolley.php?f=FAV';
	//document.forms[id].submit();
	top.trolley.document.location.href='trolley.php?f=FAV&id='+document.forms[id].id.value+'&q='+document.forms[id].q.value;
}

function fav2(id){
	document.forms[id].action = 'trolley.php?f=FAV';
	document.forms[id].submit();
}

function favdel(id){
	document.forms[id].action = 'trolley.php?f=FAVDEL';
	document.forms[id].submit();
}

function checkoutUpdate(i){
	document.forms[0].action = 'checkout_2.php?f=UPDATE';
	document.forms[0].submit();
}

function checkoutConfirm(i){
	document.forms[0].action = 'checkout_3.php?f=CONFIRM';
	document.forms[0].submit();
}

function historyAdd(id){
	document.forms[0].action = 'trolley.php?f=HISTORY&id='+id;
	document.forms[0].submit();
}


function toggle(id){
	if (document.all){
		if(document.all[id].style.display == 'none'){
			document.all[id].style.display = '';
		}else{
			document.all[id].style.display = 'none';
		}
		return false;
	} else if (document.getElementById){
		if(document.getElementById(id).style.display == 'none'){
			document.getElementById(id).style.display = 'block'
		} else {
			document.getElementById(id).style.display = 'none';
		}
		return false;
	}
}

function showProduct(id){
//var location = top.categories.location.href;
//if (location.indexOf('productdetails.php')<0){
//	parent.nav.document.all['hiddenRedirect'].value=location;
//}
//parent.categories.location.href='productdetails.php?id='+id;
top.categories.document.all['hiddenIframe'].src='productdetails.php?id='+id;
top.categories.document.all['hiddenLayer'].style.top = top.categories.document.body.scrollTop;
top.categories.document.all['hiddenLayer'].style.visibility='visible';
top.categories.document.all['hiddenLayer2'].style.visibility='visible';
top.categories.document.all['hiddenLayer2'].style.height = top.categories.document.body.scrollHeight;
}

function showDelivery(postcode){
if (postcode != ''){
	top.categories.document.all['hiddenIframe'].src='postcode_new.php?postcode='+postcode;
	top.categories.document.all['hiddenLayer'].style.top = top.categories.document.body.scrollTop;
	top.categories.document.all['hiddenLayer'].style.visibility='visible';
	top.categories.document.all['hiddenLayer2'].style.visibility='visible';
	top.categories.document.all['hiddenLayer2'].style.height = top.categories.document.body.scrollHeight;
}else{
	alert('Please enter postcode');
}
}

function backProduct(){
//var location = parent.nav.document.all['hiddenRedirect'].value;
//	if (location.indexOf('member_options.php')<0){
//		top.categories.location.href=parent.nav.document.all['hiddenRedirect'].value;
//	}else{
//		top.categories.location.href='member_options.php?redirect=no';
//	}
top.categories.document.all['hiddenLayer'].style.visibility='hidden';
top.categories.document.all['hiddenLayer2'].style.visibility='hidden';
top.categories.document.all['hiddenIframe'].src='';
}

function checkHeight(){
if (top.categories.document.all['hiddenLayer'].style.visibility=='visible'){
top.categories.document.all['hiddenLayer'].style.top = top.categories.document.body.scrollTop;
}
}




function right(e) {
var msg = "Tip: Try a LEFT CLICK. \nThis site (including but not limited to its images) is Copyright (C) Banana Blue.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap()
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }


