$(document).ready(function(){

    //highlight current button
	b = $(document).getUrlParam("buttonID");
	if(b)
		o = $("#menu li.buttonID_" + b).addClass("highlight");
	else
    	o = $("#menu li:first").addClass("highlight");

	mVTab = $("#container").attr("class").split('_')[1];

	//highlight current main tab
	$("#menu li.buttonID_" + mVTab).addClass("tab_high").find("a:first").addClass("tab_high").wrap("<span class=\"tab\"><span class=\"tab_left\"><span class=\"tab_right\"></span></span></span>");

    //show current submenu
	$("#menu li.buttonID_" + mVTab).find("ul:eq(0)").css('display','block').addClass('currentSubmenu');

	//over tabs
	$("#menu ul li:not(.buttonID_" + mVTab + ")").hover(
    	function(){
    		if($(this).find("ul:hidden").html()){
				$("#menu ul li.buttonID_" + mVTab + " ul:first").fadeOut('slow');
				$(this).find("ul:hidden").css('z-Index','100').fadeIn('slow');
    		}
    	},
    	function(){
    		if($(this).find("ul:visible").html()){
				$("#menu ul li.buttonID_" + mVTab + " ul:first").fadeIn('slow');
				$(this).find("ul:visible").fadeOut('slow');
    		}
    	}
	);

	//change boxed template
	//$("div.boxed").wrap("<div class=\"boxed_border_back\"><div class=\"boxed_border\"></div></div>").corner("round 5px").parent().css("padding","1px").corner("round 6px");
	$("div.boxed").corner("round 10px");


	//forms
	$("form input:submit,form input:button").addClass("roundedButton").attr('style','').wrap("<div class=\"roundedButton\"><div class=\"roundedButton_left\"><div class=\"roundedButton_right\"></div></div></div>");
    $("form div.roundedButton").click(function(){
    	$(this).parents("form")[0].submit();
    });
	$("form input:text,form input:password").addClass("roundedInput").attr('style','').wrap("<div class=\"roundedInput\"><div class=\"roundedInput_left\"><div class=\"roundedInput_right\"></div></div></div>");
	$("form textarea").addClass("roundedArea").addClass("clear").attr('style','').wrap("<div class=\"roundedArea clear\"><div class=\"roundedArea_top\"><div class=\"roundedArea_bottom\"><div class=\"roundedArea_left\"><div class=\"roundedArea_right\"><div class=\"roundedArea_tl\"><div class=\"roundedArea_tr\"><div class=\"roundedArea_bl\"><div class=\"roundedArea_br\"></div></div></div></div></div></div></div>");

	//left menu change...
	$(".left_menu li:even").addClass("oddRow");
	$(".left_menu li:odd").addClass("evenRow");

	//change read more links...
	$(".article div.content a").each(function(){
		d = $(this).parent("div");
		if(!d.hasClass('read_more') && !d.hasClass('more_info') && $(this).html().indexOf("Lees verder") > -1){
			$(this).wrap('<div class="more_info"></div>');
		}
	});

	//change the stupid HR behavour of IE...
	if($.browser.msie)
		$("#content hr").css('display','none').wrap("<div class=\"hr\"></div>");

});

//emulate popup function...
function popWindow(u,w,h){
	$("<img width=\"" + w + "\" height=\"" + h + "\">")
		.attr('src',u)
		.appendTo('#container')
		.displayBox();
}
