function isIE(){if(navigator.userAgent.match(/MSIE \d\.\d+/)){return true}return false}function zIndexWorkaround(){if(isIE()){$("div.menu").parents().each(function(){var b=$(this);var c=b.css("position");if(c=="relative"||c=="absolute"||c=="fixed"){b.hover(function(){$(this).addClass("on-top")},function(){$(this).removeClass("on-top")})}})}}function load(){elem=window.location.hash.substring(1);console.log("carico"+elem);if(elem.substring(0,1)=="l"){loadNews(elem.substring(1))}else{if(elem.substring(0,1)=="n"){loadList(elem.substring(1))}else{menuLoad(window.location.hash.substring(1))}}}function menuLoad(b){b=parseInt(b)||5;$.ajax({url:"controller.php",global:false,type:"GET",data:({action:"viewsection",elementid:b}),dataType:"html",success:function(c){$("div#whitebox").html(c);
	/*																																																																																																																																																																																																			   	$("#slidebox").css("height","auto");
	a = $("#whitebox").height();
	b = $("#slidebox").height();
	
	if (b<a){
		$("#slidebox").css("height",a+"px");
	}else{
		$("#slidebox").css("height",b+"px");
	}*/
setUrl(b)}})}function loadNews(b){$.ajax({url:"controller.php",global:false,type:"GET",data:({action:"viewnews",news:b}),dataType:"html",success:function(c){$("div#whitebox").html(c);setUrl("l"+b);$("html").animate({scrollTop:"10px"},500);
	
	/*																																																																																																																																																																																																			   	$("#slidebox").css("height","auto");
	a = $("#whitebox").height();
	b = $("#slidebox").height();
	
	if (b<a){
		$("#slidebox").css("height",a+"px");
	}else{
		$("#slidebox").css("height",b+"px");
	}*/
	}})}
function news(){
	$(".list.news").click(function(){
		var b=$(this).attr("id").substring(2);
		loadNews(b)
	});
	$(".next.news").button().click(function(){
		var b=$(this).attr("id").substring(2);
		$.ajax({
			url:"controller.php",
			global:false,
			type:"GET",
			data:({start:b,action:"nextnews"}),
			dataType:"html",
			success:function(c){
				$("#news").html(c);
					/*																																																																																																																																																																																																			   	$("#slidebox").css("height","auto");
	a = $("#whitebox").height();
	b = $("#slidebox").height();
	
	if (b<a){
		$("#slidebox").css("height",a+"px");
	}else{
		$("#slidebox").css("height",b+"px");
	}*/
				news()
			}
		})
	});
		
	$(".prev.news").button().click(function(){
		var b=$(this).attr("id").substring(2);
		$.ajax({
			url:"controller.php",
			global:false,
			type:"GET",
			data:({start:b,action:"prevnews"}),
			dataType:"html",
			success:function(c){
				$("#news").html(c);
	/*																																																																																																																																																																																																			   	$("#slidebox").css("height","auto");
	a = $("#whitebox").height();
	b = $("#slidebox").height();
	
	if (b<a){
		$("#slidebox").css("height",a+"px");
	}else{
		$("#slidebox").css("height",b+"px");
	}*/
				news()
			}
		})
	});
	
	$("div.news.list").css("border-left","dotted 0.5px white").mouseover(function(){$(this).css("border-left","dotted 0.5px #FF4B00");$(this).children("span.date").css("color","#FF4B00")}).mouseout(function(){$(this).css("border-left","dotted 0.5px white");$(this).children("span.date").css("color","#999999")})}function setUrl(b){location.hash=b}$("#dialogs").ready(function(){$("#registerForm").dialog({autoOpen:false,bgiframe:true,position:["top","center"],draggable:false,resizable:false,width:"50%",show:"blind",hide:"blind",title:$(this).attr("title"),modal:true,buttons:{"Crea un nuovo utente":function(){$.ajax({url:"controller.php",type:"GET",dataType:"html",data:$.param($("element")),success:function(){},error:function(){}})},Annulla:function(){$(this).dialog("close")}},close:function(){}});$("#register").button().click(function(){$("#registerForm").dialog("open")});$("#signout").click(function(){$.ajax({url:"controller.php",global:false,type:"GET",data:({action:"logout"}),dataType:"html",success:function(b){$.cookie("usr",null);$.cookie("pwd",null);window.location.reload()}})})});$("#menu").ready(function(){$("a.menu").hover(function(){$(this).addClass("ui-state-focus")},function(){$(this).removeClass("ui-state-focus")});$(".menubtn").each(function(){id=$(this).attr("id");test=$(this).next().text().length;if(test){$("#"+id).menu({flyOut:true,content:$(this).next().html(),show:200})}})});$("#newscontainer").ready(function(){news()});function viewsearch(){$.ajax({url:"controller.php",global:false,type:"GET",data:({action:"search",string:$("#cerca").val()}),dataType:"html",success:function(b){$("#whitebox").html(b)}})}function startEdit(){}$(function(){zIndexWorkaround()});
