/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
function showflash(width, height, url)
{

    var div = document.getElementById('flashdiv');
    if (!div)
    {
        var div = document.createElement('div');
        div.setAttribute('id','flashdiv');
        div.align = "center";
        
        document.getElementById('col3_content').appendChild(div);
    }
    
    var arrayPageScroll = getPageScroll();
    var arrayPageSize = getPageSize();
    var divtop = arrayPageScroll[1] + (arrayPageSize[3] / 15 - 80);

    div.style.width = width+"px";
    div.style.height = height+"px";
    div.style.top = divtop +"px";
    

// <![CDATA[
var height_swf = height+20;
        //pfad, id, breite, höhe, version, Hintergrundfarbe
        var so = new SWFObject("upload/videos/player.swf", "VideoPlayer", width, height_swf, "8", "#000000");
        //Fullscreen erlauben
        so.addParam("allowFullScreen", "true");
        //Skalierung verhindern
        so.addParam("scale", "noScale"); 
        //Menü anzeigen
        so.addParam("menu", "true");    
        //Autostart 0 oder 1
        so.addVariable("autoStart", "1");
        //Hintergrundbild
        so.addVariable("bgPic", "loader.gif");
        //Farbe für RollOver
        so.addVariable("oF", "0x999999");
        //Farbe für Normal
        so.addVariable("nF", "0xffffff");
        //Farbe für Hintergrund der Buttons
        so.addVariable("bgF", "0x305497");
        //Breite und Höhe definieren, wenn die Metatags der FLV diese NICHT beinhalten, b = Breite und h=Höhe
        //so.addVariable("b", height);
        //so.addVariable("h", width);
        //die FLV-Datei
        so.addVariable("file", url);
        so.write("flashdiv");
        // ]]>


    /*Ausschnitt aus der Lightbox-Galerie http://www.huddletogether.com/projects/lightbox2/ */
    var objBody = document.getElementsByTagName("body").item(0);
        
    var objOverlay = document.createElement("div");
    objOverlay.setAttribute('id','overlay');
    objOverlay.style.display = 'none';
    objOverlay.onclick = function() { hideflash(); return false; }
    objBody.appendChild(objOverlay);
    
    // stretch overlay to fill page and fade in
    var arrayPageSize = getPageSize();
        objOverlay.style.height = arrayPageSize[1]+"px";
    //Element.setHeight('overlay', arrayPageSize[1]);
    new Effect.Appear('overlay', { duration: 0.2, from: 0.0, to: 0.8 });
}

function getPageSize(){
    
    var xScroll, yScroll;
    
    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 { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    
    var windowWidth, windowHeight;
    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;
    }   
    
    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else { 
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){  
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }

    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    return arrayPageSize;
}

function getPageScroll(){

    var yScroll;

    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
    }

    arrayPageScroll = new Array('',yScroll) 
    return arrayPageScroll;
}

function hideflash(){
new Effect.Fade('overlay', { duration: 0.2});
document.getElementById('col3_content').removeChild(document.getElementById('flashdiv'));
}


