
var Browser = {
	a : navigator.userAgent.toLowerCase()
}
Browser = {
	ie : /*@cc_on true || @*/ false,
	ie6 : Browser.a.indexOf('msie 6') != -1,
	ie7 : Browser.a.indexOf('msie 7') != -1,
    ie8 : Browser.a.indexOf('msie 8') != -1,
    opera : !!window.opera,
	safari : Browser.a.indexOf('safari') != -1,
	safari3 : Browser.a.indexOf('applewebkit/5') != -1,
	mac : Browser.a.indexOf('mac') != -1
}
	//compat-mode for old pages
    var is_ie = Browser.ie,
	is_ie6 = Browser.ie6,
	is_ie7 = Browser.ie7,
    is_opera = Browser.opera,
	is_safari = Browser.safari
	is_mac = Browser.mac;
    
    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;
}


// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/

function setActiveStyleSheet(title) {
	var i, a, main;
	var linksList = document.getElementsByTagName("link");  
		for(i=0; i < linksList.length; i++) {
			if(linksList[i].getAttribute("rel").indexOf("style") != -1 && linksList[i].getAttribute("title")) {
				linksList[i].disabled = true;
				if(linksList[i].getAttribute("title") == title) { linksList[i].disabled = false; }
			}
		}


	}

function getActiveStyleSheet() {
	var i, a;
	var linksList = document.getElementsByTagName("link");
		for(i=0; i < linksList.length; i++) {
		  if(linksList[i].getAttribute("rel").indexOf("stylesheet") != -1 && linksList[i].getAttribute("title") && !linksList[i].disabled) { /*alert(linksList[i].getAttribute("title")); */return linksList[i].getAttribute("title"); }
		}
	return null;
}

function getPreferredStyleSheet() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")) return a.getAttribute("title");
	}
	return null;
}
function createCookie(name,value) {
	setcookie(name,value) //temporary fix used on switcher
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function positionThemeBg () {
	var bodyElem = document.getElementsByTagName('body')[0];
	if (hasClassName(bodyElem, "front")) {
		var bw = bodyElem.clientWidth,
 			 p = $('page-container'), 
			 w = p.offsetWidth, 
			 ol = p.offsetLeft, 
			 or = ol + w,
			 tw = (bw - w) - ol;
			 $('theme-right').style.left = or + "px";
			 $('theme-right').style.width = tw + "px";
	} else {
		removeEvent(window, 'resize', positionThemeBg);
	}
}

/*function initTheme(e) {
	var cookie = readCookie("styles");
	var title = (cookie != null) ? cookie : 'theme4'; getPreferredStyleSheet()
	setActiveStyleSheet(title);
}
*/
function initTheme(e) {
	var cookie = readCookie("theme");
	var title = (cookie != null) ? cookie : 'theme6';
	addClassName(document.getElementsByTagName('body')[0], title)
	
	if(Browser.opera) {
		addEvent(window, 'load', function () { setActiveStyleSheet(title) } )
	} else {
		setActiveStyleSheet(title);
	}		
}


// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "/") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "/") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

var menuCookie;
var tempString;
if(!(tempString = getcookie("menuCookie"))){
	setcookie('menuCookie', '1 1 1 1 1 1 1 1');
	menuCookie = [1, 1, 1, 1, 1, 1, 1, 1];
} else {
	menuCookie = tempString.split(" ");
}
var menuNames = ["menuNews", "menuGameGuide", "menuInteractive", "menuCommunity", "menuAccount", "menuSupport", "menuMedia", "menuStore"];

//hideNewMenu hides a selected dynamic menu
function hideNewMenu(menuNum){
	document.getElementById("menuContainer"+menuNum).style.display="none";
}

//showNewMenu displays a selected dynamic menu or loads it if it hasn't already been loaded.
function showNewMenu(menuNum){

	try{
	if(eval("window.frames.menuIframe" + menuNum + ".Crtd!=true")){
		eval("window.frames.menuIframe" + menuNum + ".Go()");
	}
	}catch(err){}
	try{
	document.getElementById("menuContainer"+menuNum).style.display="block";
	}catch(err){}

}
//FoldMenu is used when scanning cookies on page load
function foldMenu(targ,type)
{   if(type==1){
	document.getElementById("menu"+targ+"-inner").style.display = "none";		
	document.getElementById("menu"+targ+"-button").className = "menu-button-off";
	document.getElementById("menu"+targ+"-collapse").className = "leftMenu-plusLink";
	document.getElementById("menu"+targ+"-icon").className = "menu"+targ+"-icon-off";
	document.getElementById("menu"+targ+"-header").className = "menu"+targ+"-header-off";
	}
	else
	{
	document.getElementById("menu"+targ+"-inner").style.display = "block";		
	document.getElementById("menu"+targ+"-button").className = "menu-button-on";
	document.getElementById("menu"+targ+"-collapse").className = "leftMenu-minusLink";
	document.getElementById("menu"+targ+"-icon").className = "menu"+targ+"-icon-on";
	document.getElementById("menu"+targ+"-header").className = "menu"+targ+"-header-on";
	}

}

function toggleNewMenu(menuID) {
	
	var menuNum = parseInt(menuID)+1;
	//alert("hi")

	var toggleState = menuCookie[menuID];
	var menuName = menuNames[menuID]+ "-inner";
    var collapseLink = menuNames[menuID]+ "-collapse";
    var menuVisual = menuNames[menuID]+ "-icon";
    var menuHeader = menuNames[menuID]+ "-header";
    var menuButton = menuNames[menuID]+ "-button";
    
	
	if (toggleState == 0) {

		try{showNewMenu(menuNum);}catch(err){}
		document.getElementById(menuName).style.visibility = "visible";
		document.getElementById(menuName).style.display = "block";		
        document.getElementById(menuButton).className = "menu-button-on";
        document.getElementById(collapseLink).className = "leftMenu-minusLink";
        document.getElementById(menuVisual).className = menuNames[menuID]+ "-icon-on";
        document.getElementById(menuHeader).className = menuNames[menuID]+ "-header-on";
		menuCookie[menuID] = 1;
	} else {
		try{hideNewMenu(menuNum);}catch(err){}
		document.getElementById(menuName).style.visibility = "hidden";
		document.getElementById(menuName).style.display = "none";		
        document.getElementById(menuButton).className = "menu-button-off";
        document.getElementById(collapseLink).className = "leftMenu-plusLink";
        document.getElementById(menuVisual).className = menuNames[menuID]+ "-icon-off";
        document.getElementById(menuHeader).className = menuNames[menuID]+ "-header-off";
		menuCookie[menuID] = 0;
	}
		var theString = menuCookie[0] + " " +menuCookie[1]+ " " +menuCookie[2]+ " " +menuCookie[3]+ " " +menuCookie[4]+ " " +menuCookie[5] + " " +menuCookie[6] + " " +menuCookie[7];
		setcookie('menuCookie', theString);	


}
function toggleMenu(menuID) {
	
	var menuNum = parseInt(menuID)+1;

	var toggleState = menuCookie[menuID];
	var menuName = menuNames[menuID]+ "-inner";
    var collapseLink = menuNames[menuID]+ "-collapse";
    var menuVisual = menuNames[menuID]+ "-icon";
    var menuHeader = menuNames[menuID]+ "-header";
    var menuButton = menuNames[menuID]+ "-button";
	
	if (toggleState == 0) {

		showMenu(menuNum);
		document.getElementById(menuName).style.visibility = "visible";
		document.getElementById(menuName).style.display = "block";		
        document.getElementById(menuButton).className = "menu-button-on";
        document.getElementById(collapseLink).className = "leftMenu-minusLink";
        document.getElementById(menuVisual).className = menuNames[menuID]+ "-icon-on";
        document.getElementById(menuHeader).className = menuNames[menuID]+ "-header-on";
		menuCookie[menuID] = 1;
	} else {
		hideMenu(menuNum);
		document.getElementById(menuName).style.visibility = "hidden";
		document.getElementById(menuName).style.display = "none";		
        document.getElementById(menuButton).className = "menu-button-off";
        document.getElementById(collapseLink).className = "leftMenu-plusLink";
        document.getElementById(menuVisual).className = menuNames[menuID]+ "-icon-off";
        document.getElementById(menuHeader).className = menuNames[menuID]+ "-header-off";
		menuCookie[menuID] = 0;
	}
		
		var theString = menuCookie[0] + " " +menuCookie[1]+ " " +menuCookie[2]+ " " +menuCookie[3]+ " " +menuCookie[4]+ " " +menuCookie[5] + " " +menuCookie[6] + " " +menuCookie[7];
		setcookie('menuCookie', theString);	
}

function addClassName(e, className) {
	var e = $(e);
	if(!hasClassName(e, className))
		e.className += (e.className ? ' ' : '') + className;
}
function hasClassName(e, className) {
	return (new RegExp('(^|\\s)' + className + '(\\s|$)').test($(e).className));
}
function toggle(e) {
	(visible(e) ? hide : show)(e);
}
function removeClassName(e, className) {
	var e = $(e);
	e.className = e.className.replace(new RegExp('(^|\\s+)' + className + '(\\s+|$)'), ' ').trim();
}
function $(e) {
	if(typeof e == 'string')
    	return document.getElementById(e);
	return e;
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
}
var Timers = {
	set: function(id, code, timeout, allowMultiple) {
		if(Timers[id] != null && !allowMultiple)
			Timers.clear(id);
		Timers[id] = window.setTimeout(code, timeout);
	},
	clear: function(id) {
		window.clearTimeout(Timers[id]);
		Timers[id] = null;
	}
};


function toggleEntry(elem) {
	var CLASSNAME_COLLAPSED = "collapsed";
	var parentElem = elem.parentNode.parentNode;
	var COOKIE_NAME = ( parentElem.id.indexOf('news') != -1 ) ? "wow-news-states" : "wow-community-states";
	
	if(parentElem.className.indexOf(CLASSNAME_COLLAPSED) != -1) { 
		removeClassName(parentElem, CLASSNAME_COLLAPSED) 
	} else { 
		addClassName(parentElem, CLASSNAME_COLLAPSED);
	}
	
	var newsStateCookie = readCookie(COOKIE_NAME);
	if(newsStateCookie) {
		var pos = parseInt(parentElem.id.substring(parentElem.id.length - 1) - 1);
		a = newsStateCookie.split("%2C");
		a.splice(pos, 1, hasClassName(parentElem, CLASSNAME_COLLAPSED) ? 0 : 1);
		setcookie(COOKIE_NAME , a);
	}
}


function toggleCommEntry(commID) {
//alert(newsID);
//alert(document.getElementById(newsID).innerHTML)


	//var toggleState = getcookie(newsID)
	var commEntry = "community"+commID;
    var collapseLink = "plus"+commID;

	if (document.getElementById(commEntry).style.display == 'block') {
		document.getElementById(commEntry).style.display = "none";		
        document.getElementById(collapseLink).className = "news-plusLink";
		setcookie(commEntry, "0");	
	} else {
		document.getElementById(commEntry).style.display = "block";		
        document.getElementById(collapseLink).className = "news-minusLink";
		setcookie(commEntry, "1");	
	}
}

function adCode(targ,type)
{
	var random = Math.round(Math.random() * 100000000);
	if (!pageNum) var pageNum = Math.round(Math.random() * 100000000);
	type_wh = type.toUpperCase().split("X"); homevar = (type.toLowerCase()=="300x250")?".HOME":"";
	//
	innert = '<IFRAME SRC="http://cgm.adbureau.net/hserver/acc_random=' + random + '/SITE=WOW.COM'+homevar+'/AREA=NETWORK/AAMSZ='+type+'/pageid=' + pageNum + '" NORESIZE SCROLLING="NO" HSPACE="0" VSPACE="0" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0" WIDTH="'+type_wh[0]+'" HEIGHT="'+type_wh[1]+'" allowTransparency="true">';
	innert += '<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="http://cgm.adbureau.net/jnserver/acc_random=' + random + '/SITE=WOW.COM'+homevar+'/AREA=NETWORK/AAMSZ='+type+'/pageid=' + pageNum + '">';
	innert += '</SCRIPT></IFRAME>';
	$(targ).innerHTML = innert;
}


function addEvent(obj, evType, fn) {
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, false);
        return true;
    } else if (obj.attachEvent) {
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    } else {
        return false;
    }
}

function removeEvent(obj, evType, fn) {
	if(obj.removeEventListener) {
		obj.removeEventListener(evType, fn, false);
		return true;
	} else if(obj.detatchEvent || Browser.ie)
		return obj.detachEvent('on' + evType, fn);
	return false;
}


	addEvent(window, 'resize', positionThemeBg);

    function counterTracker () { // used to append a tracking image
    var axel = Math.random()+ "";
    var a = axel * 10000000000000;
        var cImg = document.createElement("img");
        cImg.src = "http://ad.fr.doubleclick.net/activity;src=1353033;type=wow01;cat=hpwow01;ord=1;num=" + a + "?";
        cImg.style.height = "1px";
        cImg.style.width = "1px";
        document.getElementById("content").appendChild(cImg);
    }

function rePosition() {
    return; /*catching old pages*/
}

function resizeContainer(){ // moved here from xslxml_transform.js
if (document.getElementById("contentTable")) {
	var obj2 = document.getElementById("cnt");
	var obj3 = document.getElementById("contentTable");
	var marginTop = 75;
	
/*			var padding = (is_safari) ? 80 : 42;*/
	var newHeight = obj3.offsetHeight;
	var cnt_width = parseInt(obj2.offsetWidth);
	var contentTable_width = parseInt(obj3.offsetWidth);

	var padding = 2;
	var diff = 80 + padding;
	if ((contentTable_width + diff) > cnt_width)	{
		obj2.style.paddingRight = (((contentTable_width + diff) - cnt_width) * 2) + 16 + "px";
	} else {
		obj3.style.width = "668px";
		obj2.style.width = (668 + diff) +  "px";
	}
	
/*	if (newHeight > 1000) {
	if (location.href.indexOf('/news/') != -1) {	obj2.style.height = (obj3.offsetHeight) + "px"; } 
	else { obj2.style.height = (obj3.offsetHeight) + "px"; }
	} else { 
		obj2.style.height = "1000px";
	}*/

	try {
		if (toolTipPage) {
			loadTable(); switchClick('alliance','horde');
			levelBracket=5; reloadTable();
		}
	}catch(er){}
	}
}


var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

//printFlash uses innerHTML to render flash objs to get around the IE flash rendering issue
function printFlash(id, src, wmode, menu, bgcolor, width, height, quality, base, flashvars, noflash){
	//alert("here")
	
	if(MM_FlashCanPlay){
	
		
		flashString = '<object id= "' + id + 'Flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '">\
				            <param name="movie" value="' + src + '"/>\
				            <param name="quality" value="' + quality + '"/>';
		if(base){
		flashString+='<param name="base" value="' + base + '"/>';
		}
		
		flashString+='		<param name="flashvars" value="' + flashvars + '"/>\
							<param name="bgcolor" value="' + bgcolor + '" />\
							<param name="menu" value="' + menu + '"/>\
							<param name="wmode" value="' + wmode + '"/>\
							<param name="salign" value="l" />\
				            <embed name= "' + id + 'Flash" src="' + src + '" wmode="' + wmode + '" menu="' + menu + '" bgcolor="' + bgcolor + '" width="' + width + '" height="' + height + '" quality="' + quality + '" pluginspage="http://www.macromedia.com/go/getflas/new-hplayer" type="application/x-shockwave-flash" salign="l" base="' + base + '" flashvars="' + flashvars + '" />\
						</object>';
		
	}else{
	
		flashString=noflash;
	
	}
	
	if(is_ie)
		document.write(flashString);
	else
		document.getElementById(id).innerHTML = flashString;
}

    function getLang () {
        var URL=location.href;
        var lg = "";
    	if (URL.indexOf('/en/') != -1) lg = "en";
    	else if (URL.indexOf('/fr/') != -1) lg = "fr";
    	else if (URL.indexOf('/de/') != -1) lg = "de";
    	else if (URL.indexOf('/es/') != -1) lg = "es";
    	else if (URL.indexOf('/ru/') != -1) lg = "ru";
		else { lg = "en"; }
		return lg;
    }


///////// OLD SCRIPTS for subpages    
function showComplete(showThis) {
	document.getElementById(showThis).style.display = "inline";
	document.getElementById(showThis).style.visibility = "visible";
}

function hideComplete(showThis) {
	document.getElementById(showThis).style.display = "none";
	document.getElementById(showThis).style.visibility = "visible";
}

// 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("temp/js/pixel.gif",name,winFeatures)
		spawn.document.write("<html> <head> <title>" + caption + "<\/title> <\/head> <body onBlur='self.close()' background= " + screenshot + "><\/body><\/html>"); 
		spawn.document.close();
	}
}

//Show layer//
function showLayer(layerName){
	obj = document.getElementById(layerName);
	obj.style.visibility="visible";
}

//Hide layer//
function hideLayer(layerName){
	obj = document.getElementById(layerName);
	obj.style.visibility="hidden";
}

function popUp (url, width, height, name) {
    widthHeight = "width=" + width + ",height=" + height;
    winFeatures = "width=" + width + ",height=" + height + ",menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,location=no"
    spawn = window.open(url,name,winFeatures);
}

function popUp_noscroll (url, width, height, name) {
    widthHeight = "width=" + width + ",height=" + height;
    winFeatures = "width=" + width + ",height=" + height + ",menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,location=no"
    spawn = window.open(url,name,winFeatures);
}

function searchCall(lang){
    var searchTypeValue = /*document.topSearch.searchType.options[document.topSearch.searchType.selectedIndex].value*/ "site";
    var searchBoxValue = document.topSearch.searchBox.value;
    searchBoxValue = searchBoxValue.replace(/</g, "").replace(/>/g, "");
    searchBoxValue = searchBoxValue.replace(/script(.*)/g, "");    
    searchBoxValue = searchBoxValue.replace(/eval\((.*)\)/g, "");
    
    
	 if(searchTypeValue=="faqsite"){
        document.location.href="http://eu.blizzard.com/support/search.xml?gameId=11&searchQuery=" + encodeURIComponent(searchBoxValue);
    } else if (searchTypeValue=="site"){
        document.location.href="/"+lang+"/search/searchResults.xml?q=" + encodeURIComponent(searchBoxValue);
    } 
    return false;
}
function searchBoxFocus(){
            document.getElementById("searchBox").focus();
}

//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

/* #################################################################### */ 



