
/**
 * getDocHeight()
 *
 * @see http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/index.html
 */
 
function getDocHeight()
{
    if (window.innerHeight)
    {
    	theHeight = window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
    {
    	theHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
    	theHeight = document.body.clientHeight;
    }
    
    return theHeight;
}

/**
 * findPos()
 *
 * @see http://www.quirksmode.org/js/findpos.html
 */

function findPos(obj) 
{
    var curleft = curtop = 0;

    if (obj.offsetParent) 
    {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop

        while (obj = obj.offsetParent) 
        {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }

    return [curleft,curtop];
}

/**
 * findOffsetTop()
 */
 
function findOffsetTop(obj)
{
    var pos = findPos(obj);
    return pos[1];
}

/**
 * findOffsetLeft()
 */
 
function findOffsetLeft(obj)
{
    var pos = findPos(obj);
    return pos[0];
}

/**
 * setContentMinHeight()
 */
 
function setContentMinHeight()
{
    document.getElementById('bottom').style.visibility  = "visible";
    return; 
    
    if(!document.getElementById)
    {
        return;
    }
    
    var contentContainer = document.getElementById('contentContainer');
    var footer           = document.getElementById('bottom');
    
    var theBodyHeight    = getDocHeight();
    var offsetFooter     = findOffsetTop(footer);
    var offsetContent    = findOffsetTop(contentContainer);
    
    var diff             = theBodyHeight-offsetContent-contentContainer.offsetHeight-footer.offsetHeight; //contentContainer.offsetHeight-offsetFooter-footer.offsetHeight;//theBodyHeight-offsetFooter-footer.offsetHeight; //contentContainer.offsetHeight-offsetFooter-footer.offsetHeight;
    
    if(document.all)
    {
        diff = diff-10;    
    }
        
    if(diff > 0)
    {
        contentContainer.style.marginBottom = (diff)+"px"; 
    } 
    
    footer.style.visibility  = "visible";
}

/**
 * setCaption()
 */

function setCaption()
{
    if(!document.getElementById)
    {
        return;
    }
    
    var caption = document.getElementById('captionInText');
    
    if(!caption)
    {   
        return;
    }
        
    caption.style.visibility  = "hidden";
    
    var captionHeight  = caption.offsetHeight;
    var picHeight      = getByClassName('div','thePic').offsetHeight;
    var textHeight     = getByClassName('div','theText').offsetHeight;;
    var marginToTop    = picHeight-textHeight-captionHeight;
    
    if(marginToTop > 0)
    {
        caption.style.paddingTop = marginToTop+"px";  
    }
    
    caption.style.visibility  = "visible";
}

function getByClassName(elem, elemClassName)
{
    var elemAll = document.getElementsByTagName(elem);
    
    for(var i = 0; i < elemAll.length; i++)
    {
        if(elemAll[i].className == elemClassName)
        {
            return elemAll[i];    
        }
    }
}

/**
 * doPopup()
 */

function doPopup()
{
    
    var frog = window.open("","wildebeast","width=300,height=150,scrollbars=1,resizable=1")
    var html = "<html><head></head><body style=\"font-family: arial, verdana, sans serif; padding: 2%; font-size: 0.9em; line-height: 140%;\"><p>Die Downloads stehen ab Montag, den 3. Dezember für Sie bereit.</p><a href=\"javascript:window.close()\">Fenster schließen</a></body></html>"

    //variable name of window must be included for all three of the following methods so that
    //javascript knows not to write the string to this window, but instead to the new window

    frog.document.open()
    frog.document.write(html)
    frog.document.close()

    frog.moveTo((screen.width*0.30),250); 
}

/**
 * popupClose()
 */

function winClose()
{
    self.close();
}

 

