$(document).ready(function() {
	//$().jSnow();

	$(".referenzen_preview a").lightBox();
	
	// jQuery SmoothScroll
	$('#up_to_top a[href*=#]').click(function() {
		// duration in ms
		var duration=500;

		// easing values: swing | linear
		var easing='swing';


		// get parameters
		var hash=this.hash;
		var target=$(hash).offset().top;

		// animate to target and set the hash to the window.location after the animation
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: target }, duration, easing, function() { location.hash=hash; });

		// cancel default click action
		return false;
	});
	
	var load_white_box=function() {
		$(".startseite_box").animate({"opacity":"0.99"},900);
		$("#startseite_box_preloader").css({"background":"none"});
	}
	setTimeout(load_white_box,600);
	
	$(".accordion").accordion({
		event: "mouseover",
		autoHeight: false,
		active: false,
	});
	$(".accordion").mouseleave(function() {
		$(this).accordion("activate", false);
	});
	
	$("#startseite_box_left .accordion h3:first").css({"background":"none","padding-top":"0px"});
	$("#startseite_box_right .accordion h3:first").css({"background":"none","padding-top":"0px"});
	$(".accordion h3 a").click(function() {return false;});
	
	/***** News Slider*****/
	var news_slider=function() {
		$("#news_content .news_item:first").fadeIn(function() {
			$(this).addClass("slider_current");
			$(this).next().addClass("slider_next");
			
			var slide=function() {
				$(".slider_current").fadeOut(function() {
					if ($(this).next().length!=0) {
						$(this).removeClass("slider_current");
						$(".slider_next").fadeIn();
						$(".slider_next").removeClass("slider_next").addClass("slider_current");
						$(".slider_current").next().addClass("slider_next");
					}else {
						$(".slider_current").removeClass("slider_current");
						$("#news_content .news_item:first").fadeIn(function() {
							$(this).addClass("slider_current");
							$(this).next().addClass("slider_next");
						});
					}
					setTimeout(slide,7000);
				});
			}
			setTimeout(slide,7000);
		});
	}
	news_slider();
	
	//tooltips
	tooltipPreview();
	tooltipPreview_white();
	tooltipPreview_professional();
});