$(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");

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

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

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

	//forms
	$("form input:submit,form input:button").addClass("roundedButton").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").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>");


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

	//change link classnames
	$(".article a").each(function(){
		if($(this).attr("href")){
			p = $(this).attr("href").split('.');
			if(p[p.length - 1].toLowerCase() == 'pdf')
				$(this).addClass('pdfLink');
		}
	});

	//change catalog menu...
	$("ul.catalog_menu").wrap('<div class="catalog_menu_wrap"></div>').corner("5px");

	//change half
	$("div.half:odd").css("margin-right",'0px');

	//change catalogus
	$(".catalog_module div.item").corner("round 5px");
	$(".catalog_module div.more_info_link a,.catalog_module div.order_link a").addClass("roundedButton").wrap("<div class=\"roundedButton\"><div class=\"roundedButton_left\"><div class=\"roundedButton_right\"></div></div></div>")

	$(".catalog_module .item").corner("5px");
	$(".catalog_module .item:odd").css("margin-right",'0px').css("float",'right');

	$(".catalog_module form").attr('action',"/index.php?module=sendform").attr('method',"post");
	$(".catalog_module form input#naam").remove();
	$(".catalog_module form input#email").remove();

});

//start sign app
function sign_app(){
	$('<iframe name="sign_app" class="sign_app" width="802" height="602"></iframe>').attr('src','/domains/allintext.nl/modules/sign_app/index.php').modal();
}

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