/*
    PopUp Script
    (c) 2009 Frank Liebelt
    dont copy or modify it without given permissions by
    frank.liebelt@freenet.de
*/

function closePopUp()
{
    var toCloseDIV1 = document.getElementById('blender');
    var toCloseDIV2 = document.getElementById('popup');
    var rootEL = document.body;
    rootEL.removeChild(toCloseDIV1);
    rootEL.removeChild(toCloseDIV2);
}

function showPopup(w, h, desc)
{
    // Main DIV
    var popUp      = document.createElement('div');
    // Image DIV
    var closeIMG   = document.createElement('div');
    // Headline DIV
    var headDIV    = document.createElement('div');
    // Headline H
    var headLine   = document.createElement('h');
    // Content DIV
    var contentDIV = document.createElement('div');
    // Root Element
    var rootEL     = document.body;
    // Background-Blender
    var blender    = document.createElement('div');

    var fh = h;
    var fw = w;
    var hh = h / 2;
    var hw = w / 2;

    var bodyHeight = document.body.clientHeight;
    if (bodyHeight < fh ) {
        hh = bodyHeight / 2 - 10;
    }

    blender.id               = 'blender';
    blender.style.backgroundColor = '#000000';
    blender.style.width      = '100%';
    blender.style.height     = '100%';
    blender.style.zIndex     = 99;
    blender.style.top        = '0';
    blender.style.left       = '0';
    blender.style.position   = 'absolute';
	blender.style.MozOpacity = 0.8;
	blender.style.opacity    = 0.8;
	blender.style.filter     = "alpha(opacity=80)";
	
    popUp.id                    = 'popup';
    popUp.style.top             = '50%';
    popUp.style.left            = '50%';
    popUp.style.margin          = '-' + hh + 'px 0 0 -' + hw + 'px';
    popUp.style.width           = fw + 'px';
    popUp.style.height          = fh + 'px';
    popUp.style.position        = 'absolute';
    popUp.style.visibility      = 'visible';
    popUp.style.border          = '1px solid #CCCCCC';
    popUp.style.zIndex          = 100;

    headDIV.style.width           = fw + 'px';
    headDIV.style.height          = '18px';
    headDIV.style.position        = 'absolute';
    headDIV.style.top             = 0;
    headDIV.style.borderBottom    = '1px solid #CCCCCC';
    headDIV.style.backgroundColor = '#CCCCCC';
    headDIV.align                 = 'center';
    headDIV.style.paddingTop      = '0px';
    
    headLine.style.color       = '#000000';
    headLine.style.fontSize    = '14px';
    headLine.style.fontWeight  = 'normal';
    headLine.style.fontFamily  = 'Arial, Helvetica, sans-serif';
    headLine.innerHTML         = desc;
    
    headDIV.appendChild(headLine);

    closeIMG.style.width     = '18px';
    closeIMG.style.height    = '18px';
    closeIMG.style.position  = 'absolute';
    closeIMG.style.top       = '0px';
    closeIMG.style.right     = '1px';
    closeIMG.style.border    = '0';
    closeIMG.style.cursor    = 'pointer';
    closeIMG.innerHTML       = '<img src="/images/close2.gif" alt="Schliessen">';
    closeIMG.onclick         = new Function("closePopUp()");

    headDIV.appendChild(closeIMG);
    
    contentDIV.style.width           = fw + 'px';
    contentDIV.style.height          = fh - 18 + 'px';
    contentDIV.style.position        = 'absolute';
    contentDIV.style.visibility      = 'visible';
    contentDIV.style.top             = '18px';
    contentDIV.style.backgroundColor = '#CCCCCC';
    contentDIV.style.margin          = '0';
    contentDIV.innerHTML       = '<img src="/umzug.jpg" alt="">';
//	contentDIV.style.backgroundImage = 'url('/umzug.jpg')';
//	contentDIV.style.backgroundImage = 'url(' + url + ')';

    popUp.appendChild(headDIV);
    popUp.appendChild(contentDIV);
    
    rootEL.appendChild(blender);
    rootEL.appendChild(popUp);
}

