/*
Copyright (c) 2009, Swati Raju. All rights reserved.
Author: Swati Raju
version: 1.0.0
*/
var Y = YAHOO;
var yud = YAHOO.util.Dom;
var yue = YAHOO.util.Event;
var yua = YAHOO.util.Anim;
Y.namespace("LBF");
Y.namespace("LBF.pressPage");
/**
    * LBF
    *
    * @module LBF
    * @title LBF
    * @namespace YAHOO.LBF
    * @requires YAHOO, dom, event
    */
Y.LBF.pressPage = function() {
    var wait        = null;
    /**
    * show video
    *
    * @method showVideo
    * @param
    * @returns
    */
    var showVideo = function(e) {
        var content        = yud.get("lb-content");
         content.innerHTML  = "";
         wait = new YAHOO.widget.Panel("wait",  
                    { width: "500px", 
                      fixedcenter: true, 
                      close: true, 
                      draggable: false, 
                      zindex:4,
                      modal: true,
                      visible: true
                     } 
                 );
        
        wait.setHeader("<h2><span><span>FRANK ON FILM</span></span></h2><a href='#' id='lb-close' class='close'></a>");
        var html = "";
        if (this.id == "cbs-vid"){
            html = "<div class='lb-video' id='cbs'><object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/K1QwAEgdn10&hl=en_US&fs=1&\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/K1QwAEgdn10&hl=en_US&fs=1&\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object></div>";
        } else {
            html = "<div class='lb-video' id='vendr'><embed src='http://blip.tv/play/guwVgZWpZAI%2Em4v' type='application/x-shockwave-flash' width='480' height='300' allowscriptaccess='always' allowfullscreen='true'></embed></div>";
        }
        wait.setBody(html);
        wait.render(document.body);
        wait.show();
        yue.on('lb-close', "click", closeVideo);
        yue.on("wait_mask", "click", closeVideo);
        yue.on('tw-sf', "click", closeVideo);
        yue.on("tw-la", "click", closeVideo);
        yue.preventDefault(e);
    }
    /**
    * close video
    *
    * @method closeVideo
    * @param
    * @returns
    */
    var closeVideo = function(e) {
        wait.hide();
        yud.get('vendr').innerHTML = "";
        wait.destroy();
        wait = null;
        yue.preventDefault(e);
    }
    return{
        /**
        * init page
        *
        * @method init
        * @param
        * @returns
        */
        init: function() {
            yue.on("vid", "click", showVideo, null, false);
            yue.on("cbs-vid", "click", showVideo, null, false);
        }
    };
}();
Y.LBF.pressPage.init();