//operaBool handles an issue related to Opera wanting to create two copies of each left side menu
var operaBool=1;
if (is_opera)
	operaBool=0;

//loadMenu function launches a specified left side menu
function loadMenu(menuNum){
	if (menuCookie[menuNum-1]==1) {	eval("window.frames.menuIframe" + menuNum + ".Go()"); }
}

//menuClear reinitializes all other menus except the menu calling the function. It's purpose is to allow all of the seperate menus to function together all one more cleanly
function menuClear(menuNum){
	if(menuNum!=1){window.frames.menuIframe1.Initiate();window.frames.menuIframe1.menuOverCounter=0;}
	if(menuNum!=2){window.frames.menuIframe2.Initiate();window.frames.menuIframe2.menuOverCounter=0;}
	if(menuNum!=3){window.frames.menuIframe3.Initiate();window.frames.menuIframe3.menuOverCounter=0;}
	if(menuNum!=4){window.frames.menuIframe4.Initiate();window.frames.menuIframe4.menuOverCounter=0;}
	if(menuNum!=5){window.frames.menuIframe5.Initiate();window.frames.menuIframe5.menuOverCounter=0;}
	if(menuNum!=6){window.frames.menuIframe6.Initiate();window.frames.menuIframe6.menuOverCounter=0;}
	if(menuNum!=7){window.frames.menuIframe7.Initiate();window.frames.menuIframe7.menuOverCounter=0;}
	if(menuNum!=8){window.frames.menuIframe8.Initiate();window.frames.menuIframe8.menuOverCounter=0;}
}

function rePosition(){
	try{RePos();}catch(err){}
	
	for(var count=1; count<=8; count++) {
		if(menuCookie[count-1]==1)
			try{eval("window.frames.menuIframe"+ count +".RePos()");}catch(err){}
	}
}
function hideMenu(menuNum){
	document.getElementById("menuContainer"+menuNum).style.display="none";
}
function showMenu(menuNum){
	if(eval("window.frames.menuIframe" + menuNum + ".Crtd!=true")){
		eval("window.frames.menuIframe" + menuNum + ".Go()");
	}
	document.getElementById("menuContainer"+menuNum).style.display="block";

}
    function newsCollapse(newsPost) {
    var obj;
    obj = document.getElementById(newsPost);
    if (obj.style.display != "block")
        obj.style.display = "block";
    else
        obj.style.display = "none";
    }

function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function getcookie(cookiename) {
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value){
	cookiestring=name+"="+escape(value)+";EXPIRES="+ getexpirydate(365)+";PATH=/";
	document.cookie=cookiestring;
}

// Popup script
function popUpOmega (screenshot, width, height, caption) 
{
	//Browser detection - is the user relying on the one browser where this script does not work?
//	var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;

	var name = "Sheenscrot"; 
	widthHeight = "width=" + width + ",height=" + height;
	winFeatures = "width=" + width + ",height=" + height + ",left=50,top=50,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,location=no"
	if (is_safari) spawn = window.open(screenshot,name,winFeatures);
	else
	{
		spawn = window.open("/shared/wow-com/images/layout/pixel.gif",name,winFeatures)
		spawn.document.write("<html> <head> <title>" + caption + "<\/title> <\/head> <body onBlur='self.close()' background= " + screenshot + "><\/body><\/html>"); 
		spawn.document.close();
	}
}

//Begin Martin's Tooltip Code
is_safari = ((navigator.userAgent.indexOf("Safari")!=-1))?true:false;
isShowing = false;

/*
<div id="toolBox" class="toolBoxStyle">TEST</div>
*/

function showTip(toolTipContent)
{
	isShowing = true;
	if(!document.getElementById("toolTipBox"))
	{
    	ttipEmbryo = document.createElement("div");
		ttipEmbryo.id = "toolTipBox";
		ttipEmbryo.className = "toolBoxStyle";
		document.getElementsByTagName("body")[0].appendChild(ttipEmbryo);
	}
	document.getElementById("toolTipBox").style.left = mouseX+10+"px";
  document.getElementById("toolTipBox").style.top = mouseY+10+document.body.scrollTop+"px";
  document.getElementById("toolTipBox").style.display = "block";
	ttipWindowHeight = (window.innerHeight) ? window.innerHeight : document.body.clientHeight;
  document.getElementById("toolTipBox").innerHTML = toolTipContent;
}

function hideTip()
{
/*	alert(mouseY - document.getElementById("toolBox").offsetHeight);*/
  document.getElementById("toolTipBox").style.display = "none";
  isShowing = false;
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function tipPosition(callingEvent)
{
  if (!callingEvent) callingEvent = window.event;
	mouseX = callingEvent.clientX;
	mouseY = callingEvent.clientY-1;
  if (isShowing)
  {
		var ttipWindowScrollDistance = (!is_safari) ? ((document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop ) : window.pageYOffset;
		var ttipOvershoot = (!is_safari) ? document.getElementById("toolTipBox").offsetHeight + mouseY + 10 : document.getElementById("toolTipBox").offsetHeight + mouseY + 10 - window.pageYOffset;
        var xBox = document.getElementById("toolTipBox").offsetWidth + mouseX;
        
		if(ttipOvershoot > ttipWindowHeight) {
			document.getElementById("toolTipBox").style.top = ttipWindowHeight - document.getElementById("toolTipBox").offsetHeight + ttipWindowScrollDistance + "px";
            if (xBox > window.innerWidth-22 || xBox > ietruebody().clientWidth-22) { 
            document.getElementById("toolTipBox").style.left = mouseX - (document.getElementById("toolTipBox").offsetWidth+10) + "px"; } 
            else {	document.getElementById("toolTipBox").style.left = mouseX+10+"px"; }
		} else if (xBox > window.innerWidth-22 || xBox > ietruebody().clientWidth-22) {
			document.getElementById("toolTipBox").style.top = (!is_safari) ? mouseY+10+ttipWindowScrollDistance+"px" : mouseY+10+"px";
            document.getElementById("toolTipBox").style.left = mouseX - (document.getElementById("toolTipBox").offsetWidth+10) + "px";     
        } else {
			document.getElementById("toolTipBox").style.top = (!is_safari) ? mouseY+10+ttipWindowScrollDistance+"px" : mouseY+10+"px";

			document.getElementById("toolTipBox").style.left = mouseX+10+"px";
    	}
//        document.getElementById("mausposi").innerHTML = document.getElementById("toolTipBox").offsetWidth + mouseX + "(" + (ietruebody().clientWidth) + ") DIFF: ";
  }
}

function ddrivetip(thisItem) { showTip(thisItem); }
function hideddrivetip() { hideTip(); }

document.onmousemove = tipPosition;
//End Martin's Tooltip Code

/* #################################################################### */ 


