$(document).ready(function() {

	$('h1').each(function(){
	    var me = $(this);
	    me.html( me.text().replace(/(^\w+)/,'<span class="headerScript">$1</span>') );
	  }); 

	$('#headerImage').cycle({
		fx:	'fade',
		speed: 2500,
		timeout: 5000
	});

	if(!($.browser.msie && $.browser.version == "6.0")) {
		$(".level1").hover(
			function() {
				$(".selected").removeClass("selected");
				$(".subNavlist").hide();
				$(this).find(".subNavlist").show();
				$(this).children("a").addClass("hover");
			},
			function() {
				$("#active").children("a").addClass("selected");
				$(this).find(".subNavlist").hide();
				$("#active").find(".subNavlist").show();
				$(this).children("a").removeClass("hover");
			}
		);
	}

	$("#imageArea").jMyCarousel({
		 visible: '742px',
		 eltByElt: false,
		 speed: 2000,
		 auto: true
	});

	$("#imageArea li").mouseover(function() { $(this).css("opacity", "1"); });
	$("#imageArea li").mouseout(function() { $(this).css("opacity", "0.4"); });

	$("#imageGallery a").lightbox({
		fixedNavigation: true, 
		navbarOnTop: true, 
		fitToScreen: true
	});
	
	if($.fn.datepicker) {
		$(".calendar").datepicker({
			showOn: "both",
			buttonImage: "/resources/images/icons/calendar.png",
			buttonImageOnly: true,
			dateFormat: "dd/mm/yy"
		});	
	}

});
