﻿/* Video Player JS */
$(document).ready(function() {
    
    var videoPlayer;    
    videoPlayer =  '<div id=\"popFlashVoicesDialog\">';		
    videoPlayer += '<div id=\"popFlashVoices\"><div id=\"popFlashTitle\"></div>';		    
    videoPlayer += '<div id=\"closeFlash\"><a href=\"javascript:closeVideoLayer();\">Close</a></div>';
    videoPlayer += '<div id=\"flashNoPlay\">';
    videoPlayer += '<div class=\"flashSmallLogo\"></div>';
    videoPlayer += '<div class=\"flashNoPlayText\">';
    videoPlayer += '<span>You need the Adobe Flash Player to view this material.</span><br />';
    videoPlayer += '<a href=\"javascript:leaveWeb(&quot;http://get.adobe.com/flashplayer/&quot;)\">Get the latest version of the Adobe Flash Player now.</a>';
    videoPlayer += '</div>';
    videoPlayer += '</div>';	
    videoPlayer += '</div>';

    //alert(videoPlayer);
    $("body").append(videoPlayer);
    $("body").append('<div id="videoDialogOverlay"/>');
    
    
    //$("body").append('<img src=\"/image/1.jpg\" alt=\"Second image for id 1\">Here!');   
    $("#popFlashVoicesDialog").dialog({
        bgiframe: false,
        width: 539,
        height: 576,
        modal: false,
        autoOpen: false,
        resizable: false,
        zIndex: 10001,
        draggable: false,
        closeOnEscape : false,
        dialogClass: 'message',
        position: [359,36]
    });
});		
function playVideo(videoId){
	window.scroll(0,0);
	//$("#popFlashVoicesDialog").dialog('option','position','center');
	$("#popFlashVoicesDialog").dialog('open');
	showVideoBackgroundOverlay();	
	var flashvars = {'videoID' : videoId,'account':'pfizerariceptdev','configFile' : 'media/video_player/xml/AriceptVideoPlayer.xml','trackingFile' : 'media/video_player/xml/app_config.xml','basePath' : 'media/video_player/images/'};
	var params = {'allowFullScreen':'true','scale':'noscale','allowScriptAccess':'always','wmode':'transparent'};
	var attributes = { 'id': 'popFlashVoices' };
	swfobject.embedSWF('/media/video_player/AriceptVideoPlayer.swf', "popFlashVoices", '539', '576', "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}
function closeVideoLayer() {	
	$("#popFlashVoicesDialog").dialog('close');
	hideVideoBackgroundOverlay();
}
function showVideoBackgroundOverlay(){
	var p = $("#footer").position();	
	var h = p.top-35;
	$('#videoDialogOverlay').css({
		 'height': h,
		 'width': $(document).width(),
		 'display': 'block'
	});	
}
function hideVideoBackgroundOverlay(){
	$('#videoDialogOverlay').css({'display' : 'none'});	
}