
/*
 =================================================
 | Copyright (C) 2007 Pylyaev Yuriy Anatol`evich |
 =================================================
     | SOFTWARE: Image positionning script |
     |-------------------------------------|
     | TERMS AND CONDITIONS: "license.txt" |
     +++++++++++++++++++++++++++++++++++++++
*/

function repose(){

document.getElementById("trakt").style.display="none";
        if (window.innerHeight && window.scrollMaxY) {
                xScroll = document.body.scrollWidth;
                yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
        } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
                xScroll = document.documentElement.scrollWidth;
                yScroll = document.documentElement.scrollHeight;
        } else { // Explorer Mac...would also work in Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
        }

        if (self.innerHeight) { // all except Explorer
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
        } else if (document.height) { // Firefox
                windowWidth = document.width;
                windowHeight = document.height;
        }
        
         // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
                pageHeight = windowHeight;
        } else {
                pageHeight = yScroll;
        }
        if(xScroll < windowWidth){
                pageWidth = windowWidth;
        } else {
                pageWidth = xScroll;
        }
        
        if(xScroll > windowWidth) pageHeight=pageHeight-20;
        if(yScroll > windowHeight) pageWidth=pageWidth-20;
	if(pageWidth<1000) pageWidth=1000;

document.getElementById("trakt").style.display="block";
document.getElementById("trakt").style.position="absolute";
document.getElementById("trakt").style.bottom="auto";
document.getElementById("trakt").style.right="auto";
document.getElementById("trakt").style.top=parseInt(pageHeight)-parseInt(document.getElementById("trakt").style.height);
document.getElementById("trakt").style.left=parseInt(pageWidth)-parseInt(document.getElementById("trakt").style.width);
}
repose();
window.onresize=repose;
