
function getX(obj) {return obj.offsetLeft + (obj.offsetParent ? getX(obj.offsetParent) : obj.x ? obj.x : 0);}
function getY(obj) {return (obj.offsetParent ? obj.offsetTop + getY(obj.offsetParent) : obj.y ? obj.y : 0);}

function hideDiv() {if (divFlag==0) tdiv.style.display='none';}

var divFlag=0;
var picUrl='';
var is_ie = typeof(document.all) != 'undefined';
var is_ie6 = (navigator.userAgent.indexOf('MSIE 6')>-1)?true:false;

function initEmailpic() {
	if (document.getElementById('emailpic')) {
		tCode=document.getElementById('emailpic').innerHTML;
		tdiv = document.createElement('div');
		tdiv.style.display	='none';
		tdiv.style.position	='absolute';
		tdiv.style.left		='-100px';
		tdiv.style.top		='-100px';
		tdiv.innerHTML		= "<div id='emailpic' style='text-align:center;background-color:#fff; width:76px;'>"+tCode+"</div>";

		tdiv.onmouseover	= function() {divFlag=1;}
		tdiv.onmouseout	= function() {divFlag=0;setTimeout(hideDiv, 100);}
		
		theader=document.getElementById("header");
		theader.appendChild(tdiv);

		imgs=document.getElementsByTagName("img");
		
		for (i in imgs) {
			if (imgs[i].width*imgs[i].height>=90000) {
			imgs[i].onmouseover= function() {
				// Only necessary when multiple pictures
				tdiv.style.fontSize	='8px';
				tdiv.innerHTML  = "<div id='emailpic' style='text-align:center; background-color:#fff; width:76px;'>"+tCode+"</div>";

				if (is_ie) tcorrector=document.getElementById('wrapper').offsetLeft-2;
				else tcorrector=0;
				
				tdiv.style.left = (getX(this)+this.width-tcorrector-76)+"px";
				tdiv.style.top  = (getY(this)+this.height-14)+"px";
				tdiv.style.display='block';
				divFlag = 1;
			};
			imgs[i].onmouseout= function() {
				divFlag = 0;
				setTimeout(hideDiv, 100);
				};
			}
		}
	}
}

initEmailpic();

