// Autore: F.Roverseti (C.R.P.A.) //

var cur = new Date();


function getFullYear(numAnno){
  if (numAnno <= 1900) 
    return (numAnno+1900);
  else
   return (numAnno);    
}

function getDateShort() {
	
	// la funzione getMonth() e' zero-based 0=>January....
	var Today = cur.getDate() + "-" + (cur.getMonth()+1) + "-" + getFullYear(cur.getYear());
 	
	return (Today);

}

function RefreshWindow() { 

		browserName=navigator.appName;
		browserVer=parseInt(navigator.appVersion);
      if (browserName == "Netscape" && browserVer >= 2) {
			document.refresh;
		}
	}

function GoToLink(sValue)	{

	if (sValue != "")	{
	
		scookie	=	"";
		Site		=	"";
		level		=	"";
		
		sSep="**";
		sSep1="*cookie=";

		PosAt=sValue.indexOf(sSep);
		PosAt1=sValue.indexOf(sSep1);

		//Site = sValue.substring(PosAt,sValue.lenght); BUG !!!!
		//Site = sValue.substring(PosAt,0, PosAt);
		Site = sValue.substring(0, PosAt);
	  level= sValue.substring(PosAt+sSep.length);
		
		if (PosAt1 != -1) {
			PosAt1=level.indexOf(sSep1);
			//scookie= level.substring(PosAt1+9);
			scookie= level.substring(PosAt1+sSep1.lenght+1);
			level= level.substring(PosAt1,level.lenght);
		};
		
		if (Site != "" ) {
			if (scookie != "" ) {
				setTitle(scookie);
			}
				//alert(level);
	 	 		eval(level).location = Site;
			}	
		} 

  }


  

/* 
	Autore: C.Veronesi (C.R.P.A.) 
	Modificata..: f.roverseti - ho passato i parametri per
		dimensionare la finestra.
	Data..: 27/03/00
*/
function openChartWindow(url, width, height) {
	
	if (width == "") width = 500 ;
	if (height == "") height = 300 ;
	
	window.open(url, 'Chart' + Math.round(Math.random() * 1000), 'scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',status=yes,titlebar=no,menubar=yes');
}

function openCardWindow(url,width, height) {
  if (width == "") width = 500 ;
	if (height == "") height = 300 ;
	
	window.open(url, 'Card' + Math.round(Math.random() * 1000), 'scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',status=yes,titlebar=no,menubar=yes');

}
	
	
	var win = null;

function NewWindow(mypage,myname,w,h,scroll){

  if (w == "") w = 500 ;
	if (h == "") h = 300 ;

	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+
	',resizable,status=yes,titlebar=yes,menubar=yes'
	
	win = window.open(mypage,myname,settings)
	if(win.window.focus){win.window.focus();}
}

function openPrintWindow(url) {
	NewWindow(url,'Print' + Math.round(Math.random() * 1000),700,450,'yes');
}

// Massimizzare le finestre
function maximizeWin() {  
	if (window.screen) {
    var aw = screen.availWidth;    
		var ah = screen.availHeight;
    window.moveTo(0, 0);    
		window.resizeTo(aw, ah);  
	}
}