// JavaScript Document

function initGalleryHeader(){
	var staticHeight = $('#gallery_header').height();
	$('#gallery_header').attr('staticHeight', staticHeight);
	$('#gallery_header').css('clip', 'rect(0px, 9999px, '+staticHeight+'px, 0px)');
}

function resizeGalleryHeader(flashHeight){
	$('#gallery_header').attr('flashHeight', flashHeight);
	$('#gallery_header').css('height', flashHeight+'px');
	$('#gallery_flash').css('height', flashHeight+'px');
}

function slideDownVideo(){
	var clipHeight = $('#gallery_header').attr('flashHeight');
	$('#gallery_header').css('clip', 'rect(0px, 9999px, '+clipHeight+'px, 0px)');
}

function slideUpVideo(){
	var clipHeight = $('#gallery_header').attr('staticHeight');
	$('#gallery_header').css('clip', 'rect(0px, 9999px, '+clipHeight+'px, 0px)');
}

function initSideNavigation(){
	var a = $('#subnav>li.current>a');
	$(a).wrap('<span id="sIFR-me"></span>');
}

function showStreamVideo(file){
	var flashvars = 'file='+file+'&streamer=rtmp://mckinneyfellowship.flashsvr.com/mckinneyfellowship/_definst_/&autostart=true&controlbar=over';
	var embed = '<object id="my_video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="512" height="288">';
	embed += '<param name="allowscriptaccess" value="always"></param>';
	embed += '<param name="allowfullscreen" value="true"></param>';
	embed += '<param name="wmode" value="opaque"></param>';
	embed += '<param name="movie" value="http://flashplayer.netbroadcasting.tv/player-licensed.swf"></param>';
	embed += '<param name="flashvars" value="'+flashvars+'"></param>';
	embed += '<embed height="288" width="512" flashvars="'+flashvars+'" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" name="my_video" id="my_video" src="http://flashplayer.netbroadcasting.tv/player-licensed.swf" type="application/x-shockwave-flash">';
	embed += '</object>';
	
	var params = {
		frameWidth: 512,
		frameHeight: 288,
		padding: 0,
		zoomSpeedIn: 600,
		zoomSpeedOut: 600,
		overlayShow: true,
		overlayOpacity: 0.5,
		hideOnContentClick: false,
		content: embed,
		onClosed: function(){ closeStreamVideo(); }
	};
	
	$('#stream_target').fancybox(params).trigger('click');
}

function closeStreamVideo(){
	thisMovie('McKF_home').resumeGallery();
}
