/* ®TS3,6,9,12,15,18,21¯®RM500¯®PL100¯ */

/* ®MDBR¯         MENU DROPDOWN FUNCTIONS®MDNM¯ */
/* ®MDBO¯------- SFHOVER -----®MDNM¯ */
sfHover = function() {
var el = document.getElementById("mdn_menu");
if ( (el.className=='mdn_menu') && (el.tagName == "UL") )
	setHover(el);
var ieNavs = document.getElementsByTagName('ul');
for(i=0; i<ieNavs.length; i++) {
	var ul = ieNavs[i];
	if (ul.className=='mdn_menu')
		setHover(ul);
	}
}

/* ®MDBO¯-------- SETHOVER -------®MDNM¯ */
function setHover(nav) {
var ieULs = nav.getElementsByTagName('ul');
if (navigator.appVersion.substr(22,3)!="5.0") {
	for (j=0; j<ieULs.length; j++) {
		var ieMat=document.createElement('iframe');
		if(document.location.protocol == "https:")
			ieMat.src="//0";
		else {
			if(window.opera != "undefined")
				ieMat.src="";
			else
				ieMat.src="javascript:false";
			}
		ieMat.scrolling="no";
		ieMat.frameBorder="0";
		ieMat.style.width=ieULs[j].offsetWidth+5+"px";
		ieMat.style.height=ieULs[j].offsetHeight+5+"px";
		ieMat.style.zIndex="-1";
		ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
		ieULs[j].style.zIndex="101";
		}
	var ieLIs = nav.getElementsByTagName('li');
	for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
		ieLIs[i].onmouseover=function() {
			if(!/\bsfhover\b/.test(this.className))
				this.className+=" sfhover";
			}
		ieLIs[i].onmouseout=function() {
			if(!this.contains(event.toElement))
				this.className=this.className.replace(' sfhover', '');
			}
		}
	} 
else { // IE5.0
	var ieLIs = document.getElementById('mdn_menu').getElementsByTagName('li');
	for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
		ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
		ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
		}
	}
}

/* ®MDBO¯------- HIDESELECTS -----®MDNM¯ */
function hideSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className+=" hide";
}

/* ®MDBO¯------ SHOWSELECTS ----®MDNM¯ */
function showSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className=oSelects[i].className.replace(" hide","");
}

/* ®MDBR¯          COOKIE FUNCTIONS       ®MDNM¯ */
/* ®MDBO¯---------- GETCOOKIEVAL -------®MDNM¯ÿ20*/
function getCookieVal(offset) {
   var endstr=document.cookie.indexOf(";",offset);
if (endstr==-1)
   endstr=document.cookie.length;
return(unescape(document.cookie.substring(offset,endstr)));
}

/* ®MDBO¯-------- GETCOOKIE --------®MDNM¯ÿ20*/
function GetCookie(name) {
   var seeker=name+"=";
   var alen=seeker.length;
   var clen=document.cookie.length;
   var i=0;
while (i<clen) {
   var j=i+alen;
   if (document.cookie.substring(i,j)==seeker) {
      return(getCookieVal(j));
      }
   i=document.cookie.indexOf(" ",i)+1;
   if (i==0) break;
   }
return("");
}

/* ®MDBO¯-------- SETCOOKIE --------®MDNM¯ */
function SetCookie(name,value) {
   var expdate=new Date();
expdate.setTime(expdate.getTime()+(3600000 * 24 * 365));
document.cookie=name+"="+escape(value)+";path=/;domain=mdn.org;expires="+expdate;
}

/* ®MDBO¯----------- SWITCH_CUR ---- ®MDNM¯*/
function switch_cur() {
document.body.style.cursor="http:/addins/wagtail.ani";
}

/* ®MDBR¯         NOW WHAT TO RUN WHEN LOAD THE PAGE     ®MDNM¯ */
/* ®MDBO¯------- BLOW OFF PARENT IF SOMEONE TRYING TO RUN MDN IN A FRAME --- ®MDNM¯*/
if (top.frames.length!=0) {
   tstr="http://";
   tstr=tstr+self.location.hostname+"/INDEX.HTM#";
   tstr=tstr+self.location.pathname;
   top.location=tstr;
   }

/* ®MDBO¯------- SET_CHECKBOX ---------®MDNM¯ */
function set_checkbox() {
var ins=document.getElementsByTagName('input');
for (i=0;i<ins.length;i++) {
	if (ins[i].type) {
		if (ins[i].type=="checkbox") {
			ins[i].className="checkbox";
			}
		}
	}
}

/* ®MDBO¯------- ATTACH IF MSIE FOR HOVER & USING IFRAMES TO HIDE SELECTS ---®MDNM¯ */
if (window.attachEvent) { //JUST IE
	window.attachEvent('onload', sfHover);
	window.attachEvent('onload',set_checkbox);
	}

/* ®MDBO¯----------- GET COOKIES ----------®MDNM¯ */
var cstr=GetCookie("COUNT");
if ( (cstr.length==0) || (cstr=="NaN") )
   var c=1
else
   var c=cstr-0;
c++;
SetCookie("COUNT",c.toString());
SetCookie("LAST",'<!--#echo var="REQUEST_URI"-->');

//