/**
 * @author Timo Kujawa
 */
$(document).ready(function() {
		
	$('#sitemapOpen').click(function(){
		$('#sitemap').show();
	});
	$('.sitemapClose').click(function(){
		$('#sitemap').hide();
	});
	
	$("#landingpageLink").click(function() {
		$("#landingpages").toggle('slow');
		return false;
	});
	
	$('#scrollable').jScrollPane({
			showArrows: true,
			verticalArrowPositions: 'os'
		}
	);
	$('.multiScrollPane').jScrollPane({
			showArrows: true,
			verticalArrowPositions: 'os'
		}
	);	
	
	$('#referenzSlider').anythingSlider({
		width          : 345,
		height         : 357,
		buildNavigation: false,
		autoPlay	   : false,
		toggleControls : false,
		startStopped   : false,
		stopAtEnd	   : true
	});

	$("a.fancyLink").fancybox();
	
	// remove a-tag style if a-tag is parent of an img-tag
	$("a img").parent().css("background","none").css("padding-right","0px");
	
	// move products to 3rd level navigation
	if($("#produktListe").length != 0) {
		if($("#produktListe").hasClass("onPage")) {
			$("#nav_main .current-menu-item").append($("#produktListe"));
		} else {
			$("#nav_main .current-menu-parent").append($("#produktListe"));
		}
		//$("#wrap").css("padding-top","115px");		
		$("ul.sub-menu li ul.sub-menu").css("left","265px");
	}
	
	$("#produktListe a, .pagination a").click(function() {	
		$("#helpForm").attr("action",$(this).attr("href"));
		$("#helpForm").submit();
		return false;
	});
	
	if($(".singlePage").length != 0) {
		$(".current-menu-parent").parent().parent().addClass("current-menu-ancestor");
		$(".current-menu-parent").parent().show();
	}
	
	if (screen.width <= 990) {
	   $('#nav_main, #news').css('padding-left', '15px');
	   $('#footer_nav, #news').css('padding-right', '15px');
	}	
});



