<!--

function winopen(url,l,t,w,h) {
	var hWnd = window.open(url,"openWindow"+get_rnd_win(8),"left="+l+", top="+t+" ,width="+w+",height="+h+",resizable=yes,scrollbars=yes,menubar=yes");
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}

// winopen per il calendario
function winopenCAL(url,l,t,w,h) {
	var hWnd = window.open(url,"openWindow"+get_rnd_win(8),"left="+l+", top="+t+" ,width="+w+",height="+h+",resizable=yes,scrollbars=yes,menubar=no");
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}

	function get_rnd_win(ncar) {
		var alfa = "abcdefghijklmnopqrstuvwxyz0123456789";
		var ret = "";
		var pos;
		for (i = 0; i < ncar; i++) {
			pos = Math.floor( Math.random() * ((alfa.length - 1 ) - ((i==0) ? 9 : 0))); // se e' il primo, esclude le cifre
			ret += alfa.charAt(pos);
		}
		return ret;
	}

// winopen autocentrante sul click del mouse
function winopenAC(url,evn,w,h,opt) {
	if (!opt) {
		opt="toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no";
	}
	var dimx = w;
	var dimy = h;
	var x = evn.screenX;
	var y = evn.screenY;
	x = x - parseInt(dimx/2); // correzione per la centratura mouse
	y = y - parseInt(dimy/2); // correzione per la centratura mouse
	var hWnd = window.open(url,"Window_client"+get_rnd_win(8),"left="+x+", top="+y+",width="+dimx+",height="+dimy+","+opt);
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}

// winopen alto-sinistra sul click del mouse
function winopenAS(url,evn,w,h) {
	var x = evn.screenX;
	var y = evn.screenY;
	var hWnd = window.open(url,"Window_client"+get_rnd_win(8),"left="+x+",top="+y+",width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no");
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}

// winopen basso-destra sul click del mouse
function winopenBD(url,evn,w,h) {
	var x = evn.screenX - w;
	var y = evn.screenY - h;
	var hWnd = window.open(url,"Window_client"+get_rnd_win(8),"left="+x+",top="+y+",width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no");
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}
// attiva/disattiva il layer
function swap(lay,evn) {
	var objl;
	var x,y;
	if (document.all) { // MS IE 6
		objl=document.all[lay];
		x = evn.clientX + document.body.scrollLeft;
		y = evn.clientY + document.body.scrollTop;
	} else if (document.getElementById) { // mozilla firefox
		objl=document.getElementById(lay);
		x=evn.pageX;
		y=evn.pageY;
	}
	objl.style.visibility = (objl.style.visibility=="visible") ? "hidden" : "visible";
	objl.style.left = x + 2;
	objl.style.top = y + 2;
}

// attiva/disattiva il layer con puntatore verso sx
function swapSX(lay,evn,width) {
	var objl;
	var x,y;
	if (document.all) { // MS IE 6
		objl=document.all[lay];
		x = evn.clientX + document.body.scrollLeft;
		y = evn.clientY + document.body.scrollTop;
	} else if (document.getElementById) { // mozilla firefox
		objl=document.getElementById(lay);
		x=evn.pageX;
		y=evn.pageY;
	}
	objl.style.visibility = (objl.style.visibility=="visible") ? "hidden" : "visible";
	objl.style.left = x - width;
	objl.style.top = y + 2;
}

//-->

