$(document).ready(function() {

/* ############################## */
/* ### document ready - start ### */
/* ############################## */

/* --- alpina-news: horizontal zentrieren --- */

var paddingTopNew = ($('#news').height() - $('#news div').height()) / 2;
$('#news div').css('padding-top', paddingTopNew);

/* --- hauptmenue: home entfernen und automatisch umbrechen --- */

$('#menu li:nth(0)').remove();

var anzMenuepunkte = $("#menu ul li").length;
var liUmbruch = Math.floor(anzMenuepunkte/2);
$("#menu ul li:nth(" + liUmbruch + ")").addClass("menubreak");

/* --- fusszeile: letztes li ohne border-right --- */

var menuepukteFusszeile = new Array();
$('#footer ul li').each(function(index) {
  if($.inArray($(this).position().top,menuepukteFusszeile)==-1) {
  	menuepukteFusszeile[index] = $(this).position().top;
  	$("#footer ul li:nth("+(index-1)+")").addClass("lastInLine");
	}
});

/* --- fusszeile: ausblenden, falls zu hoch positioniert --- */

function footerCheck() {
	var positionTopFooter = $('#footer').offset().top;
	var positionTopFooterMinimum = 750;
	var positionTopFooterDifference = positionTopFooter - positionTopFooterMinimum;
	if(positionTopFooterDifference<0) {
		$('#footer').addClass('invisible');
	} else {
		$('#footer').removeClass('invisible');
	}
}

footerCheck();
$(window).bind('scroll resize',function () {
	footerCheck();
});

/* ----------------------------- */
/* --- Slider für Pauschalen --- */
/* ----------------------------- */

$("#pauschalen").easySlider({
	continuous: true,
	auto: true,
	speed: 800,
	pause: 5000,
	numberVisible: 2
});

/* ############################# */
/* ### document ready - ende ### */
/* ############################# */

})

