window.addEvent('domready', Init);	

function Init() {	
	if ($('txtUsername')) {
		if ($('txtUsername').value != "") {
			$('txtPassword').focus();				
		} else {
			$('txtUsername').focus();
		} //end if
	} //end if
	
	if ($('txtSearch')) {
		if ($('txtSearch').value == "") {
//			if ($('hdnSearchMode').value == "Parts") $('txtSearch').value = "enter part number";
//			if ($('hdnSearchMode').value == "Orders") $('txtSearch').value = "enter order code";
		} //end if
		
		$('txtSearch').addEvent('click', 
				function() { 
//					if ($('txtSearch').value == "enter part number") $('txtSearch').value = "";
//					if ($('txtSearch').value == "enter order code") $('txtSearch').value = "";
				}
		);
	} //end if

	if ($('txtRef')) $('txtRef').focus();
	if ($('txtTitle')) $('txtTitle').focus();
	if ($('txtFirstName')) $('txtFirstName').focus();
} //Init

function FillingDeliveryAddress() {
	$('txtShippingFirstName').value = $('txtBillingFirstName').value;
	$('txtShippingLastName').value = $('txtBillingLastName').value;
	$('txtShippingAddress1').value = $('txtBillingAddress1').value;
	$('txtShippingAddress2').value = $('txtBillingAddress2').value;
	$('txtShippingTownCity').value = $('txtBillingTownCity').value;
	$('txtShippingCounty').value = $('txtBillingCounty').value;
	$('txtShippingPostcode').value = $('txtBillingPostcode').value;
	$('sltShippingCountryID').value = $('sltBillingCountryID').value;
} //FillingDeliveryAddress

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 fnShowMasterImage($strFilename) {
	$("srcMaster").src = "/images/shop/" + $strFilename;
	$("hrefMaster").href = "/images/shop/" + $strFilename;
} //fnShowMasterImage
