if (navigator.appName != "Netscape")
var DefErrHand = onerror;

function gotoURL (URLname, SelectForm)
{
      if (URLname != "")
	{
		if(URLname == "Site Map")
		{	
			SelectForm.target = "MAP_BROWSER";
			SelectForm.submit ();
		}
		else
			self.location = URLname;
	}
}
function IEErrHand ()
{
	onerror = DefErrHand;
	return true;
}

function GoToDBMode (baseurl,dburl)  // Function to start Content Editor
{
      var baseurl;
      var dburl; 
      var host=baseurl;
      var host=host.substring(5,host.length)

	var ScrWidth;
	var ScrHeight;
	var ScrOptions;

	if ((navigator.appName == "Netscape") && (navigator.appVersion.charAt(0) == '3'))
	{
		var toolkit = java.awt.Toolkit.getDefaultToolkit();
		var IE3screen = toolkit.getScreenSize();
		ScrWidth = IE3screen.width;
		ScrHeight = IE3screen.height;
	}
	else
	{
		ScrWidth = screen.width;
		ScrHeight = screen.height;
	}
	if(ScrWidth > 800)
	{
		ScrWidth = 760;
		ScrHeight = 550;
	}
	else
	if(ScrWidth == 800)
	{
		ScrWidth = 700;
		ScrHeight = 500;
	}
	else
	{
		ScrWidth = 630;
		ScrHeight = 380;
	}

	if (navigator.appName != "Netscape")
		onerror = IEErrHand;

	ScrOptions = "width=" + ScrWidth + ",height=" + ScrHeight + ",resizable=1,status=1,menubar=0,scrollbars=1";
	remote=window.open ("https:" + host + dburl,"MAIN_BROWSER", ScrOptions);
	remote.focus();

	if (navigator.appName != "Netscape")
		onerror = DefErrHand;
}

function RunPersonalSearch()
{
	document.UserSearch.submit();
}

function StartMapSite()  // Function to open the Site Map
{
	remote=window.open ("/wfprog/WebWork.exe?FNC=MapSite__ANavigatorHead_htm___##WF_DirID##___Applet___Static", "MAP_BROWSER",
	"width=250,height=470,resizable=1,status=1,menubar=0,scrollbars=1");
	remote.focus();
}

function GoToHelp()
{
	remote=window.open ("//hal9000.cisi.unito.it/wf/Help/assistenza.htm","MAPPE",
		"width=500,height=200,resizable=1,status=1,menubar=0,scrollbars=1");
	remote.focus();
}
function GoToIndice()
{
	remote=window.open ("//hal9000.cisi.unito.it/wfprog/GetURL.exe?ID=1&type=2","INDICE",
		"width=270,height=600,resizable=1,status=1,menubar=0,scrollbars=1");
	remote.focus();
}
function GoToMappa(mappaURL)
{     var mappaURL;
	remote=window.open (mappaURL,"MAPPE",
		"width=580,height=580,resizable=1,status=1,menubar=0,scrollbars=1");
	remote.focus();
}
function GoToAvvisi(pagina)
{
        remote=window.open (pagina,"avvisi",
                "width=500,height=350,resizable=1,menubar=0,toolbar=1,scrollbars=1");
        remote.focus();
}
function GoToNota(pagina)
{
        remote=window.open (pagina,"note",
                "width=600,height=300,resizable=1,menubar=0,toolbar=0,scrollbars=1");
        remote.focus();        
}
function GoToLNota(pagina)
{
        remote=window.open (pagina,"note",
                "width=800,height=600,resizable=1,menubar=0,toolbar=0,scrollbars=1");
        remote.focus();        
}
function OpenPage(pagina)
{
        remote=window.open ("http://hal9000.cisi.unito.it/wfprog/GetURL.exe?ID=" + pagina + "&amp;type=1","note",
               "width=800,height=600,location=1,resizable=1,menubar=1,toolbar=1,scrollbars=1");
        remote.focus();
}
function GoToPage(pagina)
{
        remote=window.open (pagina,"pagina",
                "width=800,height=600,resizable=1,menubar=1,toolbar=1,scrollbars=1,location=1");
        remote.focus();
}
function GoToTest(pagina)
{
        remote=window.open (pagina,"test",
                "width=800,height=600,resizable=0,menubar=0,toolbar=0,scrollbars=1");
        remote.focus();
}

function DisplayNota(pagina)
{
        
        var stringa=pagina;
               out = "%20"; // replace this
              add = " "; // with this
                temp = "" + stringa; // temporary holder

                  while (temp.indexOf(out)>-1) {
               pos= temp.indexOf(out);
                  temp = "" + (temp.substring(0, pos) + add + 
                   temp.substring((pos + out.length), temp.length));
}
                stringa=temp;
               out = "%3Cbr%3E"; // replace this
              add = "<br>"; // with this
                temp = "" + stringa; // temporary holder

                  while (temp.indexOf(out)>-1) {
               pos= temp.indexOf(out);
                  temp = "" + (temp.substring(0, pos) + add + 
                   temp.substring((pos + out.length), temp.length));
}
                stringa=temp;

        remote=window.open ("","note","width=600,height=80,resizable=1,menubar=0,toolbar=0,scrollbars=0");
        remote.document.write("<html><body>");
        remote.document.write(stringa);
        remote.document.write("</body></html>");
        remote.document.close();
        remote.focus();
}
function DisplayTitolo(titolo)
{
document.LEZIONE.testo.value=titolo;
}


function time(){
  date=new Date();
  day=verify(date.getDate(),0,0);
  month=verify(date.getMonth(),0,1);
  year=verify(date.getYear(),1000,1900);

 if(month==1) month="gennaio";
 if(month==2) month="febbraio";
 if(month==3) month="marzo";
 if(month==4) month="aprile";
 if(month==5) month="maggio";
 if(month==6) month="giugno";
 if(month==7) month="luglio";
 if(month==8) month="agosto";
 if(month==9) month="settembre";
 if(month==10) month="ottobre";
 if(month==11) month="novembre";
 if(month==12) month="dicembre";
   
  document.write('<B>'+day+'</B> '+' '+month+'  '+year);
}

// Routine di correzione della data
function verify(obj,limit,delta){
  if(limit){
    if(obj<limit)
      obj+=delta;
  }
  else if(delta)
    obj+=delta;
  if((obj<10)&&(obj.toString().length==1))
    obj='0'+obj;
  return (obj);
}
