// JavaScript Document

$(document).ready(function(){ 
	/*
	// slider shoppingcart
	$("#shoppingcart").hover(
		function(){ $("#open_shoppingcart_hd").show();}, 
		function(){	$("#open_shoppingcart_hd").hide();}
	);*/
	
	// open language select
	$("#country_change").click(function() {
		$(this).hide();
		$("#language_list").hide();
		$("#country_list").show();
	});
	
	// close language select
	$("#country_list_close").click(function() {
		$("#country_list").hide();
		$("#language_list").show();
		$("#country_change").show();
	});
	
  // slider login
	$("#login").hover(
		function(){ $("#login_box").show();}, 
		function(){	$("#login_box").hide();}
	);

	// open i want
	$("#iwant_btn_open").click(function() {
		$("#iwant_hidden").show();
	});
	
	// close i want
	$("#iwant_btn_close").click(function() {
		$("#iwant_hidden").hide();
	});
	
		// open moredetails
	$("#moredetails_open").click(function() {
		$("#moredetails_inactive").hide();
		$("#moredetails_active").show();
	});
	
	// close moredetails
	$("#moredetails_close").click(function() {
		$("#moredetails_active").hide();
		$("#moredetails_inactive").show();
	});
	
	// CheckoutHilfe InfoBox SlideIn/SlideOuts - Left Menu
	
	$("ul .hoverInfoBox").hover(
		function() { 
			$(this).find('div:first').show();
		},
		function () {
		 	if (!$(this).hasClass("active"))
				$(this).find('div:first').hide();
	});
	
	// CheckoutHilfe AGBInfoBox Vertical-SlideIn/SlideOuts

	$("#checkout_agb_link").hover(
		function(){
			var boxHeight = 0;
		
			if ($.browser.msie && (navigator.userAgent.indexOf('MSIE 8.0')==-1))
				boxHeight = $("#bottomAgbInfoBox").innerHeight()-15;
			else
				boxHeight = $("#bottomAgbInfoBox").innerHeight()+5;
			
			$("#bottomAgbInfoBox").css("margin-top", -boxHeight);
			$("#bottomAgbInfoBox").show();
		},
		function() {
			$("#bottomAgbInfoBox").hide();
	});
	
	$("#bottomAgbInfoBox").hover(
		function(){
			$(this).show();
		},
		function() {
			$(this).hide();
	});
	
	$("#bottomAgbInfoBox").click(function(){$("#bottomAgbInfoBox").hide(); $("#bottomAgbInfoBox").removeClass("active");});
	
	// Slidedown Menu left	
	$("li.folder").each(function(i) {
	
 			var sub_ul = $(this).find("ul");
			var p_li = $(this);
			
			$(this).find('a:eq(0)').click(function() { 
				if (p_li.hasClass("active"))
				{
					sub_ul.hide();
					p_li.removeClass("active");					
				}
				else
				{
					sub_ul.show();
					p_li.addClass("active");
				}
			});
	});
	
	// Delivery Address opener/closer
	
	$(".delivery_address").each(function(i) {																			 
		var content = $(this).find(".content");
		var closer = $(this).find(".closeaddress");
		$(this).find(".openaddress").click(function() {
			$(this).hide();
			closer.show();
			content.slideDown();
		});
	});
	
	$(".delivery_address").each(function(i) {																			 
		var content = $(this).find(".content");
		var opener = $(this).find(".openaddress");
		$(this).find(".closeaddress").click(function() {
			$(this).hide();
			content.slideUp();
			opener.show();
		});
	});
	
	// open delivery_address
	$("#otherdeliveryaddress").click(function() {
		$("#delivery_address").toggle();
	});
	
	// Toggle DetailSub_Info
	$("#sub_detail_infotoggle").toggle(
			function(){
				$(".detail_add_info").show();
			},
			function(){
				$(".detail_add_info").hide();
		});
	
	// Click Quickorder
	$("#quickorder").click(
		function() {
				if ($("#openquickorder").css("display") == "block")
				{
					$("#openquickorder").hide();
				}
				else
				{
					$("#openquickorder").show();
					$(".error").hide();
					$(".success").hide();
				}
	});
	$("#close_quickorder").click(
			function() {
					if ($("#openquickorder").css("display") == "block")
					{
						$("#openquickorder").hide();
					}
		});
	
	// Click CallBack
	$(".contact_tel_act").click(
		function() {
				if ($("#open_contact_tel_act").css("display") == "block")
				{
					$("#open_contact_tel_act").hide();
				}
				else
				{
					$("#open_contact_tel_act").show();
					$("#messageError").remove();
					$("#open_contact_tel_act span.error").removeClass("error");
					$(".success").remove();
				}
	});
	$("#close_contact_tel_act").click(
			function() {
					if ($("#open_contact_tel_act").css("display") == "block")
					{
						$("#open_contact_tel_act").hide();
					}
		});
    });
