﻿//Drop-down menu script
mhover = function() {
	var navUL = $('nav');
	var sfEls = navUL.getElementsByTagName("li");
	
	for (var i=0; i<sfEls.length; i++) {
	    if(sfEls[i].getAttribute('className').match("first")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-first mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-first mhover\\b"), "");
		    }
		 }
	    else if(sfEls[i].getAttribute('className').match("second")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-second mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-second mhover\\b"), "");
		    }
		 }
		 else if(sfEls[i].getAttribute('className').match("third")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-third mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-third mhover\\b"), "");
		    }
		 }
		 else if(sfEls[i].getAttribute('className').match("fourth")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-fourth mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-fourth mhover\\b"), "");
		    }
		 }
		 else if(sfEls[i].getAttribute('className').match("fifth")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-fifth mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-fifth mhover\\b"), "");
		    }
		 }
		 else if(sfEls[i].getAttribute('className').match("sixth")) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover-sixth mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover-sixth mhover\\b"), "");
		    }
		 }
		 else {
		    sfEls[i].onmouseover=function() {
			    this.className+=" mhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" mhover\\b"), "");
		    }
		 }
	}
}

if (window.attachEvent) window.attachEvent("onload", mhover);
