// #####################################################################
// // variable to switch email address to username
// #####################################################################

var usernameInput = 0;


// #####################################################################
// defines the browser DOM
// #####################################################################

userAgent = navigator.userAgent;
var NN=0;
var IE=0;
var DOM=0;
if (userAgent.search("MSIE")>=0) {
	IE=1;
} else {
	NN = 1; 
	if (parseInt(navigator.appVersion)>4) {
  		NN=0;IE=1;DOM=1;
	};
};

// #####################################################################
// makes a hidden div layer visible
// #####################################################################

function showMe(div) {
	if (DOM) {
		document.getElementById(div).style.visibility = "visible";
		document.getElementById(div).style.display = "block";
	} else if (IE) {
		document.all[div].style.visibility = "visible";
		document.all[div].style.display = "block";
	} else if (NN) {
	    document.div.visibility = "show";
		document.div.display = "block";
	}
} // end function
	
// #####################################################################
// hides a visible div layer
// ####################################################################
function hideMe(div) {
	if (DOM) {
		document.getElementById(div).style.visibility = "hidden";
		document.getElementById(div).style.display = "none";
	} else if (IE) {
		document.all[div].style.visibility = "hidden";
		document.all[div].style.display = "none";
	} else if (NN) {
		document.div.visibility = "hide";
		document.div.display = "none";
	}
} // end function



// #####################################################################
// Mouseover effect for icons
// ####################################################################


function turnOn(imageName) {
	if (document.images) {
		document[imageName].src = eval(imageName + "on.src");
	}
}

function turnOff(imageName) {
	if (document.images) {
		document[imageName].src = eval(imageName + "off.src");
	}
}

function imageSwitch(path, name, image) {
	if (document.images) {
		document[name].src = path + "/" + image;
	}
}









// #####################################################################
// highlights the active table row
// #####################################################################
function clrRow(src, newColor) {
	src.bgColor = newColor;
}


function borderCell(src, flag) {
	if (flag) {
		src.style.backgroundColor = "#4B4B4B";
	} else {
		src.style.backgroundColor = "#666666";
	}
}

 
function categoryManager() {
	var URL = "category_manager.php";
	var left = 100;
	var top = 100;
	var width = 540;
	var height = 400;
	var scrollbars = 0;
	thisPopup(URL, left, top, width, height, scrollbars);
}


function thisPopup(URL, left, top, width, height, scrollbars) {
	var standardSetting = 'toolbar=0, location=0, directories=0, status=0, scrollbars=' + scrollbars;
	var customSetting = 'menubar=0, resizable=1, width=' + width + ', height=' + height;
	var positioning = 'left=' + left + ', top =' + top;
	// create window
	closePopup();
	oxl_win = window.open(URL, 'oxl', + '\'' + standardSetting + ', ' + customSetting + ', ' + positioning + '\'');
	oxl_win.focus();
}

function closePopup() {
	if (window.oxl_win) {
		window.oxl_win.close();
	}
}



// pop up to define which shopping list item is placed in
function historyOrder(order_id) {
	var left = 50;
	var top = 50;
	var URL = "history_order.php?order_id="+order_id;
	var width = 650;
	var height = 550;
	var scrollbars = 1;
	thisPopup(URL, left, top, width, height, scrollbars);
}

// pop up to define which shopping list item is placed in
function historyNewsletter() {
	newsletterID = document.forms["newsletterForm"].elements["newsletter"].value;
	var left = 50;
	var top = 50;
	var URL = "history_newsletter.php?newsletter_id="+newsletterID;
	var width = 780;
	var height = 550;
	var scrollbars = 1;
	thisPopup(URL, left, top, width, height, scrollbars);
}





