/*
  Floating Mouseover Script
  Will create a div that follows the mouse around like a tooltip
  by Greg Poole (greg@webengine.com.au)
*/

var mousex,mousey;
var detailBox;
var detail_LoadImage="http://www.emailsolutionsv3.com/pricing/images/loading.gif";
var detail_PreLoad;

function preLoadTooltips() {
	if(document.getElementById) {
		document.onmousemove=captureMousePosition;
		
		detailBox = document.getElementById('detail');
		detailBox.description = document.getElementById('description');
		detailBox.image = document.getElementById('image');
		detailBox.client = document.getElementById('client');
		new Image().src=detail_LoadImage;
	}
}
// to find left of an object
function curLeft(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return toreturn;
}
// to find top of an object
function curTop(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return toreturn;
}

//Returns an integer representing the scrollTop of the window (the number of pixels the window has scrolled from the top).
function getScrollTop(){
		return document.all ? (!document.documentElement.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop) : ((window.pageYOffset != 0) ? window.pageYOffset : 0);
}
//getting window height
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

// made content appear in center 
function showCenter(content,width,height) { 
	moveCenter(content,width,height);
	content.style.display='';
	content.style.width=width;
	content.style.visibility='visible';
}

function captureMousePosition(e) {

	if(!detailBox.showBox)
		return;
	
	var x,y;
	if(document.all) {
		x=window.event.x+document.body.scrollLeft;
		y=window.event.y+document.body.scrollTop;
	} else 	if(document.layers || document.getElementById) {
		x=e.pageX;
		y=e.pageY;
	}
	if(x>400) x=x-500;
	detailBox.style.left=x+10;
	
	detailBox.style.top=y+10;
}
function moveCenter(div,width,height)
{
	if(height =='')
		height = div.offsetHeight;
	winLeft = (screen.width-width)/2;
	winTop = (f_clientHeight()-height)/2 +getScrollTop(); 
	div.style.left=winLeft;
	div.style.top =winTop;
}
// made content appear in center 
function showCenter(content,width,height) { 
	moveCenter(content,width,height);
	content.style.display='';
	content.style.width=width;
	content.style.visibility='visible';
}

function showDetail(imgobj,description,img,client,left,top) {
	detailBox.description.innerHTML = description+'';
	detailBox.image.src = detail_LoadImage;
	detail_PreLoad=new Image();
	detail_PreLoad.src=img;
	if(!detail_PreLoad.complete)
		detail_PreLoad.onload=function() { detailBox.image.src = detail_PreLoad.src; }
	else
		detailBox.image.src = detail_PreLoad.src;
	detailBox.client.innerHTML = client;
	detailBox.showBox=true;
	winTop = f_clientHeight() +getScrollTop(); 
	//detailBox.style.left=curLeft(imgobj)+left;
	//detailBox.style.top=curTop(imgobj)+top;
	detailBox.style.visibility='visible';
}


function hideDetail() {
	detailBox.style.visibility='hidden';
	detailBox.style.left=-1000;
	detailBox.style.top=-1000;
	detailBox.showBox=false;
}