
var curVideo = "";
var videoPath ="http://fidelityrw.edgesuite.net/hr_videos/flv/";
var transcriptPath = "http://fidelityrw.edgesuite.net/hr_videos/flv/"
var t = null;
var t2 = null;



function showhideDiv()
{ 
	if (document.getElementById("menu").style.display == "none"){
			
		t=setTimeout(showVideoWrapper,1000);	
		t2=setTimeout(showVideo,1050);
		
	}
	else{
		
		clearTimeout(t);
		clearTimeout(t2);
		document.getElementById("menu").style.display = "none"; 
		document.getElementById("UniversalPlayerHolder").style.display = "none"; 
		document.getElementById("uplayerBox").style.display = "none"; 
		document.getElementById("closeBTN").style.display = "none"; 
		document.getElementById("titleDiv").style.display = "none";
		swfobject.embedSWF("/common/UniversalPlayerWrapper.swf", "UniversalPlayer", "0", "0", "9.0.0", "expressInstall.swf", '', '', '');
	
	}
}

function checkqstring(){
	if (swfobject.getQueryParamValue('video')!=''){
		showhideDiv();
	}
}

function setCurrentVideo(video, title){

	if (video != ""){
		curVideo = video;
		showhideDiv();
	}
	if (title != ""){
	document.getElementById("titleDiv").innerHTML = "<b>" + title + "</b>";
	}
}

function showVideoWrapper(){

document.getElementById("menu").style.display = "block"; 
		document.getElementById("UniversalPlayerHolder").style.display = "block"; 
		document.getElementById("uplayerBox").style.display = "inline";
		document.getElementById("closeBTN").style.display = "inline";
		//document.getElementById("closeBTN").innerHTML = "<a href='javascript:showhideDiv()'><img src='careersassets/close_btn.png' width='34' height='33' alt='' border='0' /></a>";
		document.getElementById("titleDiv").style.display = "block";
		}
function showVideo(){
document.getElementById("menu").style.height = getDocHeight() + "px";
document.getElementById("uplayerBox").style.top = getScrollTop() + "px";
if  (curVideo !=""){
				
				var flashvars = {
				setSkin: "greyPlayerControls.swf",			// String: url to skin file (css file compiled to swf)
				
				//set the host something likw cp40860.edgefcs.net
				setHostName: "",							// String: url to Akamai Streaming Server (cp40860.edgefcs.net)
				setStreamName: "", // String: url to Streaming File (my_files/videos/my_video_file) *NOTE: No file extention
			
			
				setProgressiveName: videoPath + curVideo + ".flv" ,		// String: url to Progressive file (http://www.some_domain.com/videos/my_video_file.flv)
				
				
				showControls: "fade",						// String: "locked_below", "locked_overlay", "hidden", "fade" (default)
				showBigPlayButton: "false",					// Boolean: true shows the big play button, false hides it
				autoStart: "true",							// Boolean: true starts the video/audio as soon as it can, false waits for a user interaction befor playing media
				fitVideoToWindow: "false",					// Boolean: true scales the video to fit in the container, false plays video at it's actual size
				loadOpeningImage: "",
															//XML will need to be on the server this page resides on to avoid sandbox violations.			
															// String: url to Transcript XML file 
															
				loadTranscript: transcriptPath + curVideo + "_transctipt.xml",
				
				
				loadSwf: "",								// String: url to SWF file to be played behind video 
				cuedXML: "",								// String: url to Cue Point XML file that drives loadSwf (optional)
				changeVolume: "",							// Number: 0 = mute, 1 = full blast
				showClosedCaptions: "",						// Boolean: true shows the Closed Captions panel, false hides it
				seekTo: ""									// Number: value, in seconds, to send the playhead to
				};
		}
		else if (unescape(swfobject.getQueryParamValue('video')) != ""){
				
				var flashvars = {
				setSkin: "greyPlayerControls.swf",			// String: url to skin file (css file compiled to swf)
				//set the host something likw cp40860.edgefcs.net
				setHostName: "",							// String: url to Akamai Streaming Server (cp40860.edgefcs.net)
				setStreamName: "",							// String: url to Streaming File (my_files/videos/my_video_file) *NOTE: No file extention
				
				
				setProgressiveName: videoPath + unescape(swfobject.getQueryParamValue('video')) + ".flv" ,		// String: url to Progressive file (http://www.some_domain.com/videos/my_video_file.flv)
				
				
				showControls: "fade",						// String: "locked_below", "locked_overlay", "hidden", "fade" (default)
				showBigPlayButton: "false",					// Boolean: true shows the big play button, false hides it
				autoStart: "true",							// Boolean: true starts the video/audio as soon as it can, false waits for a user interaction befor playing media
				fitVideoToWindow: "false",					// Boolean: true scales the video to fit in the container, false plays video at it's actual size
				loadOpeningImage: "",						// String: url to opening image
															//XML will need to be on the server this page resides on to avoid sandbox violations.			
															// String: url to Transcript XML file 
															
				loadTranscript: transcriptPath + unescape(swfobject.getQueryParamValue('video')) + "_transcript.xml",
				
				
				loadSwf: "",								// String: url to SWF file to be played behind video 
				cuedXML: "",								// String: url to Cue Point XML file that drives loadSwf (optional)
				changeVolume: "",							// Number: 0 = mute, 1 = full blast
				showClosedCaptions: "",						// Boolean: true shows the Closed Captions panel, false hides it
				seekTo: ""									// Number: value, in seconds, to send the playhead to
				};	
				document.getElementById("titleDiv").innerHTML = "<b>" + unescape(swfobject.getQueryParamValue('title')) + "</b>";
			}
			else{
						
				alert("error");
						
			}
					
			
			var params = {
				bgcolor: "#000000"
			};
			
			var attributes = {
			  	name: "universalPlayer"
			};
		
		
		//EMBED THE SWFOBJECT HERE
		swfobject.embedSWF("/common/UniversalPlayerWrapper.swf", "UniversalPlayer", "640", "360", "9.0.0", "expressInstall.swf", flashvars, params, attributes);		
	
		//document.getElementById("menu").style.display = "block"; 
		//document.getElementById("UniversalPlayerHolder").style.display = "block"; 
		//document.getElementById("closeBTN").style.display = "block";
		//document.getElementById("titleDiv").style.display = "block";
}

// Get the height of the entire document
// --------------------------------------------------------------------
function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
function getScrollTop(){
	var ScrollTop = document.documentElement.scrollTop;
	
	if (window.pageYOffset){
		ScrollTop = window.pageYOffset;
	}
	return ScrollTop;
}

checkqstring();