﻿

$(document).ready( function() {
       
    // give it a little time for html to render
    setTimeout( function() { $('div.scroll-pane').jScrollPane({scrollbarWidth:14}); },0);

    $("#videoChooser img").hover( function() { $(this).fadeTo(100,0.5) } , function() { $(this).fadeTo(100,1) } );
       
    //embed flash    
    var params = {
    menu			: "false",
    scale			: "noScale",
    wmode			: "transparent",
    base		:"global/swf"
    };
    var attributes = {
	    id				: "whatsNewVideo",
	    name            : "whatsNewVideo"
    };
    swfobject.embedSWF("global/swf/whatsNew.swf", "tv", "412", "374", "9.0.115", "global/swf/expressInstall.swf", null, params, attributes);
   
    
    $(".videoThumbs img").each( function(i,img) {
            
            var path = $(img).attr("overlay");
            var bio = $(img).attr("bio");
            
            $("#loader").append("<div class='employeeOverlay' id='employeeOverlay" + i + "'><img src='global/images/employees/" + path + "' /></div>");
 
            $(this).hover( 
                function() {   // on over 
                    var overlay = $("#employeeOverlay" + i).appendTo("body").show();  
                    $(overlay).css("top",$(this).offset().top - 197);
                    $(overlay).css("left",$(this).offset().left + 8);
                }, 
                function() {   // on out
                 $("#employeeOverlay" + i).hide();
                } 
                
            ); // end hover
    }); // end each
    
    if ($.browser.msie === true && $.browser.version < 7) {
        pngfix();
     }

});

function sendToJavaScript (value) {
  
    sendToActionScript (value);
  
}

function sendToActionScript (value) { 

    var obj = document.getElementById("whatsNewVideo");
    obj.sendToActionScript(value);  

}

function loadEmployeeVideo(value) {
    var flashObj = document.getElementById("whatsNewVideo");
    if (flashObj && typeof flashObj.loadEmployeeVideo != "undefined") {
	    flashObj.loadEmployeeVideo(value);
    }
}

function getTourDates(value){
    var flashObj = document.getElementById("whatsNewVideo");
    if (flashObj && typeof flashObj.getTourDates != "undefined") {
	    flashObj.getTourDates(value);
    }
}

function loadAdVideo(value){
    var flashObj = document.getElementById("whatsNewVideo");
    if (flashObj && typeof flashObj.loadAdVideo != "undefined") {
	    flashObj.loadAdVideo(value);
    }
}