/* DOM check v1.0
 * Confirms that the browser is capable of utilizing most SI_functions
 * and hides unnecessary elements from these browsers. Apply the .non-dom class
 * to any element that is made redundant due to scripting. 
 * ie. go buttons next to select menus with onchange event handlers
 */
if (SI_dom()) { document.write('<style type="text/css">.non-dom { position: absolute !important; top: 0 !important; left: -3000px !important; }<'+'/style>\n'); }

/* SI_dom() v1.0
 * Confirms that the browser is capable of 
 * getElementById and getElementsByTagName
 */
function SI_dom() { return new Boolean(document.getElementById && document.getElementsByTagName); };

/* SI_menu() v2.0
 * 
 * Holds IE's hand through what can be accomplished using only
 * CSS in other modern browsers. That's right, I said "modern."
 * In a medium that moves as fast the internet you didn't really
 * consider a 4 year old browser like IE modern did you? :P
 * 
 * Includes nodeName clarification which corrects
 * potential problems in IE 5.x (both platforms)
 * 
 * Now correctly applies the hover className to the li and not the link.
 * Removed RegExp from onmouseout by precaching the class names which speeds 
 * up the script phenomenally.
 */
function SI_menu() {
	var d = document;
	var isSafari 	= (navigator.userAgent.indexOf('Safari') != -1);
	var isIE 		= (navigator.appName == "Microsoft Internet Explorer");
	var isWinIE		= (isIE && window.print);
	
	/* Safari doesn't need any help...
	 * Gecko needs a little help remembering which parent elements are currently :hover
	 * I have no idea what to do with Opera...
	 * IE needs the most help...
	 */
	if (!SI_dom() || window.opera || isSafari || !d.getElementById) return;
	
	var m=SI_menu.arguments;

	for(i=0; i<m.length; i++) {
		if (!d.getElementById(m[i])) continue; // Added 4.08.23
		for (var l=0; (lnk=d.getElementById(m[i]).getElementsByTagName("a")[l]); l++) {
			// If there are any nested menus...
			if (lnk.parentNode.childNodes.length > 1) {
				li = lnk.parentNode; // The containing <li>
				for (var n=0; n < li.childNodes.length; n++) {
					node = li.childNodes[n];
					if (node.nodeName=="UL") {
						li.ul = node; // The sibling <ul> (submenu)
						delete node;
						
						li.classDefault		= li.className;
						li.classHover		= li.className+((li.className=='')?'hover':' hover');
						
						li.isIE				= isIE;
						li.isWinIE			= isWinIE;
						li.onmouseover		= SI_showMenu;
						li.onmouseout		= SI_hideMenu;
						}
					}
				}
			}
		}
	}
function SI_showMenu() {
	// SI_debug();
	this.className = this.classHover;
	if (this.isIE) {
		this.style.zIndex = 100;
		if (this.isWinIE) SI_toggleSelects('hidden'); 
		}
	}
function SI_hideMenu() {
	this.className = this.classDefault;
	if (this.isIE) {
		this.style.zIndex = 1;
		if (this.isWinIE) SI_toggleSelects('visible'); 
		}
	}
function SI_toggleSelects(state) {
	var d = document;
	for (var i=0; (sel=d.getElementsByTagName('select')[i]); i++) {
		sel.style.visibility = state;
		}
	}
	
function detectMacXFF2() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (/firefox[\/\s](\d+\.\d+)/.test(userAgent)) {
    var ffversion = new Number(RegExp.$1);
    if (ffversion < 3 && userAgent.indexOf('mac') != -1) {
      return true;
    }
  }
  return false;
}	


