// $Id: nice_menus.js,v 1.5.2.7 2008/02/09 17:42:07 add1sun Exp $

// We only do the javascript in IE thanks to drupal_set_html_head in .module.
// This is the jquery method of adding a function
// to the BODY onload event.  (See jquery.com)
//$(document).ready(function(){ IEHoverPseudo() });

//new function
function IEHoverPseudo(){
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		if (ieversion<7){
        		$("ul.nice-menu li.menuparent").hover(function(){
     			$(this).addClass("over").find("> ul").show().addShim();
     			},function(){
     			$(this).removeClass("over").find("> ul").removeShim().hide();
     			});
		}
	}
}
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
  var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
  if (ieversion<7){
  $.fn.addShim = function() {
  return this.each(function(){
	  if(document.all && $("select").size() > 0) {
	    var ifShim = document.createElement('iframe');
	    ifShim.src = "javascript:false";
			ifShim.style.width=$(this).width()+1+"px";
      ifShim.style.height=$(this).find("> li").size()*23+20+"px";
			ifShim.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
		  ifShim.style.zIndex="0";
    $(this).prepend(ifShim);
      $(this).css("zIndex","99");
		}
	});
  };
  }
}
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
  var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
  if (ieversion<7){
  $.fn.removeShim = function() {
  return this.each(function(){
	  if (document.all) $("iframe", this).remove();
	});
  };
  }
}

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nice-menu-1");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];

			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
  				}
  				node.onmouseout=function() {
  					this.className=this.className.replace(" over", "");
	  			}
  			}
			for (j=0; j<navRoot.childNodes[i].childNodes[1].childNodes.length; j++) {
				node = navRoot.childNodes[i].childNodes[1].childNodes[j];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
  					}
  					node.onmouseout=function() {
  						this.className=this.className.replace(" over", "");
	  				}
  				}
			}
		}

	}
}
