	function PostcodeLookup() {

		var PostString = document.ContactDetails.postcode.value
		var PostString = PostString.Server.URLEncode(" ","")
		
		document.location = 'basket.asp?step=2&pc=' + PostString + '&hn=' + document.ContactDetails.flat.value ;
	}

	function PostcodeLookup2(URL) {

		var pcLookup;
		var pcWinAddress = URL;
		
		pcWinAddress += pcWinAddress + '?postcode=' + document.ContactDetails.postcode.value
		pcWinAddress += pcWinAddress + '&flat=' + document.ContactDetails.flat.value
		
		pcLookup = window.open(pcWinAddress,'Address found','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=390,height=400,left = 337,top = 284');
	}

	function VerifyColour(f)
	{
		
		if(f.colour.options[f.colour.selectedIndex].value == "")
		{
			alert("Please select a colour.")
			f.colour.focus();
			return false
		}
		
	}



	function QuickSearch(WkValue)
	{
		document.location = "http://www.westenddj.co.uk/productlist.asp?q=" + WkValue;
			
	}

	function SetMaxRecords    (WkFld,WkMk,WkC1,WkC2,WkC3,WkCol,WkPr,WkC0,WkRec,WkPg,WkSO,WkNO,WkCO,WkS)
	{
		document.location = "http://www.westenddj.co.uk/productlist.asp?mk=" + WkMk + "&C1=" + WkC1 + "&C2=" + WkC2 + "&C3=" + WkC3 + "&Col=" + WkCol + "&pr=" + WkPr + "&C0=" + WkC0 + "&rec=" + WkFld + "&pg=" + WkPg + "&so=" + WkSO + "&no=" + WkNO + "&co=" + WkCO + "&s=" + WkS ;
	}

	function SetOrder    (WkFld,WkMk,WkC1,WkC2,WkC3,WkCol,WkPr,WkC0,WkRec,WkPg,WkSO,WkNO,WkCO,WkS)
	{
		document.location = "http://www.westenddj.co.uk/productlist.asp?mk=" + WkMk + "&C1=" + WkC1 + "&C2=" + WkC2 + "&C3=" + WkC3 + "&Col=" + WkCol + "&pr=" + WkPr + "&C0=" + WkC0 + "&rec=" + WkRec + "&pg=" + WkPg + "&so=" + WkSO + "&no=" + WkNO + "&co=" + WkCO + "&s=" + WkFld ;
	}
	
	function SetFromTopForm()
	{
		var LocationString = "http://www.westenddj.co.uk/productlist.asp?" ;
		
		if(document.TopSearchForm.mk.options[document.TopSearchForm.mk.selectedIndex].value != "") {
			LocationString += "mk=" + document.TopSearchForm.mk.options[document.TopSearchForm.mk.selectedIndex].value; }
		else {
			LocationString += "mk="; }

		if(document.TopSearchForm.C1.options[document.TopSearchForm.C1.selectedIndex].value != "") {
			LocationString += "&C1=" + document.TopSearchForm.C1.options[document.TopSearchForm.C1.selectedIndex].value; }
		else {
			LocationString += "&C1="; }

		if(document.TopSearchForm.C2.options[document.TopSearchForm.C2.selectedIndex].value != "") {
			var tmpC2 = document.TopSearchForm.C2.options[document.TopSearchForm.C2.selectedIndex].value;
			var tmpC = tmpC2.split(";");
		
			if(tmpC[0] == "g1") {
				LocationString += "&C1=" + tmpC[1]; }
			else {
				LocationString += "&C2=" + tmpC[1]; } }
		else {
			LocationString += "&C2=" }

		document.location = LocationString;
	}

	function JumpToMake(WkEntry)

	{
		document.SearchForm.m.value = WkEntry;
		document.SearchForm.s.value = '<%= Request("s") %>';
		document.SearchForm.submit();	
	}

	function ChangeOrder(WkEntry)
	{
		document.SearchForm.s.value = WkEntry;
		document.SearchForm.m.value = '<%= Request("m") %>';
		document.SearchForm.submit();	
	}


function remove(index)
	{
		today = new Date();
		locstr = "add.asp?action=remove&time=" + today.getTime() + "&index="+index;
		document.location.replace(locstr);
	}

	function loadImages() {
		if (document.getElementById) {  // DOM3 = IE5, NS6
		document.getElementById('hidepage').style.visibility = 'hidden';
		}
		else {
		if (document.layers) {  // Netscape 4
		document.hidepage.visibility = 'hidden';
		}
		else {  // IE 4
		document.all.hidepage.style.visibility = 'hidden';
		}
	   }
	}

function GetDetails(WkEntry1, WkEntry2)
	{
		document.SearchForm.rec.value = WkEntry1;
		document.SearchForm.action = 'productdetail.asp';
		document.SearchForm.submit();	
	}

function quickVal()
{
	if(document.quickSearch.searchFor.value == "")
	{
		alert("Please enter search criteria.")
		document.quickSearch.searchFor.focus();
		return false
	}
	
	return true
}

	function verify(f)
	{
		var msg;
		var empty_fields = "";
		
		if (document.ContactDetails.PostcodeLookup.value == "" && document.ContactDetails.HouseNo.value == "")
		{
			// Loop through the elements of the form, looking for all
			// text and textarea elements and if they are empty.
			for(var i = 0; i < f.length; i++)
			{
				var e = f.elements[i];
				{
					if (e.alt == "y")
	//				if ((e.name == "name") || (e.name == "position") || (e.name == "tradingname")
				//		  || (e.name == "productmaintaining") || (e.name == "workshop"))
					{
						if ((e.value == null) || (e.value == ""))
						{
							empty_fields += "\n          " + e.title;
						}
					}
				}
			}
	
			// Now, if there were errors, display a message, stating which fields are missing.
	
			if(!empty_fields)
			{
				return true;
				document.ContactDetails.submit();
			}
			
			msg = "____________________________________________\n\n"
			msg += "   The form was not submitted, because the following\n";
			msg += "   field(s) are required:\n";
			msg += "___________________________________________\n"
		
		
			if (empty_fields)
			{
				msg += empty_fields + "\n";
			}
			
			alert(msg);
			return false;
		}
	}
	
	function CheckEmail(e)
	{
		var noAt = e.indexOf("@");
		
		// Now, if there were errors, display a message, stating which fields are missing.

		if(noAt != -1) return true;
		
		alert('Incorrect email format. Please add "@".');
		return false;
	}

	function CheckPostCode(e)
	{
		var gotSpace = e.indexOf(" ");
		
		// Now, if there were errors, display a message, stating which fields are missing.

		if(gotSpace != -1) return true;
		
		alert('Incorrect postcode. Please add a space.');
		return false;
	}

	function verifyCard(f)
	{
		var msg;
		var empty_fields = "";
		
		// Loop through the elements of the form, looking for all
		// text and textarea elements and if they are empty.
		for(var i = 0; i < f.length; i++)
		{
			var e = f.elements[i];
			{
				if ((e.name == "CardNumber") || (e.name == "CardSecurityCode"))
				{
					if ((e.value == null) || (e.value == ""))
					{
						empty_fields += "\n          " + e.title;
					}
				}
				else if (e.name == "CardEndMonth")
				{
					if (f.CardEndMonth.options[f.CardEndMonth.selectedIndex].value == '-')
					{
						empty_fields += "\n          " + e.title;
					}
				}
				else if  (e.name == "CardEndYear")
				{
					if (f.CardEndYear.options[f.CardEndYear.selectedIndex].value == '-')
					{
						empty_fields += "\n          " + e.title;
					}
				}
			}
		}

		// Now, if there were errors, display a message, stating which fields are missing.

		if(!empty_fields) return true;
		
		msg = "____________________________________________\n\n"
		msg += "   The form was not submitted, because the following\n";
		msg += "   field(s) are required:\n";
		msg += "___________________________________________\n"
	
	
		if (empty_fields)
		{
			msg += empty_fields + "\n";
		}
		
		alert(msg);
		return false;
	}

	function RefineTopSearch(WkTS,WkUrl)
	{
		var LocationString = WkUrl + "?mk=" + escape(WkTS);

		document.location = LocationString ;
			
	}

function EmptyField()
	{
	if (document.KeywordSearch.C0.value == "Keyword search")
		document.KeywordSearch.C0.value = "";
	}

function FillField()
	{
	if (document.KeywordSearch.C0.value == "")
		document.KeywordSearch.C0.value = "Keyword search";
	}

function ValidateQuantity(field)
{
   if(IsEmpty(field)) 
   { 
      alert('Please enter a quantity.') 
      field.focus(); 
      return false; 
   } 
 
 
   if (!IsNumeric(field.value)) 
   { 
      alert('Only numbers are allowed for this field.') 
      field.focus(); 
      return false; 
      } 
 
return true;
 
} 

function ValidatePriceField(field)
{

   if (!IsNumeric(field.value)) 
   { 
      alert('Only numbers are allowed for this field.') 
      field.focus(); 
      return false; 
      } 
 
return true;
 
} 


function IsEmpty(aTextField)
{
   if ((aTextField.value.length==0) || (aTextField.value==null))
   {
    	return true;
   }
   else
   {
   	return false;
	}
}	

function IsNumeric(TxtFld)
	{
		var ValidChars = "0123456789";
	   	var IsNumber=true;
   		var Char;

 		for (i = 0; i < TxtFld.length && IsNumber == true; i++) 
      	{ 
			Char = TxtFld.charAt(i); 
			if (ValidChars.indexOf(Char) == -1) 
         	{
         		IsNumber = false;
         	}
      	}
		return IsNumber;
	}
	
function UpdateDelivery(CostValue)
{
	location = 'basket.asp?del=' + CostValue;
}

function SendOffProductPage(WhichForm,WhichPage)
	{
		if(WhichForm == '1')
		{
			document.ProductPageForm1.rec.value = document.ProductPageForm1.recNumber.value;
			document.ProductPageForm1.s.value = document.ProductPageForm1.SortOrder.value;
			document.ProductPageForm1.pg.value = WhichPage;
			
			document.ProductPageForm1.submit();
		}
		else
		{
			document.ProductPageForm2.rec.value = document.ProductPageForm2.recNumber.value;
			document.ProductPageForm2.s.value = document.ProductPageForm2.SortOrder.value;
			document.ProductPageForm2.pg.value = WhichPage;
			
			document.ProductPageForm2.submit();
		}
	}

function SendMultiple(WkDesc,WkQty,WkPrice)
{
		
		document.orderitem.MultipleDescription.value = WkDesc;
		document.orderitem.Multiple.value = WkQty;
		document.orderitem.price.value = WkPrice;
		document.orderitem.submit();	
		
}