$(document).ready(function(){
	$(document).pngFix(); 
	$("ul.tabs li").click(function(event) {
		event.stopImmediatePropagation();
		$("div.tabs-content>div").hide();
		$("div.tabs-content div:nth-child("+($(this).index()+1)+")").show();
		$("ul.tabs li.current").removeClass("current");
		$(this).addClass("current");
		return false;
	});
	$("div.tabs-content>div:first").show();
	$("ul.tabs li:first").addClass("current");
	$("div.tabs-nav span.nav-prev").click(function(){
		$("ul.tabs li:hidden:last").animate({width: "100px"}, 300, function(){$(this).css("width", "auto"); $("ul.tabs li:visible:first").click();});
	});
	$("div.tabs-nav span.nav-next").click(function(){
		if ($("ul.tabs li:visible").length > 4) {
			$("ul.tabs li:visible:first").animate({width: "0%"}, 300, function(){$(this).hide(); $("ul.tabs li:visible:first").click();});
			
		}
	});

	$("form#region_form select").dropdownReplacement({onSelect: function(){
		$("form#region_form").submit();
	}});
	
	/*$(window).resize(setLogo);
	setLogo();*/
	$('.sl ul.left-menu li em').click(function() {
		$(this).parent().parent().children("ul").toggleClass("selected");
		$(this).toggleClass("opened");
		return false;
	});
	
	/*$(".teaser ul li").hover(
	function() {$(this).addClass("selected");},
	function() {$(this).removeClass("selected");}
	);*/
	$(".teaser ul li").mouseenter(function() {
		$(".teaser ul li").removeClass("selected");
		$(this).addClass("selected");
		$(".teaser div.image").css("background-image", "url('"+$(this).children("a").attr("rel")+"')").click(function() { location.href = $(".teaser ul li.selected a").attr("href"); });
	});
	window.TeaserIntervalID = setInterval(changeTeaser, pause);
	$(".teaser div.image").hover(function() {
		clearInterval(window.TeaserIntervalID);
	}, function() {
		window.TeaserIntervalID = setInterval(changeTeaser, pause);
	});
});
function changeTeaser() {
	var newSelected = $(".teaser ul li.selected").next();
	if (!newSelected.length)
		newSelected = $(".teaser ul li:first");
	
	$(".teaser ul li").removeClass("selected");
	newSelected.addClass("selected");
	$(".teaser div.image").css("background-image",  "url('"+newSelected.children("a").attr("rel")+"')");
}
/*function setLogo(){
	if ($("body").width()<1130) {
		$("#header a.logo img.large").hide();
		$("#header a.logo img.small").show();
	} else {
		$("#header a.logo img.small").hide();
		$("#header a.logo img.large").show();
	}
}*/
