//********************************************************************//
//*                            unico.js                              *//
//*     libreria javascript: stile, intestazione e piedipagina       *//
//*     revisione: 08/07/2005 - Francesca Grombone - CCE - USNP      *//
//********************************************************************//

var wem = new Array("francy@uniparthenope.it","centro.calcolo@uniparthenope.it","tina.pugliese@uniparthenope.it","smr@uniparthenope.it","enzo.destefano@uniparthenope.it","nucleo.valutazione@uniparthenope.it","affari.generali@uniparthenope.it","segreteria.studenti@uniparthenope.it","ufficio.legale@uniparthenope.it","direttore.amministrativo@uniparthenope.it","ufficio.economato@uniparthenope.it","ufficio.docenti@uniparthenope.it","ufficio.nondocenti@uniparthenope.it","ufficio.ragioneria@uniparthenope.it","ufficio.tecnico1@uniparthenope.it","ufficio.tecnico2@uniparthenope.it");

var agt=navigator.userAgent.toLowerCase();

function Giorno(intDay) {     
	var DayArray = new Array("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì","Sabato");
	return DayArray[intDay];
}

function Mese(intMonth) {
	var MonthArray = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre");
	return MonthArray[intMonth];
}

function Anno (t) {
	NS4=(document.layers) ? true : false;	
	IE4=(document.all) ? true : false;	
	ver4 = (NS4 || IE4) ? true : false;	
	if (ver4 || (parseInt(navigator.appVersion)>=5)) {   
		var YearStr = t.getFullYear();	
	} else {
		var YearStr = t.getYear();
	}
	return YearStr;
}

function ultimaModifica() {
	var d = new Date(document.lastModified);
	var ds = "15 Marzo 2010";
	document.write(ds);
}

var oggi = new Date();
var a = Anno(oggi);

function dataCorrente() {
	var os = Giorno(oggi.getDay()) + " " + oggi.getDate() + " " + Mese(oggi.getMonth()) + " " + a;
	document.write(os);
}

function intestazione() {
	document.write("<center><table border='0' cellspacing='0' cellpadding='0' width");
	document.write("='100%'><tr><td ALIGN='LEFT' VALIGN='BOTTOM' ROWSPAN='3' HEIGHT");
	document.write("='60'><img SRC='img/logo.gif' ALT");
	document.write("='Logo Ateneo' BORDER='0' height='60' width='60'></td><td ");
	document.write(" HEIGHT='11'></td></tr><tr><td ALIGN='RIGHT' VALIGN='CENTER' ");
	document.write("width='60%' height='16' bgcolor='#000099' nowrap><p class='whili'>");
	document.write(" | News | ");
	document.write("");
	document.write("Servizi on-line per gli studenti | ");
	document.write("Siti locali | </td></tr>");
	document.write("<tr><td ALIGN='RIGHT' VALIGN='CENTER'><img SRC='img/iun.gif' ALT");
	document.write("='Università degli Studi di Napoli Parthenope' BORDER='0' height");
	document.write("='30' width='400'><img SRC='img/euro.gif' ALT='Logo UE' BORDER='0' ");
	document.write("height='24' width='37'></td></tr><tr><td ALIGN='LEFT' VALIGN");
	document.write("='CENTER' COLSPAN='2' HEIGHT='16' BGCOLOR='#FCC258' nowrap><p ");
	document.write("class ='whili'> | ");
	document.write("WebMail | ");
	document.write("Fonia | ");
	document.write("Antivirus | ");
	document.write("Software Distribution | ");
	document.write("Rassegna Stampa | ");
	document.write("FTP | </td></tr>");
	document.write("</TABLE></center>");
}

function intestazione1() {
	document.write("<center><table border='0' cellspacing='0' cellpadding='0' width");
	document.write("='100%'><tr><td ALIGN='LEFT' VALIGN='BOTTOM' ROWSPAN='3' HEIGHT");
	document.write("='60'><img SRC='img/logo.gif' ALT");
	document.write("='Logo Ateneo' BORDER='0' height='60' width='60'></td><td ");
	document.write(" HEIGHT='11'></td></tr><tr><td ALIGN='RIGHT' VALIGN='CENTER' ");
	document.write("width='60%' height='16' bgcolor='#000099' nowrap><p class='whili'>");
	document.write(" | News | ");
	document.write("");
	document.write("Servizi on-line per gli studenti | ");
	document.write("Siti locali | </td></tr>");
	document.write("<tr><td ALIGN='RIGHT' VALIGN='CENTER'><img SRC='img/iun.gif' ALT");
	document.write("='Università degli Studi di Napoli Parthenope' BORDER='0' height");
	document.write("='30' width='400'><img SRC='img/euro.gif' ALT='Logo UE' BORDER='0' ");
	document.write("height='24' width='37'></td></tr><tr><td ALIGN='LEFT' VALIGN");
	document.write("='CENTER' COLSPAN='2' HEIGHT='16' BGCOLOR='#FCC258' nowrap><p ");
	document.write("class ='whili'> | ");
	document.write("WebMail | ");
	document.write("Fonia | ");
	document.write("Antivirus | ");
	document.write("Software Distribution | ");
	document.write("Rassegna Stampa | ");
	document.write("FTP | </td></tr>");
	document.write("</TABLE></center>");
}

function intestazione2() {
	document.write("<center><table border='0' cellspacing='0' cellpadding='0' width");
	document.write("='100%'><tr><td ALIGN='LEFT' VALIGN='BOTTOM' ROWSPAN='3' HEIGHT");
	document.write("='60'><img SRC='img/logo.gif' ALT");
	document.write("='Logo Ateneo' BORDER='0' height='60' width='60'></td><td ");
	document.write(" HEIGHT='11'></td></tr><tr><td ALIGN='RIGHT' VALIGN='CENTER' ");
	document.write("width='60%' height='16' bgcolor='#000099' nowrap><p class='whili'>");
	document.write(" | News | ");
	document.write("");
	document.write("Servizi on-line per gli studenti | ");
	document.write("Siti locali | </td></tr>");
	document.write("<tr><td ALIGN='RIGHT' VALIGN='CENTER'><img SRC='img/iun.gif' ALT");
	document.write("='Università degli Studi di Napoli Parthenope' BORDER='0' height");
	document.write("='30' width='400'><img SRC='img/euro.gif' ALT='Logo UE' BORDER='0' ");
	document.write("height='24' width='37'></td></tr><tr><td ALIGN='LEFT' VALIGN");
	document.write("='CENTER' COLSPAN='2' HEIGHT='16' BGCOLOR='#FCC258' nowrap><p ");
	document.write("class ='whili'> | ");
	document.write("WebMail | ");
	document.write("Fonia | ");
	document.write("Antivirus | ");
	document.write("Software Distribution | ");
	document.write("Rassegna Stampa | ");
	document.write("FTP | </td></tr>");
	document.write("</TABLE></center>");
}

function intestazione3() {
	document.write("<center><table border='0' cellspacing='0' cellpadding='0' width");
	document.write("='100%'><tr><td ALIGN='LEFT' VALIGN='BOTTOM' ROWSPAN='3' HEIGHT");
	document.write("='60'><img SRC='img/logo.gif' ALT");
	document.write("='Logo Ateneo' BORDER='0' height='60' width='60'></td><td ");
	document.write(" HEIGHT='11'></td></tr><tr><td ALIGN='RIGHT' VALIGN='CENTER' ");
	document.write("width='60%' height='16' bgcolor='#000099' nowrap><p class='whili'>");
	document.write(" | News | ");
	document.write("");
	document.write("Servizi on-line per gli studenti | ");
	document.write("Siti locali | </td></tr>");
	document.write("<tr><td ALIGN='RIGHT' VALIGN='CENTER'><img SRC='img/iun.gif' ALT");
	document.write("='Università degli Studi di Napoli Parthenope' BORDER='0' height");
	document.write("='30' width='400'><img SRC='img/euro.gif' ALT='Logo UE' BORDER='0' ");
	document.write("height='24' width='37'></td></tr><tr><td ALIGN='LEFT' VALIGN");
	document.write("='CENTER' COLSPAN='2' HEIGHT='16' BGCOLOR='#FCC258' nowrap><p ");
	document.write("class ='whili'> | ");
	document.write("WebMail | ");
	document.write("Fonia | ");
	document.write("Antivirus | ");
	document.write("Software Distribution | ");
	document.write("Rassegna Stampa | ");
	document.write("FTP | </td></tr>");
	document.write("</TABLE></center>");
}

function piedipagina() {
	document.write("<center><table width='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0>");
	document.write("<tr><td height='10'></td></tr><tr><td align=center bgcolor=");
	document.write("'#000099' nowrap><p class='whili'> Sede Centrale: Via Amm. F. ");
	document.write("Acton, 38 - 80133 Napoli - Tel.: 081 5475111 - Fax: 081 5521485");
	document.write(" </p></td></tr><tr><td align=center><p class='pic'>Ultima ");
	document.write("revisione: <i><script TYPE='text/javascript'>ultimaModifica()");
	document.write("</script></i> - &copy; 1996-" + a + " CCE");
	document.write(" - <a href='mailto:centro.calcolo@uniparthenope.it'>");
	document.write("Webmaster</a></p></td></tr></TABLE></center>");
}

function piedipagina1(indwem) {
	var posta = wem[indwem];
	document.write("<center><table width='100%' BORDER=0 CELLSPACING=0 CELLPADDING");
	document.write("=0><tr><td height='10'></td></tr><tr><td align=center bgcolor=");
	document.write("'#000099' nowrap><p class='whili'> Sede Centrale: Via Amm. F. ");
	document.write("Acton, 38 - 80133 Napoli - Tel.: 081 5475111 - Fax: 081 5521485");
	document.write(" </p></td></tr><tr><td align=center><p class='pic'>Ultima ");
	document.write("revisione: <i><script TYPE='text/javascript'>ultimaModifica()");
	document.write("</script></i> - <a href='mailto:" + posta +"'>Webeditor</a> -");
	document.write(" &copy; 1996-" + a + " CCE - <a href");
	document.write("='mailto:centro.calcolo@uniparthenope.it'>Webmaster</a></p>");
	document.write("</td></tr></TABLE></center>");
}

/**
 * Constructs a Dialog object 
 *
 * author: gary smith 
 */

function Dialog() {
    this.dialogTitle = "Dialog";
    this.dialogContent = "";
    this.dialogSRC = "URL";
    this.dialogPageX = (250 + self.pageXOffset) || 100;
    this.dialogPageY = (80 + self.pageYOffset) || 100;
    this.dialogWidth = null;
    this.dialogHeight = null;
    this.dialogMorph = false;
    this.dialogBgColor = "#FFEED2"; //C1CDCD
    this.dialogMainBgColor = "#FFEED2";  //cool colors: D2B48C 9AC0CD 5F9EA0 B4CDCD A2B5CD 9FB6CD D2B48C 6CA6CD 66CDAA 458B74
    this.dialogButtonBgColor = "#CDB79E"; //9FB6CD CDC9A5 CDCDC1 CDC0B0 D2B48C BDB76B CDB79E CDB7B5
    this.dialogButtonHiliteBgColor = "#999999";
    this.dialogTitleBgColor = "#000099";
    this.dialogButtons = new Array();
    this.dialogButtonsCentered = new Array();
    this.dialogButtonsCenteredWidth = 0;

    //methods
    this.openDialog = openDialog;
    this.exampleDialog = exampleDialog;
    this.setDialogContent = setDialogContent; 
    this.setDialogTitle = setDialogTitle;
    this.setDialogPageX = setDialogPageX;
    this.setDialogPageY = setDialogPageY;
    this.setDialogWidth = setDialogWidth;
    this.setDialogHeight = setDialogHeight;
    this.setDialogBgColor = setDialogBgColor;
    this.setDialogMainBgColor = setDialogMainBgColor;
    this.setDialogButtonBgColor = setDialogButtonBgColor;
    this.setDialogTitleBgColor = setDialogTitleBgColor;
    this.setDialogMorph = setDialogMorph;

    //button methods
    this.dialogButton = dialogButton;
    this.setDialogBase = setDialogBase;
    this.setDialogButton = setDialogButton;
    this.setTitleBarButton = setTitleBarButton;
    this.addDialogButton = addDialogButton;
    this.onDialogButton = onDialogButton;
    this.dialogButtonMouseOver = dialogButtonMouseOver;
    this.dialogButtonMouseOut = dialogButtonMouseOut;
    this.dialogTitleMouseOver = dialogTitleMouseOver;
    this.dialogTitleMouseOut = dialogTitleMouseOut;

    this.cDrag = cDrag;
    this.cDragStart = cDragStart;
    this.cDragEnd = cDragEnd;
    this.cDragSet = cDragSet;
    this.dialogWinMorph = dialogWinMorph;
    this.nsDialogObject = nsDialogObject;
    this.nsDialogObject();
}

function openDialog(label, arbitrary) {
    if(window.NdialogLabel == label) return;
    window.NdialogLabel = label;
    
    if(window.Ndialog) {
        this.win = window.Ndialog;
        if(this.win.base.visibility == 'hide') {
           //java.lang.System.out.println("activeD");
           this.win.title.document.open('text/html');
           this.win.title.document.writeln('<BODY><NOBR><FONT COLOR="#FFFFFF"><B><SPAN ID=font14>&nbsp; '+ this.dialogTitle +'</SPAN></B></FONT></BODY>');
           this.win.title.document.close();
           this.win.doc.visibility = "hide";
           this.win.doc = null;
        } else {
           this.setDialogBase(label);
        }
    } else {
        this.setDialogBase(label);
    }

    var temp = makeLayer(label, this.dialogContent, this.win.base, 0,0, 4,4, "", "hide");
    if(temp.clip.width < 100) 
        temp.clip.width = 100;
    this.boxW = 100;
    if(this.dialogWidth == null) 
        this.boxW = temp.clip.width;
    else this.boxW  = this.dialogWidth -10;
    this.win.main.document.open('text/html');
    this.win.main.document.writeln("&nbsp;");
    this.win.main.document.close();
    this.win.doc  = makeLayer('ddoc', this.dialogContent, this.win.base, this.boxW,0, 4,25, this.dialogBgColor);
    if(this.win.doc.clip.width > this.boxW) 
        this.boxW = this.win.doc.clip.width +5;
    this.boxW += 10;
    this.boxH = 100;
    if(this.dialogHeight == null) 
        this.boxH = this.win.title.clip.height + this.win.doc.clip.height;
    else this.boxH = this.dialogHeight;
    //this.win.doc.clip.height = this.boxH;
    if(this.dialogButtons.length > 0)
        this.boxH += 40;
    this.boxW += 10;
    this.boxH += 10;
    this.dialogWidth = this.boxW;
    this.dialogHeight = this.boxH;
    this.win.doc.clip.width    = this.boxW -4;
    this.win.base.clip.width   = this.boxW +4;
    this.win.base.clip.height  = this.boxH +4;
    this.win.edge.clip.width   = this.boxW +4;
    this.win.edge.clip.height  = this.boxH +4;
    this.win.base.visibility   = 'inherit';
    this.win.dark.clip.width   = this.boxW +2;
    this.win.dark.clip.height  = this.boxH +2;
    this.win.lite.clip.width   = this.boxW +1;
    this.win.lite.clip.height  = this.boxH +1;
    this.win.main.clip.width   = this.boxW;
    this.win.main.clip.height  = this.boxH;
    this.win.title.clip.width  = this.boxW -4;
    this.win.title.clip.height = 20;
    this.win.title.saveBgColor = this.dialogTitleBgColor;
    this.win.titleBarButton.left = this.win.title.clip.width -15;
    this.win.title.cDragSet = this.cDragSet;
    this.win.title.cDragLayer  = this.win.base;
    this.win.title.onMouseOver = this.dialogTitleMouseOver;
    this.win.title.onMouseOut  = this.dialogTitleMouseOut;
    this.win.base.that = this;
    this.win.base.moveTo(this.dialogPageX,this.dialogPageY);

    if(this.dialogButtons.length > 0) {
       //this.win.button.visibility = "hide";
       this.win.button.dialogButtons = new Array();
       for(var i=0; i<this.dialogButtons.length; i++) {
           var b = this.dialogButtons[i];
           this.win.button.dialogButtons[i] = this.setDialogButton(b.label, b.value, this.win.main, null, null, b.x, b.y, this.win, b.onDialogButton);
       }
       var centeredBase = (this.boxW - this.dialogButtonsCenteredWidth) /2;
       for(var i=0; i<this.dialogButtonsCentered.length; i++) {
           if(this.dialogButtonsCentered[i -1]) 
               centeredBase += this.dialogButtonsCentered[i -1].clip.width +1;
           this.dialogButtonsCentered[i].left = centeredBase;
       }
       for(var i=0; i<this.dialogButtons.length; i++) {
           this.win.button.dialogButtons[i].visibility = "inherit";
       }
    }
    //if(this.dialogButtons.length <= 0) {
        //this.boxH = this.win.title.clip.height + this.win.doc.clip.height +5;
    //} else {
        //this.boxH = this.win.title.clip.height + this.win.doc.clip.height + this.win.buttonsHeight +5;
        //Ndialog.button.left = (this.boxW - Ndialog.button.clip.width) /2;
        //Ndialog.button.top  = this.boxH - Ndialog.button.clip.height -5;
        //Ndialog.button.visibility = "inherit";
    //}
    window.captureEvents(Event.RESIZE);
    window.onresize=resetDialog;
    eval( arbitrary );
    if(this.dialogSRC != "URL") 
        this.win.doc.src = this.dialogSRC;
}

function setDialogBase(label) {
       //java.lang.System.out.println("no activeD");
       this.win = new Object();
       this.win.base = new Layer(100);
       this.win.base.bgColor = '#000000';
       this.win.base = makeLayer(label, "", null, 0,0, -1,-1, '#000000');
       this.win.edge = makeLayer(label, "", this.win.base, 0,0, -1,-1, '#DDDDDD');
       this.win.dark = makeLayer(label, "", this.win.base, 0,0, 1,1, '#888888');
       this.win.lite = makeLayer(label, "", this.win.base, 0,0, 1,1, '#FFFFFF');
       this.win.main = makeLayer(label, "", this.win.base, 0,0, 2,2, this.dialogMainBgColor);
       this.win.title  = makeLayer('title', '<BODY><NOBR><FONT COLOR="#FFFFFF"><B><SPAN ID=font14>&nbsp; '+ this.dialogTitle +'</SPAN></B></FONT></BODY>', this.win.base, 0,0, 4,4, this.dialogTitleBgColor);
       this.win.titleBarButton = this.setTitleBarButton('titleX', "", this.win.base, null,null, 177, null, this.win);
       this.win.button = new Layer();
       window.Ndialog = this.win;
}

function addDialogButton(label, value, x, y, onDialogButton) {
    newDialogButton = new this.dialogButton(label, value, x, y, onDialogButton);
    this.dialogButtons[this.dialogButtons.length++] = newDialogButton;
}

function dialogButton(label, value, x, y, onDialogButton) {
    this.label = label;
    this.value = value;
    this.x = x;
    this.y = y;
    this.onDialogButton = onDialogButton;
}

function setDialogButton(label, value, parentLyr, width, height, x, y, dialogObj, onDialogButton) {
    if(typeof(x) != 'number') 
        var trueX = x; x = 0;
    if(typeof(y) != 'number')
        y = 0;
    value = '&nbsp;'+ value +'&nbsp;';
    var button = makeLayer(label, value, parentLyr, 0,0, x,y, '#000000', "hide");
    //this.boxH = dialogObj.title.clip.height + dialogObj.doc.clip.height + button.clip.height +10;
    button.clip.width += 4;
    button.clip.height += 4;
    button.lite  = makeLayer(label, "", button, button.clip.width -1, button.clip.height -1, 0,0, '#FFFFFF');
    button.dark  = makeLayer(label, "", button, button.clip.width -2, button.clip.height -2, 1,1, '#666666');
    button.shade = makeLayer(label, "", button, button.clip.width -3, button.clip.height -3, 1,1, '#CCCCCC');
    button.value = makeLayer(label, value, button, button.clip.width -4, button.clip.height -4, 2,2, this.dialogButtonBgColor);
    button.value.saveBgColor = this.dialogButtonBgColor;
    button.value.saveHiliteBgColor = this.dialogButtonHiliteBgColor;
    button.value.win = dialogObj;
    button.value.dialogButtons = this.dialogButtons;
    button.value.label = label;
    button.value.onDialogButton = onDialogButton;
    button.value.onFocus = this.onDialogButton;
    button.value.onMouseOver =  this.dialogButtonMouseOver;
    button.value.onMouseOut  =  this.dialogButtonMouseOut;
    button.top = dialogObj.title.clip.height + dialogObj.doc.clip.height +5;
    if(trueX == 'center' && this.dialogButtons) {
         this.dialogButtonsCentered[this.dialogButtonsCentered.length++] = button;
         this.dialogButtonsCenteredWidth += button.clip.width;
    }
    if(trueX == 'right') 
        button.left = this.boxW - (button.clip.width +5);
    button.top += 7;
    dialogObj.buttonsHeight = button.clip.height +12;
    return button;
}

function setTitleBarButton(label, value, parentLyr, width, height, x, y, dialogObj, onDialogButton) {
    if(typeof(x) != 'number') 
        var trueX = x; x = 0; 
    if(typeof(y) != 'number') 
        y = 0;
    var button = makeLayer(label, value, parentLyr, 0,0, x,y, '#000000');
    button.clip.width = 16;
    button.clip.height = 14;        
    button.lite  = makeLayer(label, "", button, button.clip.width -1, button.clip.height -1, 0,0, '#FFFFFF');
    button.dark  = makeLayer(label, "", button, button.clip.width -2, button.clip.height -2, 1,1, '#666666');
    button.shade = makeLayer(label, "", button, button.clip.width -3, button.clip.height -3, 1,1, '#CCCCCC');
    button.value = makeLayer(label, value, button, button.clip.width -4, button.clip.height -4, 2,2, this.dialogMainBgColor);
    button.value.saveBgColor = this.dialogMainBgColor;
    button.value.win = dialogObj;
    button.value.label = button;
    button.value.onDialogButton = onDialogButton;
    button.value.onFocus = this.onDialogButton;
    button.value.onMouseOver =  this.dialogButtonMouseOver;
    button.value.onMouseOut  =  this.dialogButtonMouseOut;
     button.value.top -= 5;
     button.value.clip.top += 5;        
     button.value.clip.height += 5;        
     button.value.left += 3;        
     button.value.clip.left -= 3;        
     button.value.clip.width -= 3;        
    button.top = 7;
    return button;
}

function onDialogButton(e) {
    this.bgColor='#888888';
    this.dialog = this.win.doc;
    this.win.base.visibility = 'hide';
    eval( this.onDialogButton );
    //this.win = null;
    window.NdialogLabel = null;
}

function dialogButtonMouseOver(e) {
    this.bgColor = this.saveHiliteBgColor || "#999999";
}

function dialogButtonMouseOut(e) {
    this.bgColor = this.saveBgColor;
}

function dialogTitleMouseOver(e) {
    this.cDragSet(this);
    this.bgColor = '#0000CD';
}

function dialogTitleMouseOut(e) {
    this.bgColor = this.saveBgColor;
}

function setDialogContent(str) { 
    this.dialogContent = str; 
}

function setDialogTitle(str) { 
    this.dialogTitle = str; 
}

function setDialogPageX(i) {
    this.dialogPageX = i; 
}

function setDialogPageY(i) {
    this.dialogPageY = i; 
}

function setDialogWidth(i) {
    this.dialogWidth = i; 
}

function setDialogHeight(i) {
    this.dialogHeight = i; 
}

function setDialogBgColor(str) {
    this.dialogBgColor = str; 
}

function setDialogMainBgColor(str) {
    this.dialogMainBgColor = str; 
}

function setDialogButtonBgColor(str) {
    this.dialogButtonBgColor = str; 
}

function setDialogButtonHiliteBgColor(str) {
    this.dialogButtonHiliteBgColor = str; 
}

function setDialogTitleBgColor(str) {
    this.dialogTitleBgColor = str; 
}

function setDialogMorph(boo) {
    this.dialogMorph = boo; 
}

function cDragSet(l) {
    d = this;
    d.cDragLayer = l.cDragLayer || l.parentLayer || l;
    d.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN|Event.MOUSEDRAG);
    d.onmousedown=cDragStart;
    d.onmouseup=cDragEnd;
}

function cDrag(e) {
    var x = window.innerWidth;
    var y = window.innerHeight;
    if(e.pageX > -5 && e.pageY > -5 && e.pageX < x && e.pageY < y) {
        d.cDragLayer.moveBy(e.pageX-d.offX,e.pageY-d.offY);
    } else {
        if(d.cDragLayer.that.dialogMorph) { 
            cDragEnd(e);
            dialogWinMorph(e, this);
        }
    }
    d.offX = e.pageX;
    d.offY = e.pageY;
    d.dragged = true;
}

function dialogWinMorph(e, l) {
    //java.lang.System.out.println("value=" + l.that.dialogContent);
    //java.lang.System.out.println("l.pageX=" + l.pageX);
    if(!l.that) return;
    if(!window.dialogWinMorphs) 
        window.dialogWinMorphs = new Array();
    java.lang.System.out.println("len=" + window.dialogWinMorphs.length);
    l.that.win.base.visibility = "hide";
    //if(!l.that.dialogMorphWin) l.that.dialogMorphWin = {};
    //if(!l.that.dialogMorphWin.close) {
        var width = l.that.dialogWidth +20;
        var height = l.that.dialogHeight +20;
        var y = l.pageY + window.screenY + window.outerHeight - window.innerHeight -20;
        if(l.pageX > 0) 
            var x = window.screenX + window.outerWidth;
        else
            var x = window.screenX - 100;
        var id = window.dialogWinMorphs.length;
        var win = window.open("",'win' + id,'outerWidth='+ width +',outerHeight='+ height +',left='+ x +',top='+ y);
        win.document.open("text/html");
        win.document.writeln('<BODY BGCOLOR="'+ l.that.dialogBgColor +'">');
        win.document.writeln('<TITLE>'+ l.that.dialogTitle +'</TITLE>');
        win.document.writeln(l.that.dialogContent +'</BODY>');
        win.document.close();
        NdialogLabel = null;
        if(window.dev) 
            win.dev = window.dev;
        win.focus();
        window.dialogWinMorphs[l.that.dialogTitle] = win;
        window.dialogWinMorphs[id] = win;
    //}
}

function cDragStart(e) {
    //java.lang.System.out.println("this=" + this);
    d.cDragLayer.captureEvents(Event.MOUSEMOVE);
    d.cDragLayer.onmousemove=cDrag; 
    d.offX=e.pageX;
    d.offY=e.pageY;
}

function cDragEnd(e) {
    d.cDragLayer.onmousemove=0;
    if(d.dragged == true) {
        if(d.refresh) {
            d.cDragLayer.visibility="hide"; 
            setTimeout('if(d.cDragLayer) d.cDragLayer.visibility="inherit";',1);
        }
        d.cDragLayer.releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.MOUSEMOVE|Event.MOUSEDRAG);
        d.dragged = false;
        if(e.pageY < 0) 
            d.cDragLayer.top = -5;
        //if(e.pageX > window.width) d.cDragLayer.top = window.width -20;
    }
}

function nsDialogObject() {
    if(!window.nsDialogObjects) {
        window.nsDialogObjects = new Array();
        window.nsDialogObjects[0] = this;
    } else {
        window.nsDialogObjects[window.nsDialogObjects.length++] = this;
    }
}

function resetDialog(e) {
    for(var i=0; i < window.nsDialogObjects.length; i++) {
        if(window.nsDialogObjects[i].win) 
            window.nsDialogObjects[i].openDialog();
    }
}

function exampleDialog(str) {
    var dialog = new Dialog();
    var value = (str || '<CENTER><BR>Enter a local <B>filename</B>: <FORM><INPUT TYPE=FILE NAME="fileName" VALUE="" SIZE=40>&nbsp;&nbsp; </FORM></CENTER>');
    dialog.setDialogContent(value);
    dialog.setDialogTitle('Dialog');
    dialog.setDialogBgColor("#DDDDDD");
    //dialog.setDialogWidth(600);
    //dialog.setDialogHeight(150);
    //dialog.setDialogPageX(200);
    //dialog.setDialogPageY(250);
    //dialog.dialogSRC = "../../";
    dialog.addDialogButton("OKlabel", "&nbsp;&nbsp;&nbsp;OK&nbsp;&nbsp;&nbsp;", "center", 3, "alert('You entered filename: ' + this.dialog.document.forms[0].fileName.value)");
    dialog.addDialogButton("CancelLabel", "Cancel", "center", 3, "");
    //dialog.addDialogButton("AnotherLabel", "Another", "right", 3, "");
    dialog.openDialog('exampleLabel');
}

function makeLayer(label, value, parentLyr, width, height, x, y, color, viso) {
    //java.lang.System.out.println(""+ parentLyr);
    if(!value) 
        value = "&nbsp;";
    if(parentLyr) 
        var l = new Layer(width, parentLyr);
    else var l = new Layer(width);
    l.document.ids.font14.fontSize = 14;
    l.document.ids.sysFont.fontSize = 12;
    l.document.ids.sysFont.fontFamily = "Arial, Espy, sans-serif";
    l.document.open("text/html");
    l.document.writeln(value);
    l.document.close();
    l.label = label;
    l.moveTo(x,y);
    if(color != "") 
        l.bgColor = color;
    if(width) 
        l.clip.width = width;
    if(height) 
        l.clip.height = height;
    if(!viso) 
        l.visibility = "inherit";
    return l;
}

function linksDialog() {
   if (document.layers) {
	str = '<CENTER><P><br><B>Formati disponibili:</B><br><br>'+
          '<TABLE WIDTH=200>'+
          '<TR><TD> &nbsp; <A HREF="http://www.uninav.it/ateneo/servizi/elen_tel.pdf" target="content">PDF (3,5 Mb)</A></TD></TR>'+
          '<TR><TD> &nbsp; <A HREF="http://192.167.9.15/ASPSamp/Samples/Ricerca/form.htm">Rubrica on-line</A></TD></TR>'+
          '</TABLE></FONT></P></CENTER>';
	var dialog = new Dialog();
	dialog.setDialogContent(str);
	dialog.setDialogTitle("Rubrica Telefonica Interna");
	dialog.setDialogMorph(true);  //drag 
	dialog.openDialog("links");
   }  else {
        fine=window.open('','Rubrica','toolbar=no,menubar=no,location=no,height=250,width=400');
	with (fine.document) {
	    open();
	    write("<html><head><title>Rubrica Telefonica Interna</title></head>");
	    write("<body background='http://www.uniparthenope.it/img/fondo.gif'><center><p><br>");
	    write("<font size=5 color='#000099'><b>Rubrica Telefonica Interna</b></font><p>");
	    write("<br><B>Formati disponibili:</B><p><A HREF='http://www.uniparthenope.it/ateneo/servizi/elen_tel.pdf' target='content'>PDF (3,5 Mb)</A><p>");
	    write("<A HREF='http://192.167.9.15/ASPSamp/Samples/Ricerca/form.htm' target='content'>Rubrica on-line</A></center></body></html>");
	}
   }
}

