function AdviceWindow(SID)
{
  window.open("/Store/Advice.html?SID="+SID+"","ListWindow","width=500,height=600,scrollbars")
}

function TermsWindow(SID)
{
  window.open("/Store/Terms.html?SID="+SID+"","ListWindow","width=500,height=600,scrollbars")
}

function RemoveItem(CartID,PID)
{
	window.location.replace("RemoveItemFromCart.html?ID="+CartID+"&PID="+PID)
}
function ClearTrolley(PBA)
{
  window.location.replace("RemoveAllItemsFromCart.html")
}

function SubmitDisplayItemsForm(Phil)
{
	if (document.form1.Variation.selectedIndex==0)
	{
		alert("Please choose which item you want to add");
	}

	else
	{
			document.form1.submit();
	}
}

function openclose(which){
	var ie5=document.all&&document.getElementById
	var ns6=document.getElementById&&!document.all

	if(ie5){
		if(document.getElementById(which).style.display!='block'){
			document.getElementById(which).style.display='block';
				}
				else{
					document.getElementById(which).style.display='none';
				}
	}
	if(ns6){
		if(document.getElementById(which).style.display!='table-row'){
			document.getElementById(which).style.display='table-row';
				}
				else{
					document.getElementById(which).style.display='none';
				}
	}

}
function PBA_swapImage(a,b,c,d,e,f)
{
	MM_swapImage(a,b,c,d)
  document.ProductImage.height=140;
  document.ProductImage.width=140;
}

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 jump(fe)
{
	var opt_key = fe.selectedIndex;
	var uri_val = fe.options[opt_key].value;
	window.open(uri_val,'_self');
	return true;
}
function NewWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}
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 SCCheckFields()
{
	var themessage = "You must fill out the following fields: ";
	if (document.form2.Email.value=="")
	{
		themessage = themessage + "\nYour email address";
	}

//alert if fields are empty and cancel form submit

	if (themessage == "You must fill out the following fields: ")
	{
		document.form2.Submit2.disabled=true;
		document.form2.submit();
		return true;
	}
	else
	{
		alert(themessage);
		return false;
   }
}

function SRS1VerifyForm()
{
var themessage = "You are required to complete the following fields: ";
	if (document.SubmitMe.LastName.value=="")
	{
		themessage = themessage + " \nLast name";
	}
	if (document.SubmitMe.Email.value=="")
	{
		themessage = themessage + " \nEmail address";
	}
	if (document.SubmitMe.Address1.value=="")
	{
	themessage = themessage + " \nAddress line 1";
	}
	if (document.SubmitMe.Town.value=="")
	{
		themessage = themessage + " \nTown";
	}
	if (document.SubmitMe.PostCode.value=="")
	{
		themessage = themessage + " \nPostcode / Zipcode";
	}
	if (document.SubmitMe.State.value=="")
	{
		themessage = themessage + " \nState / County / Region ";
	}
	if (document.SubmitMe.Password.value=="")
	{
		themessage = themessage + " \nPassword";
	}
	if (document.SubmitMe.CountryID[document.SubmitMe.CountryID.selectedIndex].value==0 )
	{
		themessage = themessage + " \nPlease select your Country.";
	}

	if (themessage == "You are required to complete the following fields: ")
	{
		document.SubmitMe.Submit.disabled=true;
		document.SubmitMe.submit();
		return true;
	}
	else
	{
		alert(themessage);
		return false;
	}
}

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 CSCS3heckFields()
{
	var themessage = "You must fill out the following fields: ";
	if (document.form2.Password.value=="")
	{
		themessage = themessage + "\nYour password";
	}
	if (document.form2.Email.value=="")
	{
		themessage = themessage + "\nYour email address";
	}

//alert if fields are empty and cancel form submit

	if (themessage == "You must fill out the following fields: ")
	{
		document.form2.Submit2.disabled=true;
		document.form2.submit();
		return true;
	}
	else
	{
		alert(themessage);
		return false;
   }
}

function SRS3CheckForgottenFields()
{
	var themessage2 = "You must fill out the following field: ";
	if (document.form1.Email.value=="")
	{
		themessage2 = themessage2 + "\nYour email in the forgotten password section.";
	}
//alert if fields are empty and cancel form submit
	if (themessage2 == "You must fill out the following field: ")
	{
		document.form1.Submit.disabled=true;
		document.form1.submit();
		return true;
	}
	else
	{
		alert(themessage2);
		return false;
	}
}

function EnterState()
{
	Value=document.SubmitMe.USStates.options[document.SubmitMe.USStates.selectedIndex].value;
	document.SubmitMe.State.value=Value;
}