jQuery(function(){
	
	var $=jQuery;
	
	if($('a.jqueryLightbox').lightBox){
		$('a.jqueryLightbox').lightBox();//{fixedNavigation:true});
	}
	
	/*
		Bind preview links to modal window handler
	*/
	(function(){
		$('.previewPanelOpener').click(function(e){
			var el=$(this);
			e.preventDefault();
			
			var p = $('#PanelContainer');
			
			$.blockUI({
				allowBodyStretch: true,
				message:p,
				css: {
					cursor:'arrow',
					width:'60%',
					top:'10%',
					left:'20%',
					'border':'none'/* this is key to getting the panel to display properly with variable heights */
				}
			});
			
			$('.panelBody', p).html('Loading...');
			
			$.get(el.attr('href'), function(data){
				$('.panelBody', p).html(data);
				$('.panelCloseButton', p).click(function(e){
					e.preventDefault();
					$.unblockUI();
					$('.panelBody', p).html('');
					p.hide();
				});
				
				
			});
		})
	})();
});