$(function() {
/* 	if (document.all) { */
		$("ul#menu li").hoverFix();
/* 	} */
	$('img#watermark').positionWatermark();	
	
	$(window).resize(function() {
		$('img#watermark').positionWatermark();	
	});
	
	$('a#arrow-slides').click(function() {
		fadeSlides();
		return false;
	});
	
	$('a#arrow-close-1').click(function() {
		$('#text-backdrop, #text-content, a#arrow-close-1').animate({opacity: 0}, 500); 
		return false;
	});
	
	setTimeout(function() {	
		fadeSlides();
	}, 6000);	
	
	$('#text-backdrop').css('opacity', '0.7').show();
	$('#text-content, a#arrow-close-1').show(); 

});

/* IE6 hover workaround */
$.fn.hoverFix = function() {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass('hover-fix'); $('#debug').html('hover'); },
			function() { $(this).removeClass('hover-fix'); $('#debug').html(''); }
		);
	});
};	

/* fade instead of slides */

var currentSlide = 1;
var currentTimeout = 0;

function fadeSlides() {
	clearTimeout(currentTimeout);
	
	$('#slide'+currentSlide).fadeOut(2000);
	currentSlide++;
	if (currentSlide == 19)
		currentSlide = 1;
	$('#slide'+currentSlide).fadeIn(2000);
	
	currentTimeout = setTimeout(fadeSlides, 6000);
}


/* watermark Positioning for small screens */
$.fn.positionWatermark = function() {
	return this.each(function() {
		var h = $(window).height();
		if (h<766) {
			$(this).css('top', (h-272)+'px').css('bottom','');
		}
	})
}

