$(document).ready(function () {

	// ein-/ausklappbare Definitionslists
	$("dl.collapseList dd").hide();
	$("dl.collapseList dt").click(function(){
		if ($(this).next("dd").css("display")!="block") {
			$(this).addClass("selected");
			$(this).next().slideDown("fast");
		} else if ($(this).attr("class")=="selected") {
			$(this).next().slideUp("fast");
			$(this).removeClass("selected");
		}
		return false;
	});

	// Schnellzugriff Einsatzbereiche
	$("ul#quickList li:even").addClass("alt");
	$('#quickListSwitcher').click(function () {
		$('ul#quickList').slideToggle('medium');
	});
	
	// open all links with 'li.external a' in a new browser window
	// $("li.external a, a[title='Bilddatenbank']").click( function() {
	// $("li.external a").click( function() {
	//	window.open(this.href);
	//	return false;
	//});
	
	$("ul.productsList li.item").click(function() {
			if (! $(this).hasClass("external"))
			{
				var href = $("a", $(this)).attr("href");
				window.location = href;
				return false;
			}
		});

	$("li.external a, a.external").each(function(index) {
	    $(this).attr("title", $(this).attr("title") + " - opens in an external window");
		
		var href = $(this).attr("href");

		$(this).click(function() {
			window.open(href);
			return false;
		});

		$(this).parent("li").click(function() {
			window.open(href);
			return false;
		});

  });

	
	// Hover für die QS Logos in der Kontextspalte
	$("img.gsHover").fadeTo("slow", 0.2); // This sets the opacity of the thumbs to fade down to 20% when the page loads
	 	$("img.gsHover").hover(function(){
	 	$(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
	 	},function(){
	 	$(this).fadeTo("slow", 0.2); // This should set the opacity back to 20% on mouseout
	});
			
	// Hover für Logo mit Textlink Verknüpfung in der Sidebar
	$(".boxHover img").fadeTo("slow", 0.2); // This sets the opacity of the thumbs to fade down to 20% when the page loads
	$(".boxHover").hover(function(){
		$(this).addClass("selected");
			$(".selected img").fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(".selected img").fadeTo("slow", 0.2); // This should set the opacity back to 20% on mouseout
			$(this).removeClass("selected");
	});
});

