function HidePage(){
	var MasterTable = document.getElementById("MasterTable"); 
	MasterTable.visibility="hidden";
} 
function ShowPage(){
	var MasterTable = document.getElementById("Body"); 
	MasterTable.visibility="visible";
} 
function processCheckout(index, canPurchase) {
	if(index == 0) {
		window.alert("Shopping Cart is currently empty, cannot Checkout.");
		return false;
	} 
	if (canPurchase == '1') {
		return NewIAFSubmit0(document.forms.headerForm, 'showCheckOut.do', 'processCheckOut');
	} else {
		return NewIAFSubmit1(document.forms.headerForm, 'showLogon.do', 'showLogon', 'processShoppingCart');
	}
}
function processOnLoadCommands(ArrayofFunctions) {
	for (i=0;i<ArrayofFunctions.length;i++) {
		eval(ArrayofFunctions[i]);
	}
}
function processUnloadCommands() {
	alert("Unloaded Page");
}
function searchFor() {
	var srcType = document.forms.headerForm.searchType.value;
	var srcWords = document.forms.headerForm.keywords.value;
	return NewIAFSubmit0(document.forms.headerForm, 'searchProductsAndCategories.do?searchType='+srcType+'&keywords='+srcWords+'', 'searchForProductsAndCategories');
}

function sortCategory(sortCriteria) {
	sortTextCode = '';
	if (sortCriteria == 'brand') {
		sortCriteria = 'text';
		sortTextCode = 'BRD';
	}
	document.forms.mainForm.sortCriteria.value = sortCriteria;
	document.forms.mainForm.sortTextCode.value = sortTextCode;
	return IAFSubmit1(document.forms.mainForm, 'sortCategory', 'showCategory');
}
function addProduct(productNumber) {
	document.forms.mainForm.productNumber.value = productNumber;
	return NewIAFSubmit0(document.forms.mainForm, 'processShoppingCart.do', 'categoryAddProductToCart');
}
function addProductfromPromo(productNumber) {
	document.forms.headerForm.productNumber.value = productNumber;
	return NewIAFSubmit1(document.forms.headerForm, 'processShoppingCart.do', 'categoryAddProductToCart','processShoppingCart');
}
function setCookie(c_name,value,exdays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value + "; path=/;";
}

function getCookie(c_name) {
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++) {
  		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  		x=x.replace(/^\s+|\s+$/g,"");
  		if (x==c_name) {
    		return unescape(y);
  		}
	}
}
