var popWindow_;

function popupImage(url)
{
 var height = screen.height;
 var width = screen.width;
 var leftpos = width / 2 - 50;
 var toppos = height / 2 - 50;

 window.open(url,'popupImage','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function OpenImg(aImage, w, h, nome) {
        if ((popWindow_ == null) || (popWindow_.closed)) {
              if (!h) h = 500;
              if (!w) w = 500;
              sh = (screen.availHeight/2)-(h/2);
              sw = (screen.availWidth/2)-(w/2);
              popWindow_ = window.open("", nome, "height=" + h + ",width=" + w + ",top=" + ((screen.availHeight/2)-(h/2)) + ",left=" + ((screen.availWidth/2)-(w/2)) +",alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,maximized=1,z-lock=0");
              popWindow_.document.write("<html><body style=\"background:#FFFFFF; margin:0px;\"><table width=100% height=100% style=\"background:#FFFFFF; margin:0px;\"><tr><td align=center valign=center><img src=\"images/" + aImage + "\"></td></tr></table></body></html>");
                popWindow_.focus();
        } else {
                popWindow_.location.href=aUrl;
                popWindow_.focus();
        }

}

function popUrl(aUrl, w, h, nome) {

        if ((popWindow_ == null) || (popWindow_.closed)) {
                popWindow_ = window.open(aUrl, nome, "height=" + h + ",width=" + w + ",top=" + ((screen.availHeight/2)-(h/2)) + ",left=" + ((screen.availWidth/2)-(w/2)) +",location=center,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,fullscreen=0");
                popWindow_.focus();
        } else {
                popWindow_.location.href=aUrl;
                popWindow_.focus();
        }

}

function popImage(aImage, w, h, nome) {
        if ((popWindow_ == null) || (popWindow_.closed)) {
                sh = (screen.availHeight/2)-(h/2);
              sw = (screen.availWidth/2)-(w/2);
              popWindow_ = window.open("", nome, "height=" + h + ",width=" + w + ",top=" + ((screen.availHeight/2)-(h/2)) + ",left=" + ((screen.availWidth/2)-(w/2)) +",alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=yes,status=0,titlebar=0,toolbar=0,z-lock=0");
              popWindow_.document.write("<html><body bgcolor:#FFFFFF; STYLE=\"margin:0px;\"><center><IMG SRC=\"" + aImage + "\"></center></body></html>");
                popWindow_.focus();
        } else {
                popWindow_.location.href=aUrl;
                popWindow_.focus();
        }

}

function popUrlNoResize(aUrl, w, h, nome) {

        if ((popWindow_ == null) || (popWindow_.closed)) {
                sh = (screen.availHeight/2)-(h/2);
              sw = (screen.availWidth/2)-(w/2);
              popWindow_ = window.open(aUrl, nome, "height=" + h + ",width=" + w + ",top=" + ((screen.availHeight/2)-(h/2)) + ",left=" + ((screen.availWidth/2)-(w/2)) +",alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,z-lock=0");
                popWindow_.focus();
        } else {
                popWindow_.location.href=aUrl;
                popWindow_.focus();
        }
}

function popUrlFull(aUrl, w, h, nome) {
if ((popWindow_ == null) || (popWindow_.closed)) {
        popWindow_ = window.open(aUrl, nome, "height=" + h + ",width=" + w + ",top=" + ((screen.availHeight/2)-(h/2)) + ",left=" + ((screen.availWidth/2)-(w/2)) +",menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes");
        popWindow_.focus();
} else {
        popWindow_.location.href=aUrl;
        popWindow_.focus();
}
}

function MakeWindow(PageUrl)
{
        myWindow = window.open(PageUrl,'promo','top=225,left=150,height=100,width=180,alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,z-lock=0');
        if (!myWindow.opener) myWindow.opener = main;
}

function addDate() {
   monthNames = new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre");
   myDate  = new Date();
   var year = myDate.getYear();
   if (year < 1000) year += 1900;
   document.write("<FONT SIZE='1'>" + myDate.getDate() +"  "+monthNames[myDate.getMonth()] + "  " +  year + "</FONT>");
}

function nl2br(text) {
 text = text.replace(/\r\n|\r|\n/g, '<br \/>');
 return text;
}

function getParamsByName() {
 // Definisco le variabili che mi servono
 var i = 0;
 var param = '';
 inputstr = new Array();
 params = new Array();

 // Reperisco il valore della stringa dei parametri dall'indirizzo
 query = '' + this.location;
 query = query.replace(/%20/gi, ' ');
 query = query.substring((query.indexOf('?')) + 1);

 // Creo un array con i valori nomeparametro = valoreparametro
 inputstr = query.split('&');

 // Creo il nuovo array in modo che sia params[nomeparametro]=valoreparametro
 while (i != inputstr.length)
 {
  param = inputstr[i];
  params[param.substring(0, param.indexOf('='))] = param.substring((param.indexOf('=')) + 1);
  i = i + 1;
 }
 return params;
}

function getParamsByNumber() {
 // Definisco le variabili che mi servono
 var i = 0;
 var param = '';
 inputstr = new Array();
 params = new Array();

 // Reperisco il valore della stringa dei parametri dall'indirizzo
 query = '' + this.location;
 query = query.replace(/%20/gi, ' ');
 query = query.substring((query.indexOf('?')) + 1);

 // Creo un array con i valori nomeparametro = valoreparametro
 inputstr = query.split('&');

 // Creo il nuovo array in modo che sia params[indiceelemento]=valoreparametro
 while (i != inputstr.length)
 {
  param = inputstr[i];
  params[i] = param.substring((param.indexOf('=')) + 1);
  i = i + 1;
 }
 return params;
}