

$(document).ready(function() {

// GET-Parameter eines Links abfragen
function getParam(tLink, tParam) {
	var aList = tLink.split("#")[0].split("&");
	for(var i = 0; i < aList.length; i++) {
		var aParam = aList[i].split("=");
		if (aParam[0]==tParam) return aParam[1];
	}
	return "";
}

/* **************************************************************** */
function zufall(a,b) { return Math.random()-Math.random(); };
var aNummern = new Array(1,2,3,4,5);
var aReihenfolge = aNummern.sort(zufall);

$('#header_image_inner').crossSlide({ sleep: 5, fade: 1.5}, [
  { src: 'images/header/header'+aReihenfolge[0]+'.jpg', dir: 'up'   },
  { src: 'images/header/header'+aReihenfolge[1]+'.jpg', dir: 'down' },
  { src: 'images/header/header'+aReihenfolge[2]+'.jpg', dir: 'up'   },
  { src: 'images/header/header'+aReihenfolge[3]+'.jpg', dir: 'down' },
  { src: 'images/header/header'+aReihenfolge[4]+'.jpg', dir: 'up'   }
]);

/* **************************************************************** */

$("#faq_entry p.antwort").each(function() {
	if ($(this).attr("rel")!=="open") {
		$(this).hide();
	}
});
$("#faq_entry h2.frage").attr("title","Klicken Sie auf die Frage um die Antwort auszuklappen");
$("#faq_entry h2.frage").css("cursor","pointer");
$("#faq_entry h2.frage").hover(function() {
	$(this).addClass("fragehover");
}, function() {
	$(this).removeClass("fragehover");
});
$("#faq_entry h2.frage").click(function() {
	$(this).next("p.antwort").toggle("500");
});



/* **************************************************************** */

$("#navigation ul.einblenden").css("visibility","visible");
$("#navigation ul ul a.aktiv").parent("li").children("ul").css("visibility","visible");

$("ul#nav3 li li > a.dir").each(function(i) {
	var sText = $(this).html();
	$(this).html(sText+"<img src='images/pfeil.png' alt='Untermenü vorhanden' width='10' height='10' />");
});

/* #################################################################################### */

$("ul#nav38").parent().hover(function() {
	$("ul#nav38").css("top","0px");
}, function() {
	$("ul#nav38").css("top","51px");
});
$("ul#nav38 li ").hover(function() {
	$("ul#nav38").css("top","0px");
}, function() {
	$("ul#nav38").css("top","51px");
});
$("ul#nav38").css("top","51px");

/* #################################################################################### */

$("ul#nav9").parent().hover(function() {
	$("ul#nav9").css("top","0px");
}, function() {
	$("ul#nav9").css("top","26px");
});
$("ul#nav9 li ").hover(function() {
	$("ul#nav9").css("top","0px");
}, function() {
	$("ul#nav9").css("top","26px");
});
$("ul#nav9").css("top","26px");



/* #################################################################################### */

$(".scrollable").scrollable({
	    circular: true
	, mousewheel: true
});

/* #################################################################################### */

$("a[rel]").overlay({
	effect: 'apple',
	onBeforeLoad: function() {
		var wrap = this.getOverlay().find(".contentWrap");
		wrap.load(this.getTrigger().attr("href"));
	}
});

/* #################################################################################### */

var nHeight  = 0;
var nCounter = 0;
$("#offers_view_list .offers_item").each(function(nCurrent, oElement) {
	nCounter++;
	if ($(oElement).height() > nHeight) {
		nHeight = $(oElement).height();
	}

	if ((nCounter % 2) == 0) {
		var nPrev = nCurrent - 1;
		$("#offers_view_list .offers_item").eq(nPrev).height(nHeight);
		$("#offers_view_list .offers_item").eq(nCurrent).height(nHeight);
		nHeight = 0;
	}
});

/* #################################################################################### */

$("select[name=c_filter]").change(function() {
	$("form.shop_manufacturer").submit();
});

/* #################################################################################### */


/* #################################################################################### */

/*
// Webshop
$("table#shop_basket tbody tr").hover(function() {
	$(this).addClass("ansicht");
}, function() {
	$(this).removeClass("ansicht");
});
$("table#shop_basket tbody tr:odd").addClass("zeile");

// Bilder
$('.imagelist a').lightBox({
	  overlayBgColor: '#9B0808'
	, txtImage:       'Bild'
	, txtOf:          'von'
});
*/
















});

