function fnOrder(lngID1, lngOrderID1, lngID2, lngOrderID2, strMode, frm) {
	if (strMode == "Up") {
		frm.hdnID1.value = lngID2;
		frm.hdnOrderID1.value = lngOrderID1;
		frm.hdnID2.value = lngID1;
		frm.hdnOrderID2.value = lngOrderID2;
	} else if (strMode == "Down") {
		frm.hdnID1.value = lngID1;
		frm.hdnOrderID1.value = lngOrderID2;
		frm.hdnID2.value = lngID2;
		frm.hdnOrderID2.value = lngOrderID1;
	} //end if
	
	frm.submit();
} //fnOrder

function fnAddToBasket(lngID) {
	var frm = document.frmProduct;

	frm.hdnProductID.value = lngID;
	frm.btnSubmit.value = "Buy";
	frm.submit();
} //fnAddToBasket

function fnCheckout(strOption) {
	var frm = document.frmCheckout;

	frm.btnSubmit.value = strOption;
	frm.submit();
} //fnCheckout 

function fnViewBasket(strOption) {
	var frm = document.frmViewBasket;
	
	if (strOption == "Empty Basket") {
		if (confirm("Are you sure?")) {
			frm.btnSubmit.value = strOption;
			frm.submit();
		} //end if
	} else {
		frm.btnSubmit.value = strOption;
		frm.submit();
	} //end if
} //fnViewBasket

function fnFillingDeliveryAddress() {
	var frm = document.frmCheckout;
	
	frm.txtShippingFirstName.value = frm.txtBillingFirstName.value;
	frm.txtShippingLastName.value = frm.txtBillingLastName.value;
	frm.txtShippingAddress1.value = frm.txtBillingAddress1.value;
	frm.txtShippingAddress2.value = frm.txtBillingAddress2.value;
	frm.txtShippingTownCity.value = frm.txtBillingTownCity.value;
	frm.txtShippingCounty.value = frm.txtBillingCounty.value;
	frm.sltShippingCountryID.options[frm.sltBillingCountryID.selectedIndex].selected = true;
	frm.txtShippingPostcode.value = frm.txtBillingPostcode.value;
} //fnFillingDeliveryAddress

function fnShowWindow(sUrl, iWidth, iHeight) {
	var iLeft = (screen.availWidth - iWidth) / 2;
	var iTop = (screen.availHeight - iHeight) / 2;          
	var sFeatures = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, left=" + iLeft + ", top=" + iTop + ", width=" + iWidth + ", height=" + iHeight + "";

	win = window.open(sUrl, null, sFeatures, true);
	win.focus();
} //fnShowWindiow
		
function fnShowImage(sImageFile, sAlt, iWidth, iHeight) {
	var objWin;
	var iLeft = (screen.availWidth - iWidth) / 2;
	var iTop = (screen.availHeight - iHeight) / 2;          
	
	objWin = window.open("", "newWindow", "width=" +iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop);
	objWin.document.open();
	objWin.document.write('<html>');
		objWin.document.write('<head>');
			objWin.document.write('<title>' + sAlt + '</title>');
		objWin.document.write('</head>');
		objWin.document.write('<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
			objWin.document.write('<img src=' + sImageFile + ' width=' + iWidth + ' height=' + iHeight + ' alt=' + sAlt + '>'); 
		objWin.document.write('</body>');
	objWin.document.write('</html>');
	objWin.document.close();
	objWin.focus();
} //fnShowImage

function fnLimit() {
	var taObj = event.srcElement;
	if (taObj.value.length == (taObj.maxlength * 1)) return false;
} //fnLimit

function fnCount(visCnt) { 
	var taObj = event.srcElement;
	if (taObj.value.length > (taObj.maxlength * 1)) taObj.value = taObj.value.substring(0, (taObj.maxlength * 1));
	if (visCnt) visCnt.innerText = taObj.maxlength - taObj.value.length;
} //fnCount

function fnCheckAll(frm, sField) {
	for (i = 0; i < frm.elements.length; i++) {
		if (frm.elements[i].name.indexOf(sField) != -1) {
			frm.elements[i].checked = true;
		} //end if
	} //end for
} //fnCheckAll

function fnFillingDeliveryAddress() {
	var frm = document.frmCheckout;
	
	frm.txtShippingFirstName.value = frm.txtBillingFirstName.value;
	frm.txtShippingLastName.value = frm.txtBillingLastName.value;
	frm.txtShippingAddress1.value = frm.txtBillingAddress1.value;
	frm.txtShippingAddress2.value = frm.txtBillingAddress2.value;
	frm.txtShippingTownCity.value = frm.txtBillingTownCity.value;
	frm.txtShippingCounty.value = frm.txtBillingCounty.value;
	frm.sltShippingCountryID.options[frm.sltBillingCountryID.selectedIndex].selected = true;
	frm.txtShippingPostcode.value = frm.txtBillingPostcode.value;
} //fnFillingDeliveryAddress

function fnSurePayment() {
	var frm = document.frmCheckout;
	frm.btnSubmit.value = " Confirm Order ";
	frm.submit();
} //fnSurePayment