
function refineSearch()
{
	// Refine search based on selected criteria	
	document.frmSearch.submit();
}

function goSearch()
{
	// Fire off search
	document.frmSearch.hdnSubmit.value = 1;
	document.frmSearch.submit();
}

function goLogin()
{
	if (testIsBlank(document.frmLogin.txtUsername.value) == true)
	{
		alert("You must enter a Username");
		document.frmLogin.txtUsername.focus();
		return false;
	}
	
	if (testIsBlank(document.frmLogin.txtPassword.value) == true)
	{
		alert("You must enter a Password");
		document.frmLogin.txtPassword.focus();
		return false;
	}

	document.frmLogin.submit();
}

function goRegister()
{
	if (testIsBlank(document.frmRegister.txtFirstName.value) == true)
	{
		alert("You must enter a First Name");
		document.frmRegister.txtFirstName.focus();
		return false;
	}
	
	if (testIsBlank(document.frmRegister.txtLastName.value) == true)
	{
		alert("You must enter a Surname");
		document.frmRegister.txtLastName.focus();
		return false;
	}
	
	if (testIsBlank(document.frmRegister.txtEmail.value) == true)
	{
		alert("You must enter an Email Address");
		document.frmRegister.txtEmail.focus();
		return false;
	}
	
	if (testIsBlank(document.frmRegister.txtTel.value) == true)
	{
		alert("You must enter a Telephone Number");
		document.frmRegister.txtTel.focus();
		return false;
	}
	
	document.frmRegister.submit();
}

function goPassword()
{
	if (testIsBlank(document.frmPassword.txtPassword.value) == true)
	{
		alert("You must enter a Password");
		document.frmPassword.txtPassword.focus();
		return false;
	}
	
	if (testIsBlank(document.frmPassword.txtConfirm.value) == true)
	{
		alert("You must confirm your Password");
		document.frmPassword.txtConfirm.focus();
		return false;
	}
	
	if (document.frmPassword.txtPassword.value != document.frmPassword.txtConfirm.value)
	{
		alert("Please confirm your new Password");
		document.frmPassword.txtConfirm.focus();
		return false;
	}
	
	document.frmPassword.submit();
}

function goPwRequest()
{
	if (testIsBlank(document.frmLogin.txtEmail.value) == true)
	{
		alert("You must enter your Email Address");
		document.frmLogin.txtEmail.focus();
		return false;
	}

	document.frmLogin.submit();
}

function goCheckout()
{
	if (testIsBlank(document.frmBasket.txtFirstName.value) == true)
	{
		alert("You must enter a First Name");
		document.frmBasket.txtFirstName.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtLastName.value) == true)
	{
		alert("You must enter a Surname");
		document.frmBasket.txtLastName.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtAddress1.value) == true)
	{
		alert("You must enter Address 1");
		document.frmBasket.txtAddress1.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtAddress3.value) == true)
	{
		alert("You must enter a Town/City");
		document.frmBasket.txtAddress3.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtAddress4.value) == true)
	{
		alert("You must enter a County/State");
		document.frmBasket.txtAddress4.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtAddress5.value) == true)
	{
		alert("You must enter a Postcode/Zipcode");
		document.frmBasket.txtAddress5.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtEmail.value) == true)
	{
		alert("You must enter an Email Address");
		document.frmBasket.txtEmail.focus();
		return false;
	}
	
	if (testIsBlank(document.frmBasket.txtTel.value) == true)
	{
		alert("You must enter a Telephone Number");
		document.frmBasket.txtTel.focus();
		return false;
	}
	
	document.frmBasket.submit();
}

function goContact()
{
	if (testIsBlank(document.frmForm.Name.value) == true)
	{
		alert("You must enter a Name");
		document.frmForm.Name.focus();
		return false;
	}
	
	if (testIsBlank(document.frmForm.Email.value) == true)
	{
		alert("You must enter an Email Address");
		document.frmForm.Email.focus();
		return false;
	}
	
	if (testIsBlank(document.frmForm.Telephone.value) == true)
	{
		alert("You must enter a Telephone Number");
		document.frmForm.Telephone.focus();
		return false;
	}

	document.frmForm.submit();
}

function printPage()
{
	// open new window to display print version of the page
	// Get current page URL
	strUrl = window.location.href;
	
	// Add print parameter
	if (strUrl.indexOf(".asp?") > 0)
		strUrl = strUrl + "&Print=true";
	else
		strUrl = strUrl + "?Print=true";
	
	intLeft = (screen.availWidth - 310)/2;
	intTop = (screen.availHeight - 500)/2;
	winPrint = window.open(strUrl, 'winPrint', 'status=no,resizable=no,scrollbars=yes,width=310,height=500,left=' + intLeft + ',top=' + intTop + '');
}

function openTrackIt(strTrackCode)
{
	strUrl = "http://www.parceline.com/cgi-bin/SaCGI.cgi/plguest.exe?FNC=getConsignment__Aguest___Consignment=";
	strUrl = strUrl + strTrackCode;
	strUrl = strUrl + "___BGCOLOR=FFFFFF___TEXT=000000___FONTFACE=verdana___LINK=000000___VLINK=000000";
	
	intLeft = (screen.availWidth - 600)/2;
	intTop = (screen.availHeight - 350)/2;
	winTrack = window.open(strUrl, 'winTrack', 'status=no,resizable=no,scrollbars=yes,width=600,height=350,left=' + intLeft + ',top=' + intTop + '');
}

function testIsBlank(strValue)
{
	for(i = 0; i < strValue.length; i++)
 		{
		var c = strValue.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t'))
			return false;
	}
	return true;
}

// MACROMEDIA function from DREAMWEAVER

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) { //v3.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); 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 disableEnterKey(e)
{
     var key;      
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox      

     return (key != 13);
}