var displayMode;

function buttonHover() {
	var f, e = window.event;
	f = (e.type == "mouseover") ? ('_f2') : ('');
	e.srcElement.src = "images/btn_" + e.srcElement.name + f + ".jpg";
}

function mouseHoverCSS() {
	var e = window.event, g = e.srcElement.className;
	e.srcElement.className = (e.type == "mouseover") ? (g + "_over") : (g.substr(0, g.length - 5));
}

function validateNumeric() {
	var kc = event.keyCode;
	var txt = event.srcElement;
	var bl = (kc < 48 || kc > 57) && kc != 46 ? false : true;
	return  bl;
}

function validateAddEditMode() {
	if (displayMode == "Add" || displayMode == "Edit") {
		 return confirm("Are you sure you want to navigate away from this page and lose all entered information?");
	} else {
		return true;
	}
}

function navigatePage(url) {
	if (validateAddEditMode()) {
		location.href = url;
	}
}

function changeCategory() {
	if (!validateAddEditMode()) {
		void(0);
	}
}

function confirmCancel() {
	return confirm("Are you sure you want to cancel editing and lose all the information you entered?");
}

function confirmDelete(name) {
	return confirm("Are you sure you want to delete this " + name + "?");
}

function enlargePicture(img) {
	var oPictureWindow = window.open(img.src, "picture", "left=300, top=100, directories=no, fullscreen=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=yes, toolbar=no");
	oPictureWindow.focus();
}

function startHighlight(gvw_name)
{
	var gvw = document.all(gvw_name);
	if (gvw != null)
	{
		// get a reference to the tbody element 
		var tbody = gvw.childNodes[0];
		for (i = 1; i < tbody.childNodes.length; i++)
		{
			var node = tbody.childNodes[i];
			if (node.nodeName == "TR")
			{
				node.onmouseover=function()
				{
					this.className = "over";                
				}
				node.onmouseout=function()
				{
					this.className = this.className.replace("over", "");
				}
			}
		}
	}
}

