function getXPos(obj){
        var curleft = 0;
        if (obj.offsetParent){
            while (obj.offsetParent){
                curleft += obj.offsetLeft
                obj = obj.offsetParent;
            }
        }else if (obj.x)
            curleft += obj.x;
        
        return curleft;
    }
     
    function getYPos(obj){
        var curtop = 0;
        if (obj.offsetParent){
            while (obj.offsetParent){
                curtop += obj.offsetTop
                obj = obj.offsetParent;
            }
        }else if (obj.y)
            curtop += obj.y;

        return curtop;
    }
    function getViewportHeight() {
    if (window.innerHeight!=window.undefined) return window.innerHeight;
    if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
    if (document.body) return document.body.clientHeight; 
    return window.undefined; 
    }

    function getViewportWidth() {
        if (window.innerWidth!=window.undefined) return window.innerWidth; 
        if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
        if (document.body) return document.body.clientWidth; 
        return window.undefined; 
    }

    function centerElement(elem,width, height) {
            if (width == null || isNaN(width)) {
                width = 300;
            }
            if (height == null) {
                height = 200;
            }
            elem.style.position = 'absolute';
            
            elem.style.width=width;
            elem.style.height=height;
            
            var fullHeight = getViewportHeight();
            var fullWidth = getViewportWidth();
            
            var theBody = document.body;
            
            var scTop = parseInt(theBody.scrollTop,10);
            var scLeft = parseInt(theBody.scrollLeft,10);
            elem.style.top = (scTop + ((fullHeight - (height)) / 2)) + "px";
            elem.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
        }
    function centerElementById(elemId,width, height) {
            elem = document.getElementById(elemId);
            if (width == null || isNaN(width)) {
                width = 300;
            }
            if (height == null) {
                height = 200;
            }
            elem.style.position = 'absolute';
            
            elem.style.width=width;
            elem.style.height=height;
            
            var fullHeight = getViewportHeight();
            var fullWidth = getViewportWidth();
            
            var theBody = document.body;
            
            var scTop = parseInt(theBody.scrollTop,10);
            var scLeft = parseInt(theBody.scrollLeft,10);
            elem.style.top = (scTop + ((fullHeight - (height)) / 2)) + "px";
            elem.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
    }
    
    if(typeof(photoalbum_load_callback)=='function'){
        photoalbum_load_callback();
    }

