var cX = 0;
var cY = 0;
var rX = 0;
var rY = 0;
var aX = 0;
if (typeof(window.innerWidth) == 'number') {
    aX = window.innerWidth; //available screen width
}
else {
    aX = document.documentElement.clientWidth;
}

var relFactorX = (aX - 970)/2;
function UpdateCursorPosition(e){
    cX = e.screenX; //x position of pointer
    cY = e.pageY;
}

function UpdateCursorPositionDocAll(e){
    cX = event.screenX + parseInt(document.documentElement.scrollLeft);  //x position of pointer
    cY = event.clientY + parseInt(document.body.scrollTop) + parseInt(document.documentElement.scrollTop);
}

function AssignPosition(d) {
    
    d.style.left = (cX - relFactorX) + 'px'; //0 is from HTML postion, so negate
    d.style.top = cY+'px';
    
    //alert(d.style.left + " " + d.style.top);
}

function HideContent(eID) {
	var dd = document.getElementById(eID);    
    // get the display status
    stat = dd.style.display;     
    if(stat == "block"){
    	dd.style.display = "none";   
    }
}

function ShowContent(eID) {
    var dd = document.getElementById(eID);
    
    // get the display status
    stat = dd.style.display;     
    if(stat != "block"){    	
    	//AssignPosition(dd);    
        dd.style.display = "block";    	
    }    
}

if(document.all) {
    document.onclick = UpdateCursorPositionDocAll;
}
else {
    document.onclick = UpdateCursorPosition;
}
