// when the document is loaded
$(document).ready(function() {	
	fnResize();
	
  // Find external links in standard content areas and add class + target.
  $('#contentHolder .contentRightCol .fullWidthCol a[href^="http://"]').addClass('external').attr('target','_blank');
	
	
	$("#galleryItems").easySlider({
		auto: false,
		continuous: true
	});
	
	// Add date picker to the field with ID = date
	$("#date").datepicker({dateFormat: 'dd/mm/yy'});

	$('.galleryItem .imageHolder a, #galleryItems .photoImage a').fancybox({overlayOpacity:0.8, overlayColor:"#000"});
	
	$('.galleryItem .imageLink a').click(function(){
		$(this).parents('.galleryItem').find('.imageHolder a').click();
		return false;
	});
	
	$('#galleryItems .photoDetails a').click(function(){
		$(this).parents('.galleryItem').find('.imageLink a').click();
		return false;
	});

});


/**
* jqEM to detect font size changes
*/
//set the text size that the default body computes to
var fontSize = 16;

$.jqem.bind(function(a,b,c) {
	fnResize();
});
	

	
function fnResize(){
	if( $.jqem.current() == fontSize) {			
		$('body').addClass('enh');
	}else if($.jqem.current() != fontSize){		
		$('body').removeClass('enh');		
	};
};


function fnPrint(){
  window.print();
}
