var last_row;

$(document).ready(function(){

	if ($.browser.msie && $.browser.version == '6.0') {
		$('.downloadTable tr.hov').hover(
			function(){ $(this).addClass('ie-hover') },
			function(){ $(this).removeClass('ie-hover') }
		)
	}
	
	/* Menue Hoehe berechnen und overlay anpassen */
	var tmp_menuHeight = $('.menu-ul').outerHeight() -10;
	var tmp_menuheaderHeight = $('.menuheader').outerHeight()
	var tmp_liCount = $(".menu-ul li").length
	var overlayHeight = tmp_menuHeight + tmp_menuheaderHeight + tmp_liCount
	$('#overlay').css('height',overlayHeight)
/* /Menue Hoehe berechnen und overlay anpassen */
		
/* Breite der Produktbildzählergrafiken berechnen */
	var prodBildItems = $('.bildCounter a').length;
	$('.bildCounter').css({width: prodBildItems * 27});
/* /Breite der Produktbildzählergrafiken berechnen */

/* Standardeinstellungen */
	$('.menu-ul li:first').css({'border-top':'0px solid #ccc'})
	$('.auswahl li.aktuell').css({'display':'block'})
	$('.liLandauswahl .auswahl li.lang:last, .liSprachauswahl .auswahl li.lang:last').css({'border-bottom':'1px solid #999'})

	/* Sprachauswahl ein und ausblenden */
	$('.liLandauswahl .auswahl li.aktuell').toggle(
		function () {
			$(this).siblings('.lang').show()
		},
		function () {
			$(this).siblings('.lang').hide()
		}
	)
	/* Sprachauswahl ein und ausblenden */
	$('.liSprachauswahl .auswahl li.aktuell').toggle(
		function () {
			$(this).siblings('.lang').show()
		},
		function () {
			$(this).siblings('.lang').hide()
		}
	)

	/* Wechsel des Homepagebild */
	//alert($('.hpBigMedium img').attr('src'));

	/* /Wechsel des Homepagebild */
	
	/* Hover der beiden Homepagebild-Teaser unten auf der Homepage */
	$('a.teaserLink img').hover(
		function() {
			var bild = $(this).attr('src');
			var bildTeile = bild.split('off');
			var onBild = (bildTeile[0]+'on'+bildTeile[1])			
			$(this).attr({src:onBild})
		},
		function() {
			var bild = $(this).attr('src');
			var bildTeile = bild.split('on');
			var onBild = (bildTeile[0]+'off'+bildTeile[1])			
			$(this).attr({src:onBild})
		}
	)
	/* /Hover der beiden Homepagebild-Teaser unten auf der Homepage */

})

/* ScrollFix */
/*
$(window).resize(function(){
	var tmp_maincontainer_height = $('#simonswerk_content').height();
	var tmp_window_height = $(window).height();

	var tmp_maincontainer_width = $('#simonswerk_content').width();
	var tmp_window_width = $(window).width();


	if (tmp_window_height <= tmp_maincontainer_height) {
		$('#simonswerk_content').css('top','0')
		$('#simonswerk_content').css('margin-top','0')
	} else {
		$('#simonswerk_content').css('top','50%')
		$('#simonswerk_content').css('margin-top','-325px')
	}

	if (tmp_window_width <= tmp_maincontainer_width) {
		$('#simonswerk_content').css('left','0')
		$('#simonswerk_content').css('margin-left','0')
	} else {
		$('#simonswerk_content').css('left','50%')
		$('#simonswerk_content').css('margin-left','-464px')
	}
})
*/

var anzahl = 0;
var m = 0;
var id_alt;
var img_alt;

function showMenu(id,img) {
	if (anzahl==1 && id_alt != id) {
		document.getElementById(id_alt).style.display = "none";
		document.getElementById(img_alt).src = "art/arrow_menu_r.gif";
		document.getElementById(id).style.display = "block";
		document.getElementById(img).src = "art/arrow_menu_d.gif";
		id_alt = id;
		img_alt = img;
	}
	else {
		if (m==1) {
			document.getElementById(id).style.display = "none";
			document.getElementById(img).src = "art/arrow_menu_r.gif";
			anzahl = anzahl - 1;
			m = m - 1;
		}
		else {
			document.getElementById(id).style.display = "block";
			document.getElementById(img).src = "art/arrow_menu_d.gif";
			anzahl = anzahl + 1;
			m = m + 1;
			id_alt = id;
			img_alt = img;
		}
	}
}

var oldname = "product00";
var oldanchor;

function changeProduct(name) {
	$('#'+oldname).hide();
	$('#'+name).show();
	oldname=name;
}

function closeAdvice() {
	document.getElementById('overlayFull').style.display = "none";
	document.getElementById('hinweis').style.display = "none";
}


