var ONLOAD_STACK = new Array();

if(window.attachEvent)
{
	window.attachEvent('onload',function()
	{
		for(var i=0;i<ONLOAD_STACK.length;i++)
		{
			ONLOAD_STACK[i]();
		}
	});
}
else
{
	window.onload = function()
	{
		for(var i=0;i<ONLOAD_STACK.length;i++)
		{
			ONLOAD_STACK[i]();
		}
	}
}



ONLOAD_STACK.push(
function(){

	try{
		var col_1_width = 'width:27px;';
		var col_3_width = 'width:31px;';
		var row_1_height = 'height:25px;';
		var row_3_height = 'height:33px;';
		var editingLanguage = false;
		var divs = document.getElementsByTagName('DIV');
		if(document.location.href.indexOf('/admin?m=8&ID=')!=-1)
		{
			editingLanguage = true;
		}
		for(var i=0;i<divs.length;i++)
		{
			if(divs[i].className=='helpPopup')
			{
				if(editingLanguage)
				{
					var popupParent = divs[i].parentNode.getElementsByTagName('img')[0];
				}
				else
				{
					var popupParent = divs[i].parentNode;
				}


				popupParent.HELP = divs[i];

				popupParent.onmouseout = function(){
					try{
						this.HELP_POPUP.style.display = 'none';
					}catch(e){

					}
				}
				popupParent.onmouseover = function(){
					if(this.HELP_POPUP==null)
					{
						var header = this.HELP.getElementsByTagName('h2')[0].innerHTML;
						var text = '<p>'+this.HELP.getElementsByTagName('p')[0].innerHTML+'</p>';
						var html = '<table cellspacing="0" cellpadding="0"><tr class="header"><td class="cell_1_1" style="background:url(/assets/images/helpPopup/1_1.png) no-repeat bottom left;'+row_1_height+col_1_width+'">&nbsp;</td><td class="cell_1_2" style="background:url(/assets/images/helpPopup/1_2.png) repeat-x bottom left;" nowrap="nowrap">'+header+'</td><td class="cell_1_3" style="background:url(/assets/images/helpPopup/1_3.png) no-repeat bottom left;height:33px;'+row_1_height+col_3_width+'">&nbsp;</td></tr><tr><td class="cell_2_1" style="background:url(/assets/images/helpPopup/2_1.png) repeat-y bottom left;'+col_1_width+'">&nbsp;</td><td class="cell_2_2" style="background:url(/assets/images/helpPopup/2_2.png) repeat-x bottom left;width:150px;">'+text+'</td><td class="cell_2_3" style="background:url(/assets/images/helpPopup/2_3.png) repeat-y bottom left;'+col_3_width+'"/>&nbsp;</td></tr></table>';

						this.HELP_POPUP = document.createElement('DIV');
						this.HELP_POPUP.style.border = '0px';
						this.HELP_POPUP.style.position = 'absolute';
						this.HELP_POPUP.style.zIndex = 10000000;

						if(editingLanguage)
						{
							this.HELP_POPUP = this.parentNode.insertBefore(this.HELP_POPUP,this.parentNode.firstChild);
						}
						else
						{
							this.HELP_POPUP = this.insertBefore(this.HELP_POPUP,this.firstChild);
						}

						this.HELP_POPUP.innerHTML = html;
						this.HELP_POPUP.className = 'helpPopup';

						//Adjust the position of the box depending on whether the help is left of right nav based
						if(this.parentNode.parentNode.id=='left')
						{
							this.HELP_POPUP.style.left = (getAbsoluteLeft(this)+this.offsetWidth-0)+'px';

							

							var im = new Image();
							isIE6()==true ? im.src = '/assets/images/helpPopup/gifs/arrow_left.gif' : im.src = '/assets/images/helpPopup/arrow_left.png';
							im.style.position = 'absolute';
							im.style.top = getAbsoluteTop(this.HELP_POPUP)+15+'px';
							im.style.left = getAbsoluteLeft(this.HELP_POPUP)-48+'px';
							this.HELP_POPUP.appendChild(im);
						}
						else if(this.parentNode.parentNode.id=='right')
						{
							this.HELP_POPUP.style.left = (getAbsoluteLeft(this)-this.HELP_POPUP.offsetWidth-200)+'px';

							var im = new Image();
							isIE6()==true ? im.src = '/assets/images/helpPopup/gifs/arrow_right.gif' : im.src = '/assets/images/helpPopup/arrow_right.png';
							im.style.position = 'absolute';
							im.style.top = getAbsoluteTop(this.HELP_POPUP)+15+'px';
							im.style.left = getAbsoluteLeft(this.HELP_POPUP)+202+'px';
							this.HELP_POPUP.appendChild(im);
						}

						if(editingLanguage)
						{
							this.HELP_POPUP.style.left = getAbsoluteLeft(this)+20+'px';

						}
					}
					this.HELP_POPUP.style.display = 'block';
					try{this.removeChild(this.HELP);}catch(e){}
				}
			}
			//ie6FixPng();
		}
	}catch(e){
		alert(e);
	}
}
);



var ie6FixPng = function()
{
	return;
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (document.body.filters))
	{
		for(var i=0; i<document.images.length; i++)
		{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}

}
//ONLOAD_STACK.push(ie6FixPng);

function isIE6()
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (document.body.filters) && (version<7))
	{
		return true;
	}
	return false;
}
function getScreenWidth() {
	try{
		if (document.all) return(document.body.clientWidth + document.body.scrollLeft)
		else return(window.innerWidth + window.scrollX)
	}catch(e){

	}
}
function getScreenHeight() {
	try{
		if (document.all) return(document.body.clientHeight + document.body.scrollTop)
		else return(window.innerHeight + window.scrollY)
	}catch(e){

	}
}
function getAbsoluteLeft(o) {
	try{
		var oParent;
		var oLeft = o.offsetLeft            // Get left position from the parent object
		while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
			oParent = o.offsetParent    // Get parent object reference
			oLeft += oParent.offsetLeft // Add parent left position
			o = oParent
		}
		// Return left postion
		return oLeft
	}catch(e){

	}
}
function getAbsoluteTop(o) {
	try{
		var oTop = o.offsetTop            // Get top position from the parent object
		while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
			var oParent = o.offsetParent  // Get parent object reference
			oTop += oParent.offsetTop // Add parent top position
			o = oParent
		}
		// Return top position
		return oTop
	}catch(e){

	}
}