
	// SHOW LOADING GRAPHIC ##############################
	// ###################################################
		function ShowLoading(Div_id, Colour){
			if(Div_id == undefined || Div_id == "") Div_id = "loading";
			if(Colour == undefined || Colour == "") Colour = "ffffff";
			if(document.getElementById(Div_id) != null){
				document.getElementById(Div_id).innerHTML = "<img src=\"images/gif/loading/" + Colour + ".gif\" width=\"16\" height=\"16\" border=\"0\">";
			}
		}
		

	// HIDE LOADING GRAPHIC ##############################
	// ###################################################
		function StopLoading(Div_id){
			if(Div_id == undefined || Div_id == "") Div_id = "loading";
			if(document.getElementById(Div_id) != null){
				document.getElementById(Div_id).innerHTML = "";
			}
		}
		

	// MEMBER LOGIN ######################################
	// ###################################################
		function CheckLogin(key){
			if(key == 13){
				ShowLoading('LoginLoading', '94afc8');
				RunLogin($('Login').serialize(false));
			}
		}

	
	// MEMBER LOGOUT #####################################
	// ###################################################
		function Logout(Redirect){
			RunLogin('Logout=true');
			if(Redirect == true) location.href = 'index.php';
		}

	

	// REMOVE PRODUCT TO CART ############################
	// ###################################################
		function AddToCart(Type, id){
			if(Type == "Document"){
				new Ajax.Updater('Message-' + id,'ajax/cart_add.ajax.php',{
					method:'post',
					parameters: $('AddToCart-' + id).serialize(false),
					evalScripts:true,
					onFailure: function(){ alert('Something went wrong...'); }
				});
			} else if(Type == "Merchandise"){
				new Ajax.Updater('Message','ajax/cart_add.ajax.php',{
					method:'post',
					parameters: $('AddToCart').serialize(false),
					evalScripts:true,
					onFailure: function(){ alert('Something went wrong...'); }
				});
			}
		}
	
	
	// REMOVE DOCUMENT FROM CART #########################
	// ###################################################
		function RemoveFromCart(Format_id) {
			new Ajax.Request('ajax/cart_add.ajax.php',{
				method:'post',
				parameters: {
					timestamp: GetTimeStamp(),
					eType: 'Document',
					Format_id: Format_id,
					Qty: 0					
				},
				onSuccess: function(transport){
					var response = transport.responseText;
					response.evalScripts();
				},
				onFailure: function(){ alert('Something went wrong...'); }
			});
		}
	

	// UPDATE PRODUCT QUANTITY ###########################
	// ###################################################
		function UpdateQtyButton(Product_id, Format_id, OldQty){
	
			var NewQty = document.getElementById("Qty_" + Format_id).value;
			var div = document.getElementById("Options_" + Format_id);
			
			if(NewQty != OldQty){
				div.innerHTML = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><a onMouseOver=\"MM_swapImage('btnSave_" + Format_id + "','','images/forms/btnSave_On.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" style=\"cursor:pointer;\"  onclick=\"AddToCart('Document', " + Format_id + ");\"><img src=\"images/forms/btnSave_Off.gif\" height=\"20\" border=\"0\" name=\"btnSave_" + Format_id + "\"></a></td><td><a onMouseOver=\"MM_swapImage('btnRemoveFromCart_" + Format_id + "','','images/forms/btnRemoveFromCart_On.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" style=\"cursor:pointer;\" onclick=\"Refresh('" + Product_id + "');\"><img src=\"images/forms/btnRemoveFromCart_Off.gif\" height=\"20\" border=\"0\" name=\"btnRemoveFromCart_" + Format_id + "\"></a></td></tr></table>";
			} else {
				div.innerHTML = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><a onMouseOver=\"MM_swapImage('btnInCart_" + Format_id + "','','images/forms/btnInCart_On.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" style=\"cursor:pointer;\" onclick=\"ShowCart();\"><img src=\"images/forms/btnInCart_Off.gif\" height=\"20\" border=\"0\" name=\"btnInCart_" + Format_id + "\"></a></td><td><a onMouseOver=\"MM_swapImage('btnRemoveFromCart_" + Format_id + "','','images/forms/btnRemoveFromCart_On.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" style=\"cursor:pointer;\" onclick=\"RemoveFromCart('" + Format_id + "');\"><img src=\"images/forms/btnRemoveFromCart_Off.gif\" height=\"20\" border=\"0\" name=\"btnRemoveFromCart_" + Format_id + "\"></a></td></tr></table>";
			}
		}