/**
 * @author Vlad
 */

var menu_timer;
var the_over;

function hide_subs()
{
	the_over.next(".subs").hide();
	
}

$(document).ready(function() {
	
	//newsletter form code
	/*
	$("#newsletterx_box").hover(
		function(){
			$(this).css("background-color","#DF2940");
			$("#newsletterx_over").hide();
			$("#newsletterx_form").show();
		},
		function(){
			$(this).css("background-color","#356D92");		
			$("#newsletterx_form").hide();
			$("#newsletterx_over").show();
		}
	);
	*/

	$("#newsx_input").focus(function(){
		if($(this).val() == "E-mailadres") $(this).val("");
	});

	$("#newsx_input").blur(function(){
		if($(this).val().length == 0) $(this).val("E-mailadres");
	});

	$("#newsletterx_submit").hover(
		function() {$(this).css("background","#B7B6B0 url('https://www.boottotaal.nl/images/img_btn_search.gif') no-repeat scroll left -21px");},
		function() {$(this).css("background","#484846 url('https://www.boottotaal.nl/images/img_btn_search.gif') no-repeat scroll left top");}
	);
	
	
	$("a.cat_link_level_0").each(function(){
		
		$(this).hover(
					function(){						
						the_over = $(this);
						clearTimeout(menu_timer);
						$(".subs").hide();
					var nxt = $(this).next(".subs");
					if(nxt.children("a").length)
					{
					
					var add = 374;
					if($.browser.msie) add = 829;
					var pp = $(this).offset();
					//alert(pp.top-add);
					nxt.css("top",pp.top-add + "px");
					if($.browser.msie) {nxt.css("left","0").children("a").css("float","none");}
					nxt.show();
					}
					}
					,function(){
						
						menu_timer = setTimeout("hide_subs()",500);
						
					}
		);
		
	});
	
	$(".subs").each(function(){$(this).hover(function(){clearTimeout(menu_timer);$(this).prev("a").addClass("cat_active_link");},function(){menu_timer = setTimeout("hide_subs()",500);$(this).prev("a").removeClass("cat_active_link");})});
	
				var new_box = 0,info_box=0,cart_box=0;
				
				$("#box_changer .whats_new_link").click(
						function(e) {e.preventDefault();
							if(new_box == 0)
							{$("#new_box").slideDown(1000);
								if (info_box == 1) {$("#info_box").slideUp(1000);info_box = 0;}
								if (cart_box == 1) {$("#cart_box").slideUp(1000);cart_box = 0;}
								new_box=1;}
							else
							{$("#new_box").slideUp(1000);new_box=0;}
									});
				
				$("#box_changer .info_link").click(
						function(e) {e.preventDefault();
							if(info_box == 0)
							{$("#info_box").slideDown(1000);
								if (new_box == 1) {$("#new_box").slideUp(1000);new_box = 0;}
								if (cart_box == 1){$("#cart_box").slideUp(1000);cart_box = 0;}
								info_box=1;}
							else
							{$("#info_box").slideUp(1000);info_box=0;}
									});
				
				$("#box_changer .cart_link").click(
						function(e) {e.preventDefault();
							if(cart_box == 0)
							{$("#cart_box").slideDown(1000);
								if (new_box == 1) {$("#new_box").slideUp(1000);new_box = 0;}
								if (info_box == 1) {$("#info_box").slideUp(1000);info_box = 0;}
								cart_box=1;
							}
							else
							{$("#cart_box").slideUp(1000);cart_box=0;}
									});
				
				
						
				
							});
