$(document).ready(function() {
	// Main-menu
	var parent = $(".menu");
	$(".menu li").each(function() {
		if ($(this).parents("li").length == 0) {
			if (!$(this).hasClass("act")) {
				$(this).hover(
					function() {
						$(this).addClass("act");
					},
					function() {
						$(this).removeClass("act");
					});
			}
		}
	});
	
	// Sub-menu
	$(".sub-menu li").each(function() {
		if ($(this).hasClass("act")) {
			var link = $(this).find("a:first").attr("href");
			$(this).html("<span><span>" + $(this).text() + "</span></span>");
			$(this).click(function() {
				window.location = link;
			});
		}
	});	
	
	// Doorsturen
	$("#btn-doorsturen").toggle(function() {
		$("#pageForward").slideDown();
	},
	function() {
		$("#pageForward").slideUp();
	});
	
	// Bookmark
	$("#btn-bookmark").jFav();
	
	// Fontsize	
	$(".zoom-in").addClass('zoomable');
	$(".zoom-in.zoomable").live('click', function(){
	    $(this).removeClass('zoomable');
	    $(".zoom-out").addClass('zoomable');
	    $(".main-col").css("font-size", "1.2em");
	    
	    for(i = 0; i < 3; i++) {
    	    $(".main-col *").each(function() {
    	        if($(this).children().size() == i) {
//    	            alert(Math.round($(this).css("font-size").replace("px", '')));
    	            $(this).attr("style", "font-size: " + Math.round(parseInt($(this).css("font-size").replace("px", '')) * 1.2) + "px !important;" + $(this).attr("style"));
    	        }
    	    });
	    }
	});
	$(".zoom-out.zoomable").live('click', function(){
        $(this).removeClass('zoomable');
        $(".zoom-in").addClass('zoomable');
        $(".main-col").css("font-size", "1.0em");
        
    	    $(".main-col *").each(function() {
    	        try {
    	            $(this).attr('style', $(this).attr('style').replace(/font-size:[^;]+/g, ''));
    	        } catch (e) { }
    	    });
	  
    });
});
