(function($){
	$.fn.w_tooltip = function () {
		return this.each(function() {

			$(this).bind("mouseenter", function(e) {
				var tt = $("#"+$(this).attr("id")+"_body");
				var offset = $(this).position();
				tt.css("left", offset.left + 30);
				tt.css("top", offset.top + 30);
				tt.show();
			});
			$(this).bind("mouseleave", function() {
				$("#"+$(this).attr("id")+"_body").hide();
			});

		});
	}
})(jQuery);


(function($){
	$.fn.w_tabs = function () {
		return this.each(function() {
			$(this).find(".tabcontent").not(":first").hide();
			$(this).find(".tab").bind("click", function(e) {
				$(this).parent().find(".tabcontent").hide();
				$(this).parent().find(".tab").removeClass("active");
				$(this).addClass("active");
				$("#"+$(this).attr("id")+"_content").show();
			}).css("cursor", "pointer");
		});
	}
})(jQuery);


$(document).ready(function(){
	$("ul.sf-menu").superfish();

	$(".shadowbox").dropShadow({opacity:0.5,blur:3,left:2,top:2})
	
	$("#dropdown1").load("/produktberater/dropdowns.php", {category_id: 7271, select_name: "dropdown1"}, function() {
		$(".shadowbox").redrawShadow();
	});
	
	$("#merkzettel").load('/produktanfrage/anfrage_basket.php',function() {
		$(".shadowbox").redrawShadow();
	});

	//$(".tabs").tabs(".panes > div");

	$(".tooltip").w_tooltip();
	$(".w_tabs").w_tabs();
	$(".w_tabs div:first-child").click();
});

window.onload = function() {$(".shadowbox").redrawShadow();}



function new_win() {
	window.open("http://ea.ce-intern.com/_s.php?&fid=6881&fpw=60dc18fcdf881928b1568e844b43fab3","newwindow","width=535,height=390,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,top=5,left=5");
}




function putbasket(id,number, spezifikation) {
	$('#putbasket').load('/produktanfrage/anfrage_putbasket.php', {id: id, number: number, spezifikation: spezifikation}, function() {
		$('#merkzettel').load('/produktanfrage/anfrage_basket.php',function() {$('.shadowbox').redrawShadow();});
		$("img.ok").show();
	})
}


function dropdown1_changed() {
	$("#dropdown2").load("/produktberater/dropdowns.php", {cat1: $("#select_1").val(), select_name: "dropdown2"},function() {
		$(".shadowbox").redrawShadow();
	});
	$("#dropdown3").load("/produktberater/dropdowns.php", {reset: 1, select_name: "dropdown2"});
	$("#dropdown4").load("/produktberater/dropdowns.php", {reset: 1, select_name: "dropdown2"});
	$("#wizard_commit").load("/produktberater/commit.ajax.php", {cat1: $("#select_1").val(), check: 2},function() {
		$(".shadowbox").redrawShadow();
	});
}

function dropdown2_changed() {
	$("#dropdown3").load("/produktberater/dropdowns.php", {cat1: $("#select_1").val(), cat2: $("#select_2").val(), select_name: "dropdown3"},function() {
		$(".shadowbox").redrawShadow();
	});
	$("#dropdown4").load("/produktberater/dropdowns.php", {reset: 1, select_name: "dropdown2"});
	$("#wizard_commit").load("/produktberater/commit.ajax.php", {cat1: $("#select_1").val(), cat2: $("#select_2").val(), check: 3},function() {
		$(".shadowbox").redrawShadow();
	});
}

function dropdown3_changed() {
	$("#dropdown4").load("/produktberater/dropdowns.php", {cat1: $("#select_1").val(), cat2: $("#select_2").val(), cat3: $("#select_3").val(), select_name: "dropdown4"},function() {
		$(".shadowbox").redrawShadow();
	});
	$("#wizard_commit").load("/produktberater/commit.ajax.php", {cat1: $("#select_1").val(), cat2: $("#select_2").val(), cat3: $("#select_3").val(), selected: $("#drowdown3").val(), check: 4},function() {
		$(".shadowbox").redrawShadow();
	});
}

function dropdown4_changed() {
	$("#wizard_commit").load("/produktberater/commit.ajax.php", {cat1: $("#select_1").val(), cat2: $("#select_2").val(), cat3: $("#select_3").val(), cat4: $("#select_4").val(), selected: $("#drowdown4").val()},function() {
		$(".shadowbox").redrawShadow();
	});
}

