jQuery(document).ready(function($){
		
	$(".video-lightbox[rel='brightcove']").each(function(){
		var videoId = $(this).attr('videoid');
		var playerId = $(this).attr('playerid') || '96726573001';
		var width = $(this).attr('width') || '720';
		var height = $(this).attr('height') || '405';
		
		var content = 
		'<object id="flashObj" width="'+ width +'px" height="'+ height + 'px" ' +
				'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
				'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0">' + 
		'<param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/' + playerId + '?isVid=1&isUI=1" />' + '<param name="bgcolor" value="#FFFFFF" />' + 
		'<param name="flashVars" value="@videoPlayer=' + videoId + '&playerID=' + playerId + '&domain=embed&dynamicStreaming=true" />' +
		'<param name="base" value="http://admin.brightcove.com" />' + 
		'<param name="seamlesstabbing" value="false" />' + 
		'<param name="allowFullScreen" value="true" />' + 
		'<param name="swLiveConnect" value="true" />' + 
		'<param name="allowScriptAccess" value="always" />' + 
		'<embed src="http://c.brightcove.com/services/viewer/federated_f9/' + playerId + 
		'?isVid=1&isUI=1" bgcolor="#FFFFFF" ' +
		'flashVars="@videoPlayer=' + videoId + '&playerID=' + playerId + '&domain=embed&dynamicStreaming=true" ' + 'base="http://admin.brightcove.com" name="flashObj" width="'+ width +'px" height="'+ height +'px" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">' + '</embed>' +
		'</object>';
			
			
		$(this).fancybox({
			'width'				: parseInt(width),
			'height'			: parseInt(height),
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'showNavArrows'		: false,
			'content'			: content
		});
	});
});



jQuery(document).ready(function($){
$('a.vimeo').unbind().
	each(function(){ 
		$(this).attr('href','#vimeo:' + $(this).attr('vimeoid') ); 
	}).
	click(function(){
		var pwidth = 600;
		var pheight = 400;
		
		var pleft = 0;
		var ptop = 0;
		
		pleft = (screen.availWidth - pwidth)/2;
		ptop = (screen.availHeight - pheight - 250 )/2;
		
		var vimeo_id = $(this).attr('vimeoid'); 
		console.log(vimeo_id ); 
		var videopopup = window.open( "#vimeo:"+ vimeo_id , vimeo_id + " video window",
			"resizeable=yes, location=no, toolbar=no, menubar=no, status=no, scrollbars=no, width="+ pwidth +"px, height="+ pheight +"px, left="+ pleft +", top="+ ptop +", screenX="+ pleft +", screenY="+ ptop +" " );
		
		var objecttag = 
		'<object width="100%" height="100%">' + 
			'<param name="allowfullscreen" value="true" />' + 
			'<param name="allowscriptaccess" value="always" />' + 
			'<param name="movie" value="http://vimeo.com/moogaloop.swf?' +
				"clip_id=" + vimeo_id + "&amp;" +
				"server=vimeo.com&amp;" +
				"show_title=1&amp;" +
				"show_byline=0&amp;" +
				"show_portrait=0&amp;" +
				"color=00adef&amp;" +
				'fullscreen=1" />' + 
				'<embed src="http://vimeo.com/moogaloop.swf?' +
					"clip_id="+ vimeo_id +"&amp;" +
					"server=vimeo.com&amp;" +
					"show_title=1&amp;" +
					"show_byline=0&amp;" +
					"show_portrait=0&amp;" +
					"color=00adef&amp;" +
					'fullscreen=1" ' +
					'type="application/x-shockwave-flash"' + 
					'allowfullscreen="true"' + 
					'allowscriptaccess="always"' + 
					'width="100%"' + 
					'height="100%">' +
			"</embed> " +
		"</object>";
		
		videopopup.document.write(objecttag);
	});
});

