function apriNew(URL) {
	window.open(URL,"news","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=420,height=400,top=10,left=30");
}

function finestra(){
	if(!document.getElementsByTagName) return;
	l=document.getElementsByTagName("a");
	for(i=0;i<l.length;i++){
		if(l[i].className.indexOf("ext")!=-1){
			l[i].title="(link a sito esterno)";
		}else if(l[i].className.indexOf("new_window")!=-1){
			l[i].title="(link esterno: si apre in una nuova finestra)";
			l[i].onclick=function(){
			var winref = window.open(this.href,'help','');
			winref.window.focus();
			return(false);
			
			
			};
		}
	}
}


function NewWindow(url,myname){ 
var winref = window.open(url,myname,'toolbar=yes,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600,top=10,left=30');
			winref.window.focus();
			return(false);
}

function setCookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function getCookie(Name) {
	var search = Name + "="
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search)
		if (offset != -1) { // if cookie exists
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
	return null;
}

function setWinid() {
//  alert("Set winid = " + window.name);
  setCookie("WINID", window.name, '', '/', '', '');
}
