<!-- Funzioni per spostamento console -->
var isMoving = false;
var prevX, prevY;
var obj;

function BeginMoveConsole(object) 
{
	if (!isMoving)
	{
		obj = object;
		isMoving = true; 
		prevX = event.x;
		prevY = event.y;
	}
}

function EndMoveConsole()
{
	document.cookie = "ConsoleLeft = " + obj.offsetLeft;
	document.cookie = "ConsoleTop = " + obj.offsetTop;
	isMoving = false;
}

function MoveConsole()
{
	if (isMoving)
	{
		var deltaX, deltaY;
		deltaX = event.x - prevX;
		deltaY = event.y - prevY;
		obj.style.left = obj.offsetLeft + deltaX;
		obj.style.top = obj.offsetTop + deltaY;
		prevX = event.x;
		prevY = event.y;
	}
}
<!-- Fine funzioni per spostamento console -->

// begin absolutely positioned scrollable area object scripts 
function verifyCompatibleBrowser(){ 
	this.ver=navigator.appVersion 
	this.dom=document.getElementById?1:0 
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
	this.ie4=(document.all && !this.dom)?1:0; 
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	
	this.ns4=(document.layers && !this.dom)?1:0; 
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
	return this 
} 
bw=new verifyCompatibleBrowser() 
	
	
var speed=50 
	
var loop, timer 
	
function ConstructObject(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.' 
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
	this.up=MoveAreaUp;this.down=MoveAreaDown; 
	this.MoveArea=MoveArea; this.x; this.y; 
	this.obj = obj + "Object" 
	eval(this.obj + "=this") 
	return this 
} 
function MoveArea(x,y){ 
	this.x=x;this.y=y 
	this.css.left=this.x 
	this.css.top=this.y 
} 
	
function MoveAreaDown(move){ 
		if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
	this.MoveArea(0,this.y-move) 
	if(loop) timer=setTimeout(this.obj+".down("+move+")",speed) 
		} 
} 
function MoveAreaUp(move){ 
		if(this.y<0){ 
	this.MoveArea(0,this.y-move) 
	if(loop) timer=setTimeout(this.obj+".up("+move+")",speed) 
		} 
} 
	
function PerformScroll(speed){ 
		if(initialised){ 
				loop=true; 
				if(speed>0) objScroller.down(speed) 
				else objScroller.up(speed) 
		} 
} 
	
function CeaseScroll(){ 
	loop=false 
	if(timer) clearTimeout(timer) 
} 

function ShowWindow(strURL,pageWidth,pageHeight,pageTop,pageLeft,scroll)
{
	if(window.showModalDialog)
	{
		if(scroll)
			eval("window.showModalDialog(strURL,null,'dialogWidth:" + pageWidth + "px;dialogHeight:" + pageHeight + "px;status:no;scroll:yes;resizable:no;help:no;dialogHide:yes;')");
		else
			eval("window.showModalDialog(strURL,null,'dialogWidth:" + pageWidth + "px;dialogHeight:" + pageHeight + "px;status:no;scroll:no;resizable:no;help:no;dialogHide:yes;')");
	}
	else
	{
		if(scroll)
			eval("window.open(strURL,null,'height=" + pageHeight + "px,width=" + pageWidth + "px,top=" + pageTop + "px,left=" + pageLeft + "px,scrollbars=1,,modal=yes;')");
		else
			eval("window.open(strURL,null,'height=" + pageHeight + "px,width=" + pageWidth + "px,top=" + pageTop + "px,left=" + pageLeft + "px,scrollbars=0,,modal=yes;')");
	}
}

//funzioni per cookie
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function ShowSedi(tipoSede)
{
	var trPHNaz = document.getElementById("trPhNazionale");
	var trLinkNaz = document.getElementById("trLinkNazionale");
	
	var trPHReg = document.getElementById("trPhRegionale");
	var trLinkReg = document.getElementById("trLinkRegionale");
	
	var trPHComp = document.getElementById("trPhComprensoriale");
	var trLinkComp = document.getElementById("trLinkComprensoriale");
	
	var trLinkServizi = document.getElementById("trLinkServizi");
	
	var trLinkSmall = document.getElementById("trLinkSmall");
	var trLinkBig = document.getElementById("trLinkBig");
	
	trLinkBig.style.display = "none";
	trLinkBig.style.visibility = "hidden";
	
	trLinkSmall.style.display = "block";
	trLinkSmall.style.visibility = "visible";
	
	
	var arrDisplay = new Array(4)
	var arrVisibility = new Array(4)
	
	arrDisplay[0] = "none";
	arrDisplay[1] = "none";
	arrDisplay[2] = "none";
	arrDisplay[3] = "none";
	
	arrVisibility[0] = "hidden";
	arrVisibility[1] = "hidden";
	arrVisibility[2] = "hidden";
	arrVisibility[3] = "hidden";
	
	if(tipoSede == -1)
	{
		for(i=0;i< arrDisplay.length; i++)
		{
			arrDisplay[i] = "block";
			arrVisibility[i] = "visible";
		}
	}
	else
	{
		arrDisplay[tipoSede] = "block";
		arrVisibility[tipoSede] = "visible";
	}
	
	trPHNaz.style.display = arrDisplay[0];
	trPHNaz.style.visibility = arrVisibility[0];
	trLinkNaz.style.display = arrDisplay[0];
	trLinkNaz.style.visibility = arrVisibility[0];
	
	trPHReg.style.display = arrDisplay[1];
	trPHReg.style.visibility = arrVisibility[1];
	trLinkReg.style.display = arrDisplay[1];
	trLinkReg.style.visibility = arrVisibility[1];

	trPHComp.style.display = arrDisplay[2];
	trPHComp.style.visibility = arrVisibility[2];
	trLinkComp.style.display = arrDisplay[2];
	trLinkComp.style.visibility = arrVisibility[2];
	
	trLinkServizi.style.display = arrDisplay[3];
	trLinkServizi.style.visibility = arrVisibility[3];
	
}
//fine

var initialised; 
// end absolutely positioned scrollable area object scripts 

function openNewWindow(theURL,winName,w,h) 
{
	var win = window.open(theURL,winName,'scrollbars=yes,toolbar=no,width=' + w + ',height=' + h );
	win.focus();
}
