jQuery(function($){
 
$.fn.superbgimage.options = {
 randomtransition: 0, // 0-none, 1-use random transition (0-7)
 slideshow: 1, // 0-none, 1-autostart slideshow
 slide_interval: 5000, // interval for the slideshow
 randomimage: 0, // 0-none, 1-random image
 transitionout: 1,
 speed: 3500, // animation speed
 preload:1
 }; 

 $('#thumbs').superbgimage().hide();
	
});

var $j = jQuery.noConflict();		

$j(document).ready(function($){

	$(".closeButton").live("click",function(e){
		$(this).parents("#box_content").fadeOut("slow");
	});
	
	
	if(sbKullVar.cufonEnable !== "off"){
		Cufon.replace('blockquote p', { 
			fontFamily: sbKullVar.cufonSchrift || "kulltypewriter", 
			hover:true }
		);
	 	Cufon.now(); 	
 	}
	
	var marginVert = parseInt($("#content").css("margin-top"))+parseInt($("#content").css("margin-bottom"));
	
	if(!$("#content .page, #content .post").hasClass("fixed-height") ){
		var hoehe = $("#sidebar").height() - marginVert;
	} else {
		var hoehe = parseInt($("#box_content").css("height"));
	}
	
	if(  $("#box_content").height() > $("#sidebar").height() && !$("#content .page, #content .post").hasClass("no-scrollbar") ){
	
		
		
		if(!$("#content .page, #content .post").hasClass("fixed-height") ){
		
			$("#content .post, #content .page").height(hoehe).append("<div style='height:20px; width:100%'></div>").jScrollPane({
					enableKeyboardNavigation: false
			});
			
			$("#box_content").height(hoehe + 20);
			
			$(".jspInnerPane").height(hoehe - 20);
		
		} else {
			
			$("#content .post, #content .page").height(hoehe - 20).append("<div style='height:20px; width:100%'></div>").jScrollPane({
					enableKeyboardNavigation: false
			});
			
			$(".jspInnerPane").height(hoehe - 40);
		
		}
	}
	
	
	
	$("#box_content").hide().css("visibility", "visible").fadeIn("slow");
	
	$(".page-template-pageanfahrt-php iframe").css('margin-bottom', '13px').attr("width", 420).attr("height", sbKullVar.karteHoehe || hoehe).next('br').hide().next('small').hide();
 	
	/*
	$("a#booktable").fancybox({
		width: "420px",
		height: hoehe+"px"
	});
	*/
	
	$("a#booktable").click(function(e){
		e.preventDefault();
		var href = $(this).attr("href");
		var $reservationBox = $("<iframe width='400' height='400' src='"+href+"' />").hide().appendTo("body");
		$.fancybox({
			'href': href,
			'padding': 0,
			'transitionIn': 'elastic',
			'transitionOut': 'fade',
			'width': parseInt(sbKullVar.lightbox_w) || 320,
			'height': parseInt(sbKullVar.lightbox_h) || 300,
			'autoDimensions':false,
			'autoScale':false,
			'speedIn': 700,
			'speedOut': 450,
			'type'  : 'iframe',
			'overlayColor': '#000',
			'onStart': function(){
				$("#body, html").css('overflow', 'hidden');
			},
			'onClosed': function(){
				$("#body, html").css('overflow', '');
			}
		}); 

		return false;
	});
	
	$(".betrieb_uebersicht").mouseenter(function(){
		var desc = $(this).find('.betrieb_dummy_desc').clone();
		$("#beschreibung_container").empty().append($(desc).fadeIn('fast'));
	}).mouseleave(function(){
		$("#beschreibung_container .betrieb_dummy_desc").fadeOut(100);
	});

});
