$(document).ready(function(){
	Cufon.replace('.mainmenu',  {
	hover: true
	}); 

		$("a[rel^='prettyPhoto']").prettyPhoto({
			theme: 'light_rounded',
			overlay_gallery: false
		});
	if( navigator.userAgent.match(/Android/i) ||
		 navigator.userAgent.match(/webOS/i) ||
		 navigator.userAgent.match(/iPhone/i) ||
		 navigator.userAgent.match(/iPod/i) ||
		 navigator.userAgent.match(/iPad/i) ||
		 navigator.userAgent.match(/iTouch/i) ||
		 navigator.userAgent.match(/BlackBerry/)
		 ){
		} else {
			$("#content").height($(window).height()-280);
			$(window).resize(function() {
		  		$("#content").css({height : $(window).height()-280 + 'px'})
			});
				var globalTimer;
				var speed = 7000;
				var currentSlide = 0;
				var totalSlides = $("#headersList UL LI").length;
				if(totalSlides>1){
					globalTimer=setTimeout(nextSlide,speed)
				}
		}
	$(".mainmenu li").last().css("backgroundImage","none");

	//SET UP TIMER FOR SLIDESHOW
	function nextSlide(){
		clearTimeout(globalTimer);
		if(currentSlide>(totalSlides-2))
		{
			currentSlide = 0;	
		} else {
			currentSlide++
		}
		goTo(currentSlide);
		globalTimer=setTimeout(nextSlide,speed)
	}
	
	function goTo(current){
		loadImg($("#headersList UL LI:eq("+current+")").html())
	}
	
	function loadImg(src){
		if($("#headerContainer img").length>1){
			$("#headerContainer img:eq(0)").remove();
		}
		var img = new Image();
		$(img).load(function(){
			$(this).hide();
			$("#headerContainer").append(this);
			$(this).fadeIn("slow");
		}).attr('src',src)
		return false;
	}
})
