//////////////////////////////////////////////////////////////////////////////////////////
// Name
//	 Menu.js
//
// Description
//	 JavaScript functions used by menus
//
// Functions
//   Rollover
//   IndicateCurrentPage
//
//////////////////////////////////////////////////////////////////////////////////////////

// added for ticket 5099 - ability for menu items to have a popup property

function openWin(w,h,page,s) 
	{
		var thisPlatform
		var thisBrowser
		var win
		
			
		//sniffing for browser and platform
		thisBrowser = navigator.userAgent
		thisPlatform = navigator.platform;
		
		if (thisPlatform == "MacPPC") {
			if (thisBrowser.indexOf("MSIE") != -1) {
				win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
			} else {
				win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
			}
		} else {
			win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
		}
		 
		win.focus();
	}


function Rollover(srcElm, bOn) {
    if (bOn) {
		srcElm.src = srcElm.src.replace(/\.gif/i, '_on.gif');
		srcElm.src = srcElm.src.replace(/\.jpg/i, '_on.jpg');
    } else {
		srcElm.src = srcElm.src.replace(/_on\.gif/i, '.gif');
		srcElm.src = srcElm.src.replace(/_on\.jpg/i, '.jpg');
    }
}

function IndicateCurrentPage(LinkName) {
 
	if (LinkName.length == 0) { return; }
 
	var PageURL = document.location.toString().toLowerCase();
	var pos = 0;
	var objTag, objParent;
	var numLinks = document.links.length;
	  
	while (pos < numLinks) {
	  
		objTag = document.links[pos++];
		 
		if (objTag != null) {
		
			if (objTag.className == LinkName || objTag.name == LinkName) {
				if (objTag.href.toLowerCase() == PageURL) {
					objParent = objTag.parentElement;
					
					// Change image to "on"
					objParent.innerHTML = objTag.innerHTML.replace(/\.gif/i, '_on.gif');
					// Remove onmouseover and onmouseout events
					objParent.innerHTML = objParent.innerHTML.replace(/onmouse(over|out)=[^ ]+/gi, '');

					break;
				} 
			}
		}
	}
}

