//// NOTE: these dimesions represent the actual video dimensions. 85 pixels is added to the height for the top and bottom control bars.
var cfvpVideoWidth = 300;
var cfvpVideoHeight = 165;
var cfvpEnlargedWidth = 450;
var cfvpEnlargedHeight = 248; 
var cfvpCaroselHeight = 78;
var cfvpHeightPadding = 85;
var cfvpFlashParams = { wmode:"transparent", allowscriptaccess:"always" };


function cfvpEmbedVideo(){
	//NOTE: flashvars must be declared before calling this function	
	if (cfvpVideoHeight < 145) cfvpHeightPadding = 45;
	swfobject.embedSWF(	
							"http://www.channelflip.com/wp-content/assets/cfvp.swf",
							"cf-video-player",
							cfvpEnlargedWidth, 
							cfvpEnlargedHeight + cfvpCaroselHeight,
							"9.0.115", 
							"http://www.channelflip.com/wp-content/assets/expressInstall.swf", 
							cfvpFlashVars, 
							cfvpFlashParams
						);	
								
}

//// THESE functions are called from flash video player via ExaternalInterface
function cfVideoEnlarge(){
	var vid = document.getElementById("cf-video-player");	
	vid.style.width = cfvpEnlargedWidth + "px";
	vid.style.height = (cfvpEnlargedHeight + cfvpCaroselHeight + cfvpHeightPadding) + "px";
}
		
function cfVideoShrink(p_isVideoListOpen){
	var vid = document.getElementById('cf-video-player');
	vid.style.width = cfvpVideoWidth + "px";
	vid.style.height = (p_isVideoListOpen?cfvpVideoHeight + cfvpCaroselHeight:cfvpVideoHeight) + "px";
	if (p_isVideoListOpen) vid.style.height = (cfvpVideoHeight + cfvpCaroselHeight + cfvpHeightPadding) + "px";
	else vid.style.height = (cfvpVideoHeight + cfvpHeightPadding) + "px";
}
		
function cfOpenCarousel(){
	document.getElementById('cf-video-player').style.height = (cfvpVideoHeight + cfvpCaroselHeight + cfvpHeightPadding) + "px";
}
	
function cfCloseCarousel(){
	document.getElementById('cf-video-player').style.height = (cfvpVideoHeight + cfvpHeightPadding) + "px";
}	

function cfInitStageSize(){
	var cfContainerElement = document.getElementById("cf-container");
	cfContainerElement.style.width = cfvpVideoWidth + "px";
	cfContainerElement.style.height = (cfvpVideoHeight + cfvpHeightPadding) + "px";
	cfContainerElement.style.position = "relative";									
	var cfVideoPlayerElement = document.getElementById("cf-video-player");
	cfVideoPlayerElement.style.width = cfvpVideoWidth + "px";
	cfVideoPlayerElement.style.height = (cfvpVideoHeight + cfvpHeightPadding) + "px";	
	cfVideoPlayerElement.style.position = "absolute"; 
	cfVideoPlayerElement.style.right = "0px"; 
}



//// Utility methods
function cfGetFlashRef(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) return window[movieName];
	else return document[movieName];
}

