
$(document).ready(function(){
	$("span.cat_link_plus").each(function(){
		$(this).toggle(function(){
			var me = $(this);			
			var actor = me.next().next(".subs");			
			actor.slideDown("fast");
			me.text("[-]");
		},
		function(){
			var me = $(this);			
			var actor = me.next().next(".subs");			
			actor.slideUp("fast");
			me.text("[+]");
		});
	});
	
	if($("#push_search input").val().length > 0)
		$("#push_search input").css("background","#FFF");
	
	$("#push_search input").focus(function(){
		
			$(this).css("background","#FFF");
	});
	
	$("#push_search input").blur(function(){
		if($(this).val().length == 0)
			$(this).css("background","#FFF url(http://www.tresbon.nl/images/site/search_bg.jpg) no-repeat 0 0");
		
	});
	
	$("#pc_button").click(function(evt){
		evt.preventDefault();
		$(this).blur();
		$("#postcode_result").hide();
		var pc = $("#pc_input").val();
		if(pc.length==0)
			{
				alert("Vul een geldige postcode in!");
				$("#pc_input").focus();
			}
		else
		{
			$.post("http://www.tresbon.nl/postcode_check.php",
					{code:pc},
					function(data) {$("#postcode_result").html(data).slideDown("fast");}
			);
		}
		
	});
	
	$("#pc_input").focus(function(){
		
		$(this).css("background","#FFF");
	});

	$("#pc_input").blur(function(){
	if($(this).val().length == 0)
		$(this).css("background","#FFF url(http://www.tresbon.nl/images/site/postcode_bg.jpg) no-repeat 0 0");
	
	});
	
	$("a.help_link").each(function(){
		$(this).click(function(aa) {aa.preventDefault();$(this).parent().next("div").slideToggle("fast");});
	}
	);
	
	$("#email_save").click(function(){
		var result = new Array();
		result.push(0);//default value just in case the user does not want any notification
		$("input.cb_days").each(function(){
			if($(this).attr("checked"))
					result.push($(this).val());
			
		});
		
		$("#email_loading_mask").fadeIn("fast");
		$.post(
				"em_not.php",
				{ days: result.join("_"),b1:$("#butter1").val(),b2:$("#butter2").val()},
				function(data){$("#email_loading_mask").html(data);}
				);
		
	});
	
	
	
});

function popup(what,name,ww,hh)
{
window.open(what,name,'toolbar=no,statusbar=no,location=no,scrollbars=yes,resizable=yes,width='+ww+',height='+hh);
}



  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-27030786-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


