/* $Id: tooltip.js 7886 2005-11-23 19:10:30Z nijel $ */


/**
 * Displays the Tooltips (hints), if we have some
 * 2005-01-20 added by Michael Keck (mkkeck)
 */
var keyid="";
var ttXpos = 0, ttYpos = 0;
var marinLeft=0;
var marginRight=0;
// Check if browser does support dynamic content and dhtml
var ttNS4 = (document.layers) ? 1 : 0;           // the old Netscape 4
var ttIE4 = (document.all) ? 1 : 0;              // browser wich uses document.all
var ttDOM = (document.getElementById) ? 1 : 0;   // DOM-compatible browsers
if (ttDOM) { // if DOM-compatible, set the others to false
    ttNS4 = 0;
    ttIE4 = 0;
}

if ( (ttDOM) || (ttIE4) || (ttNS4) ) {
    // mouse-event
    if ( ttNS4 ) {
        document.captureEvents(Event.MOUSEMOVE);
    } else {
        document.onclick = mouseClick;
    }
}

function mouseClick(e) {
    if ( typeof( event ) != 'undefined' ) {
        ttXpos = event.x;
        ttYpos = event.y;
		
		plusX = document.body.scrollLeft;
        plusY = document.body.scrollTop;
		ttXpos =  ttXpos + plusX;
		ttYpos =  ttYpos + plusY;
		height=document.body.scrollHeight;
	    width=document.body.scrollWidth;
		} else {
        ttXpos = e.pageX;
        ttYpos = e.pageY;
	    height=document.body.offsetHeight;
	    width=document.body.offsetWidth;
	}
	marginLeft=0;
	marginRight=0;
	var html=document.documentElement.innerHTML.toLowerCase();
	var table=html.indexOf('table');
	var notable=html.indexOf('div');
	if(notable==-1){
	 notable=1000;
	}
	if(table==-1){
	 table=0;
	}
	if(table<notable && table>0){
	var alignvalue=document.getElementsByTagName('table')[0];
	align=alignvalue.getAttribute('align');
	pagewidth=alignvalue.getAttribute('width');
	if(pagewidth.indexOf('%')>0){
	 widthvalue=parseInt(pagewidth.substring(0,pagewidth.indexOf('%')));
	 pagewidth=width*widthvalue/100;
	}
	pagewidth=parseInt(pagewidth);
	if(align==""){
	 align="center";
	}
	if(align=="right"){
	 marginLeft=width-pagewidth;
	 marginRight=0;
	}else if(align=="left"){
	 marginLeft=0;
	 marginRight=width-pagewidth;
	}else{
	 marginLeft=(width-pagewidth)/2;
	 marginRight=marginLeft;
	}
	}else if(notable>table && table==0 && notable !=1000){
	var align=document.getElementsByTagName('div')[0];
	marginLeft=align.style.marginLeft;
	marginRight=align.style.marginRight;
    pagewidth=align.style.width;
	if(pagewidth==""){
	pagewidth=align.getAttribute('width');
	}else{
	 pagewidth=pagewidth.substring(0,pagewidth.indexOf('px'));
	}
	if(pagewidth.indexOf('%')>0){
	  widthvalue=parseInt(pagewidth.substring(0,pagewidth.indexOf('%')));
	  pagewidth=width*widthvalue/100;
	 }
	 if(marginLeft==marginRight=="auto"){
	  marginLeft=(width-pagewidth)/2;
	  marginRight=marginLeft;
	 }
	}else{
	  marginLeft=0;
	  marginRight=0;
	 }
	marginLeft=parseInt(marginLeft);
	marginRight=parseInt(marginRight);
	var url="http://www.conversionstats.com/getpositions.php?url="+window.location+"&positionX="+ttXpos+"&positionY="+ttYpos+"&resolution="+screen.width+":"+screen.height+"&screenHEIGHT="+height+"&screenWIDTH="+width+"&marginLeft="+marginLeft+"&marginRight="+marginRight;
    var imagevalue=new Image();
	imagevalue.src=url;
	delete imagevalue;
}
