$(document).ready(function() {

	$("a[rel^='image_viewer']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: false, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		callback: function(){}
	});
	
	
	
	hideInputValue($('#s'));
	
	
	
	setTimeout('animation()', 300);



	$('#canoe, #kayak').hide().fadeIn('slow');
	$('h1').hide().fadeIn('fast');
	
	
	
	if ($(window).width() > 1600) {
		$('#bottle').fadeIn('slow');
	}
	
	
	
	$('#sidebar .event_item, #footer .event_item').hover(function() {
		$(this).stop().animate({ 'margin-left' : '20px'}, 100);
	}, function() {
		$(this).stop().animate({ 'margin-left' : '0'}, 800, 'easeOutBounce');
	});
	
	
	
	// Dragonboat navigation
	var bodyClassIsSet;
	if ($('body').hasClass('dragonboat_layout')) bodyClassIsSet = true; else bodyClassIsSet = false;
	var $dragonboatNav = $('#dragonboat_nav');
	$dragonboatNav.css({ top: '170px' });
	$('#dragonboat').click(function() {
		if (!$dragonboatNav.hasClass('open')) {
			if (!bodyClassIsSet) $('body').addClass('dragonboat_layout');
			$dragonboatNav.fadeIn().addClass('open');
			$dragonboatNav.animate({ top: '185px' }, 500);
		} else {
			if (!bodyClassIsSet) $('body').removeClass('dragonboat_layout');
			$dragonboatNav.animate({ top: '170px' }, 500);
			$dragonboatNav.fadeOut().removeClass('open');
		}
		return false;
	});

});



function animation() {
	
	$('#the_canoe').animate({ 'left': '2px' }, 1000, 'jswing').animate({ 'top': '4px' }, 1000, 'jswing').animate({ 'left': '0' }, 1000, 'jswing').animate({ 'top': '0' }, 1000, 'jswing');
	setTimeout('animation()', 300);
}



function hideInputValue(element, defaultValue) {

	if (defaultValue == undefined) {
		defaultValue = element.val();
	}
	
	element.focus(function() {
		if (this.value == defaultValue) {
			this.value = '';
		}
	});
	
	element.blur(function() {
		if (this.value == '' || this.value == defaultValue) {
			this.value = defaultValue;
		}
	});

}  
