<!--//
/*------------------------------------------------------------
	Object Finder
------------------------------------------------------------*/
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;
}

/*------------------------------------------------------------
	Image Swap & Restore
------------------------------------------------------------*/
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_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];}
}

/*------------------------------------------------------------
	Open Browser Window
------------------------------------------------------------*/
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	if(window.screen)if(isCenter)if(isCenter=="true")
	{
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

/*------------------------------------------------------------
	Form Input Field ( Clear | Unclear )
------------------------------------------------------------*/
function myFocus(element)
{
	if (element.value == element.defaultValue)
	{
		element.value = '';
	}
}
function myBlur(element)
{
	if (element.value == '')
	{
		element.value = element.defaultValue;
	}
}

/*------------------------------------------------------------
	Multi-Record Updater
------------------------------------------------------------*/
function RecUpdate(RecID){
	var ThisID = "*" + (RecID) + "*"
	if (document.form1.recordIDs.value == ""){      // If the hidden field is empty
		document.form1.recordIDs.value = (ThisID)       // Store the value in the hidden field (hidRecIDs) as it is.
	}
	if (document.form1.recordIDs.value != ""){      // If the hidden field isn't empty
		var str = document.form1.recordIDs.value;       // Store the contents of the hidden field in the variable str
		var pos = str.indexOf(ThisID);                  // Search str to see if this RecID is allready in it.
		if (pos == -1) {                                // If the position returned is -1 it isn't already in there, 
			document.form1.recordIDs.value = document.form1.recordIDs.value + ", " + (ThisID) 
		}                                               // so add ", " and this ID to what is already in recordIDs 
	}                                               // to create a list like this *2*, *5*, *8* etc. 
}

/*------------------------------------------------------------
	Miscellaneous Form Functions
------------------------------------------------------------*/
function checkoutChangeBilling(paymentID){
	document.paymentMethod.paymentID.value=paymentID;
	document.paymentMethod.submit();
}
function checkoutChangeShippingAddress(addressID){
	document.shippingAddress.addressID.value=addressID;
	document.shippingAddress.submit();
}
function checkoutChangeShipping(shipperID){
	document.shippingMethod.shipperID.value=shipperID;
	document.shippingMethod.submit();
}
function checkoutEnterPromo(promoCode){
	document.frmPromo.promoCode.value=promoCode;
	document.frmPromo.submit();
}
function PlaceOrder(f){
	f.submit();
	PlaceOrder = blockIt;
	return false;
}
function wishListInsert(itemID,itemQuantityWanted){
	document.addToWishList.itemID.value=itemID;
	document.addToWishList.itemQuantityWanted.value=itemQuantityWanted;
	document.addToWishList.submit();
}
function deleteWishListItem(wishListItemID){
	document.removeFromWishList.wishListItemID.value=wishListItemID;
	document.removeFromWishList.submit();
}

/*------------------------------------------------------------
	Confirmation Function for manipulating data
------------------------------------------------------------*/
function confirmIt(msg){
	return confirm(msg);
}

/*------------------------------------------------------------
	( Show | Hide ) Objects
------------------------------------------------------------*/
function menushowhide(id) {
	var objBox = document.getElementById(id)
	if (document.getElementById(id).style.display == "") {
		objBox.style.display = "none";
		SaveCookie(id, 'Hide');
	}
	else {
		objBox.style.display = "";
		SaveCookie(id, 'Show');
	}
}

function showhide(id) {
	var objBox = document.getElementById(id)
	if (document.getElementById(id).style.display == "") {
		objBox.style.display = "none";
		SaveCookie(id, 'Hide');
	}
	else {
		objBox.style.display = "";
		SaveCookie('box' +id, 'Show');
	}
}

function SaveCookie(name, value)
{
	var expiry = new Date();
	expiry.setTime (expiry.getTime() + (24 * 60 * 60 * 1000*365));
	document.cookie=name + "=" + escape(value) + "; expires=" + expiry;
}

/*------------------------------------------------------------
	Function for preventing multiple submit.
	It both submits the form and ensures the form can not be
	submitted again by reassigning the funciton to a
	function that does nothing.
	It also disables the buttons (this part only works in IE).
	f = the form the buttons are in
------------------------------------------------------------*/
function safeSubmit(f) {
	for (i=1; i<f.elements.length; i++) {
		if (f.elements[i].type == 'image') {
			f.elements[i].disabled = true;
		}
	}
	f.submit();
	safeSubmit = blockIt;
	return false;
}

/*------------------------------------------------------------
	Dummy function that is used in conjunciton with
	safeSubmit(f) to prevent multiple submits.
------------------------------------------------------------*/
function blockIt(f) {
	return false;
}	

//------------------------------------------------------------
//-->
