function initButtons(element)
{
	$("div.mboxsubtitle div.ahbutton, a.ahbutton, a.button, a.abutton, button").button();
	
	
/*if(element)
	{
	//	$("a.ahbutton, a.button, button", element).button();
	}
	else
	{
		$("a.ahbutton, a.button, button").button();
	}*/
}

$(document).ready(function() {
	$('div.textpage p.head a').click(function (){
		switchFAQ($(this).attr('id'));
		return false;
	});
	var rand_no = Math.ceil(100*Math.random())%31+1;
	
	$('body').attr('class', 'b'+rand_no);

	initButtons();

	var openiboxes=new Object;
	$("a.iboxlink").click(function() {
		var id=$(this).attr('id');
		if(openiboxes[id]==true || $.cookie(id)==1)
		{
			$.cookie(id, null);
			$(this).parents('li.ibox').children('div.body').fadeOut();
			openiboxes[id]=false;
			return false;
		}
 		var url=$('#jsnaviurl').text();
 		if(url)
 		{
 			url=url+'&nbx='+id;
 			$(this).parents('li.ibox').children('div.body').remove();		
 			var iboxbody = $('<div class="body"><img src="html/th/slim/img/loading.gif"></div>');
 	 		$(this).parents('li.ibox').append(iboxbody);
 			iboxbody.load(url, {},
                      function (responseText, textStatus, XMLHttpRequest) {
 							openiboxes[id]=true;
 							$(this).children("a.ahbutton, a.button, button").button();
 						}
                     );
 			
 			$.cookie(id, 1);
 			return false;
 		}
 		else
 		{
 			$(this).parents('li.ibox').children('div.body').remove();		
 			var iboxbody = $('<div class="body"><img src="html/th/slim/img/loading.gif">Błąd!</div>');
 	 		$(this).parents('li.ibox').append(iboxbody); 			
 		}
	});

});