/************************************************************************************************************
Ajax tooltip
Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com

************************************************************************************************************/




/* Custom variables */

/* Offset position of tooltip */
var x_offset_tooltip = 5;
var y_offset_tooltip = 0;

/* Don't change anything below here */


var ajax_tooltipObj = false;
var ajax_tooltipObj_iframe = false;
var ajax_tooltipObj1 = false;
var ajax_tooltipObj1_iframe = false;
var ajax_tooltipObj2 = false;
var ajax_tooltipObj2_iframe = false;
var ajax_tooltipObj3 = false;
var ajax_tooltipObj3_iframe = false;
var ajax_tooltipObj4 = false;
var ajax_tooltipObj4_iframe = false;


var ajax_tooltip_MSIE = false;
if(navigator.userAgent.indexOf('MSIE')>=0)ajax_tooltip_MSIE=true;


function ajax_showTooltip(externalFile,inputObj)
{
	if(!ajax_tooltipObj)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj = document.createElement('DIV');
		ajax_tooltipObj.style.position = 'absolute';
		ajax_tooltipObj.id = 'ajax_tooltipObj';
		document.body.appendChild(ajax_tooltipObj);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow';
		leftDiv.id = 'ajax_tooltip_arrow';
		ajax_tooltipObj.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content';
		ajax_tooltipObj.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj_iframe.style.position = 'absolute';
			ajax_tooltipObj_iframe.border='0';
			ajax_tooltipObj_iframe.frameborder=0;
			ajax_tooltipObj_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj_iframe);
			ajax_tooltipObj_iframe.style.left = '0px';
			ajax_tooltipObj_iframe.style.top = '0px';
		}


	}
	// Find position of tooltip
	ajax_tooltipObj.style.display='block';
	ajax_loadContent('ajax_tooltip_content',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj_iframe.style.width = ajax_tooltipObj.clientWidth + 'px';
		ajax_tooltipObj_iframe.style.height = ajax_tooltipObj.clientHeight + 'px';
	}

	ajax_positionTooltip(inputObj);
}

function ajax_positionTooltip(inputObj)
{
	var leftPos = (ajaxTooltip_getLeftPos(inputObj) - (inputObj.offsetWidth+200));
	var topPos = ajaxTooltip_getTopPos(inputObj);

	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content').offsetWidth +  document.getElementById('ajax_tooltip_arrow').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;

	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	ajax_tooltipObj.style.left = leftPos + 'px';
	ajax_tooltipObj.style.top = topPos + 'px';
//	ajax_tooltipObj.style.left = '400px';
//	ajax_tooltipObj.style.top = '200px';

}
function ajax_hideTooltip()
{
	ajax_tooltipObj.style.display='none';
}

function ajaxTooltip_getTopPos(inputObj)
{
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}

function ajaxTooltip_getLeftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}

function ajax_showTooltip1(externalFile,inputObj)
{
	if(!ajax_tooltipObj1)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj1 = document.createElement('DIV');
		ajax_tooltipObj1.style.position = 'absolute';
		ajax_tooltipObj1.id = 'ajax_tooltipObj1';
		document.body.appendChild(ajax_tooltipObj1);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow1';
		leftDiv.id = 'ajax_tooltip_arrow1';
		ajax_tooltipObj1.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content1';
		ajax_tooltipObj1.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content1';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj1_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj1_iframe.style.position = 'absolute';
			ajax_tooltipObj1_iframe.border='0';
			ajax_tooltipObj1_iframe.frameborder=0;
			ajax_tooltipObj1_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj1_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj1_iframe);
			ajax_tooltipObj1_iframe.style.left = '0px';
			ajax_tooltipObj1_iframe.style.top = '0px';
		}


	}
	// Find position of tooltip
	ajax_tooltipObj1.style.display='block';
	ajax_loadContent('ajax_tooltip_content1',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj1_iframe.style.width = ajax_tooltipObj1.clientWidth + 'px';
		ajax_tooltipObj1_iframe.style.height = ajax_tooltipObj1.clientHeight + 'px';
	}

	ajax_positionTooltip1(inputObj);
}

function ajax_positionTooltip1(inputObj)
{
	var leftPos = (ajaxTooltip_getLeftPos1(inputObj) + inputObj.offsetWidth);
	var topPos = ajaxTooltip_getTopPos1(inputObj);

	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content1').offsetWidth +  document.getElementById('ajax_tooltip_arrow1').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;
	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	ajax_tooltipObj1.style.left = leftPos + 'px';
	ajax_tooltipObj1.style.top = topPos + 'px';
//	ajax_tooltipObj1.style.left = '400px';
//	ajax_tooltipObj1.style.top = '200px';

}

function ajax_hideTooltip1()
{
	ajax_tooltipObj1.style.display='none';
}
function ajaxTooltip_getTopPos1(inputObj)
{
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}



function ajax_showTooltip2(externalFile,inputObj,left_offset,top_offset)
{

	if(!ajax_tooltipObj2)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj2 = document.createElement('DIV');
		ajax_tooltipObj2.style.position = 'absolute';
		ajax_tooltipObj2.id = 'ajax_tooltipObj2';
		document.body.appendChild(ajax_tooltipObj2);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow1';
		leftDiv.id = 'ajax_tooltip_arrow1';
		ajax_tooltipObj2.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content2';
		ajax_tooltipObj2.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content2';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj2_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj2_iframe.style.position = 'absolute';
			ajax_tooltipObj2_iframe.border='0';
			ajax_tooltipObj2_iframe.frameborder=0;
			ajax_tooltipObj2_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj2_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj2_iframe);
			ajax_tooltipObj2_iframe.style.left = '0px';
			ajax_tooltipObj2_iframe.style.top = '0px';
		}


	}
	// Find position of tooltip
	ajax_tooltipObj2.style.display='block';
	ajax_loadContent('ajax_tooltip_content2',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj2_iframe.style.width = ajax_tooltipObj2.clientWidth + 'px';
		ajax_tooltipObj2_iframe.style.height = ajax_tooltipObj2.clientHeight + 'px';
	}

	if(typeof(left_offset)=='undefined')
		ajax_positionTooltip2(inputObj,0,0);
	else
		ajax_positionTooltip2(inputObj,left_offset,top_offset);
}

function ajax_positionTooltip2(inputObj,left_offset,top_offset)
{
	var leftPos = (ajaxTooltip_getLeftPos1(inputObj) + inputObj.offsetWidth)+left_offset;
	var topPos = ajaxTooltip_getTopPos2(inputObj)-top_offset;
//alert(ajaxTooltip_getTopPos2(inputObj));
	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content2').offsetWidth +  document.getElementById('ajax_tooltip_arrow1').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;
	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	ajax_tooltipObj2.style.left = leftPos + 'px';
	ajax_tooltipObj2.style.top = topPos + 'px';
//	ajax_tooltipObj1.style.left = '400px';
//	ajax_tooltipObj1.style.top = '200px';

}

function ajax_hideTooltip2()
{
	ajax_tooltipObj2.style.display='none';
}
function ajaxTooltip_getTopPos2(inputObj)
{
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}





function ajax_showTooltip3(externalFile,inputObj)
{
	if(!ajax_tooltipObj3)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj3 = document.createElement('DIV');
		ajax_tooltipObj3.style.position = 'absolute';
		ajax_tooltipObj3.id = 'ajax_tooltipObj3';
		document.body.appendChild(ajax_tooltipObj3);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow1';
		leftDiv.id = 'ajax_tooltip_arrow1';
		ajax_tooltipObj3.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content3';
		ajax_tooltipObj3.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content3';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj3_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj3_iframe.style.position = 'absolute';
			ajax_tooltipObj3_iframe.border='0';
			ajax_tooltipObj3_iframe.frameborder=0;
			ajax_tooltipObj3_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj3_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj3_iframe);
			ajax_tooltipObj3_iframe.style.left = '0px';
			ajax_tooltipObj3_iframe.style.top = '0px';
		}


	}
	// Find position of tooltip
	ajax_tooltipObj3.style.display='block';
	ajax_loadContent('ajax_tooltip_content3',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj3_iframe.style.width = ajax_tooltipObj3.clientWidth + 'px';
		ajax_tooltipObj3_iframe.style.height = ajax_tooltipObj3.clientHeight + 'px';
	}

	ajax_positionTooltip3(inputObj);
}

function ajax_positionTooltip3(inputObj)
{
	var leftPos = (ajaxTooltip_getLeftPos1(inputObj) + inputObj.offsetWidth);
	var topPos = ajaxTooltip_getTopPos1(inputObj);

	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content3').offsetWidth +  document.getElementById('ajax_tooltip_arrow1').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;
	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	ajax_tooltipObj3.style.left = leftPos + 'px';
	ajax_tooltipObj3.style.top = topPos + 'px';
//	ajax_tooltipObj1.style.left = '400px';
//	ajax_tooltipObj1.style.top = '200px';

}

function ajax_hideTooltip3()
{
	ajax_tooltipObj3.style.display='none';
}

function ajaxTooltip_getLeftPos1(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}


function ajax_showTooltip4(externalFile,inputObj,left_offset,top_offset)
{

	if(!ajax_tooltipObj4)	/* Tooltip div not created yet ? */
	{
		ajax_tooltipObj4 = document.createElement('DIV');
		ajax_tooltipObj4.style.position = 'absolute';
		ajax_tooltipObj4.id = 'ajax_tooltipObj4';
		document.body.appendChild(ajax_tooltipObj4);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow4';
		leftDiv.id = 'ajax_tooltip_arrow4';
		ajax_tooltipObj4.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content4';
		ajax_tooltipObj4.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content4';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj4_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj4_iframe.style.position = 'absolute';
			ajax_tooltipObj4_iframe.border='0';
			ajax_tooltipObj4_iframe.frameborder=0;
			ajax_tooltipObj4_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj4_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj4_iframe);
			ajax_tooltipObj4_iframe.style.left = '0px';
			ajax_tooltipObj4_iframe.style.top = '0px';
		}


	}
	// Find position of tooltip
	ajax_tooltipObj4.style.display='block';
	ajax_loadContent('ajax_tooltip_content4',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj4_iframe.style.width = ajax_tooltipObj4.clientWidth + 'px';
		ajax_tooltipObj4_iframe.style.height = ajax_tooltipObj4.clientHeight + 'px';
	}

	if(typeof(left_offset)=='undefined')
		ajax_positionTooltip4(inputObj,0,0);
	else
		ajax_positionTooltip4(inputObj,left_offset,top_offset);
}

function ajax_positionTooltip4(inputObj,left_offset,top_offset)
{
	var leftPos = left_offset;
	var topPos = top_offset;

	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content4').offsetWidth +  document.getElementById('ajax_tooltip_arrow4').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;
	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	ajax_tooltipObj4.style.left = leftPos + 'px';
	ajax_tooltipObj4.style.top = topPos + 'px';
//	ajax_tooltipObj4.style.left = '400px';
//	ajax_tooltipObj4.style.top = '200px';

}

function ajax_hideTooltip4()
{
	ajax_tooltipObj4.style.display='none';
}

function ajax_showTooltip5(externalFile,inputObj,left,top)
{

//	if(!ajax_tooltipObj5)	/* Tooltip div not created yet ? */
	//{
		ajax_tooltipObj5 = document.createElement('DIV');
		ajax_tooltipObj5.style.position = 'absolute';
		ajax_tooltipObj5.id = 'ajax_tooltipObj5';
		document.body.appendChild(ajax_tooltipObj5);


		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow1';
		leftDiv.id = 'ajax_tooltip_arrow1';
		ajax_tooltipObj5.appendChild(leftDiv);

		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content5';
		ajax_tooltipObj5.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content5';

		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj5_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj5_iframe.style.position = 'absolute';
			ajax_tooltipObj5_iframe.border='0';
			ajax_tooltipObj5_iframe.frameborder=0;
			ajax_tooltipObj5_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj5_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj5_iframe);
			ajax_tooltipObj5_iframe.style.left = '0px';
			ajax_tooltipObj5_iframe.style.top = '0px';
		}


//	}
	// Find position of tooltip
	ajax_tooltipObj5.style.display='block';
	ajax_loadContent('ajax_tooltip_content5',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj5_iframe.style.width = ajax_tooltipObj5.clientWidth + 'px';
		ajax_tooltipObj5_iframe.style.height = ajax_tooltipObj5.clientHeight + 'px';
	}

	if(typeof(left)=='undefined')
		ajax_positionTooltip5(inputObj,0,0);
	else
		ajax_positionTooltip5(inputObj,left,top);
}

function ajax_positionTooltip5(inputObj,left,top)
{
	var leftPos = (ajaxTooltip_getLeftPos1(inputObj) + inputObj.offsetWidth)+left;
	var topPos = ajaxTooltip_getTopPos5(inputObj)-top;
	/*
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos
	*/
	var tooltipWidth = document.getElementById('ajax_tooltip_content5').offsetWidth +  document.getElementById('ajax_tooltip_arrow1').offsetWidth;
	// Dropping this reposition for now because of flickering
	//var offset = tooltipWidth - rightedge;
	//if(offset>0)leftPos = Math.max(0,leftPos - offset - 5);
// Comment the last two lines and uncomment the following lines
	//ajax_tooltipObj2.style.left = leftPos + 'px';
	//ajax_tooltipObj2.style.top = topPos + 'px';
	ajax_tooltipObj5.style.left = '1400px';
	ajax_tooltipObj5.style.top = '1200px';

}

function ajax_hideTooltip5()
{
	ajax_tooltipObj5.style.display='none';
}
function ajaxTooltip_getTopPos5(inputObj)
{
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}
