/******************************************************************************* * Class for embedding flash into the Lightbox 29.01.2009 * ***************************************************************************** * * @author Stanislav Zorjan - Stasha - [zstasa][@][yahoo].[com] *  * * Licensed under the Creative Commons Attribution 3.0 License * http://creativecommons.org/licenses/by/3.0/ * * - Free for use in both personal and commercial projects * - Attribution requires leaving author name, author link, and the license info intact. */*                            !!!!  ATTENTION !!!                             *//* The FlashInLightBox class uses "swfobject" for embedding flash into the Lightbox * swfobject can be downloaded from: http://code.google.com/p/swfobject/ * ****************************************************************************//* THE INFO ON HOW TO USE THIS CLASS IS ON THE BOTTOM OF THE CLASS *//* Class was build and tested on * Lightbox v2.04       http://www.lokeshdhakar.com/projects/lightbox2/ * swfobject v2.1       http://code.google.com/p/swfobject/ * * Tested on Browsers * IE 6, 7 * FF 3.0.5 * Opera 9.63 * Safari 3.1.2 * Chrome 1.0.154.43/******************************************************************************* * Constructor */function FlashInLightBox(){    var _$this$_ = this;    /*link to video*/    this.url = "";        /**************************************************************************/    /* PARAMETERS */        /*interval after which video is embedded to stage.     *This is needed because of Lightbox animation.     *If the value of timeout is smaller than animation time     *video may be embedded on wrong position, or it won't be      *visible. If You experience such a problems than try to      *increase this value.     */    this.timeout = 3000 // milliseconds;    /* END OF PARAMETERS */    /**************************************************************************/         this.interval = 0;    /***************************************************************************     * Method for embeding video     */    this.embed = function(url){        if(url != ''){            this.url = url;            var imageContainer = document.getElementById("imageContainer");            var overlay = document.getElementById('overlay');            var lightbox = document.getElementById('lightbox');            var close = document.getElementById('bottomNavClose');            overlay.onclick = lightbox.onclick = close.onclick = this.close;                        //document.getElementById('hoverNav').onclick = function(event){event.stopPropagation()}            //document.getElementById('imageDataContainer').onclick = function(event){event.stopPropagation()}            //document.getElementById('imageDetails').onclick = function(event){event.stopPropagation()}                       $('hoverNav').observe('click', (function(event) { event.stop();}));           $('imageDataContainer').observe('click', (function(event) { event.stop();}));           $('imageDetails').observe('click', (function(event) { event.stop();}));            try{                imageContainer.removeChild(document.getElementById("_$flash$_"));            }catch(e){};            var _$flash$_ = document.createElement("div");            var _$flash$__holder = document.createElement("div");            _$flash$_.setAttribute("id", "_$flash$_");            _$flash$__holder.setAttribute("id", "_$flash$__holder");            _$flash$__holder.setAttribute("style", "position:absolute");            _$flash$_.appendChild(_$flash$__holder);            imageContainer.appendChild(_$flash$_);             this.a = setInterval(function(){                _$this$_.embed2()            }, this.timeout);                    }    }    /***************************************************************************     * Method invoked by timer event for embedding     */    this.embed2 = function(){               clearInterval(this.a);        var image = document.getElementById('imageContainer');        var _$flash$_ = document.getElementById('_$flash$_');        _$flash$_.style.position = "absolute";        _$flash$_.style.clear = "both";        _$flash$_.style.top = image.offsetTop + image.offsetTop + image.firstChild.offsetTop +"px";        _$flash$_.style.left = image.offsetLeft  + image.firstChild.offsetLeft+"px";        swfobject.embedSWF(this.url, "_$flash$__holder", parseInt(image.firstChild.offsetWidth), parseInt(image.firstChild.offsetHeight), "9.0.0");    }    this.close = function(){        document.getElementById('_$flash$_').innerHTML = "";    }}/* Creating new object of FlashInLightBox */var flash_in_lightbox = new FlashInLightBox();/* EXAMPLE OF SIMPLE Lightbox LING WITHOUT FLASH *//* <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a> *//* EXAMPLE OF LINK WITH EMBEDDING FLASH TO Lightbox *//* <a onclick="flash_in_lightbox.embed('http://cz.youtube.com/watch?v=d_qRTMKDqXA')" href="images/EMPTY_IMAGE.jpg" rel="lightbox" title="my caption">image #2</a> *//* The flash will be resized to size of image you pass to Lightbox, in this case it is "EMPTY_IMAGE.jpg" *//* First is displayed image You pass to Lightbox and then flash is embedded *//* Order in which javascripts should be included in the html page *//*   <script type="text/javascript" src="js/prototype.js"></script>   <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>   <script type="text/javascript" src="js/lightbox.js"></script>   <script type="text/javascript" src="js/swfobject.js"></script>   <script type="text/javascript" src="js/FlashInLightBox.js"></script>*/
