// JavaScript Document

function getElementPosition(offsetTrail){
	var offsetLeft = 0;
        var offsetTop = 0;
        while(offsetTrail) {
        	offsetLeft += offsetTrail.offsetLeft;
                offsetTop += offsetTrail.offsetTop;
                offsetTrail = offsetTrail.offsetParent;
        }
        return { left:offsetLeft, top:offsetTop }
}

function hideFootnotes() {
	var div = document.getElementById('current_footnote');
        div.className = 'footnote_new';
        div.style.display = 'none';
        return false;
}

function showFootnote(evt, id) {
	var winWidth = document.body.clientWidth;
       var evt = evt || window.event;
       var o = evt.target || evt.srcElement;
       var div = document.getElementById('current_footnote');
       var coords = getElementPosition(o);
       div.innerHTML = '<a href="#" onclick="return hideFootnotes()"><img src="/images/SEO_close.jpg" height="13" width="13" border="0" id="x_image" /></a><div style="float: right; width: 17px; height: 17px"></div><div style="padding: 7px; " >' + document.getElementById(id).innerHTML + '</div>';
       div.className = 'footnote_new_active';
       div = document.getElementById('current_footnote');
       var w = 200;
       div.style.top = (coords.top - 1*o.offsetHeight) + 'px';
       if((winWidth - coords.left) < w) 
       		div.style.left = (coords.left  - 10 - (w - (winWidth- coords.left)))+ 'px';
       else
	       div.style.left = coords.left -300 + 'px';
       div.style.display = 'none';
       div.style.display = 'block';
	   div.style.background = '#f0d4c5';
       evt.cancelBubble = true;
       return false;
}