var left = Math.ceil((screen.width-550) / 2);
var top = Math.ceil((screen.height-500) / 2);
var lefts = Math.ceil((screen.width-350) / 2);
var tops = Math.ceil((screen.height-250) / 2);

function popup550(str, popname)  {
        if (popname == "") {
			PopItUp =  window.open(str, 'popitup',"scrollbars=yes,resizable=no,width=550,height=480,status=yes,location=no,toolbar=no,top="+top+",left="+left);
		} else {
			PopItUp =  window.open(str, popname,"scrollbars=yes,resizable=no,width=550,height=480,status=yes,location=no,toolbar=no,top="+top+",left="+left);
		}
		PopItUp.focus();
}

function popupsml(str) {
        PopItUp =  window.open(str,'popitup','scrollbars=yes,resizable=yes,width=350,height=250,status=no,location=no,toolbar=no');
}

function popupuol(str) {
        PopItUp =  window.open(str,'popitup','scrollbars=yes,resizable=yes,width=300,height=550,status=no,location=no,toolbar=no');
}

function popupchat() {
		str = 'http://irc.virgilio.it/chat.php?channel=%23etz';
		var chatleft = Math.ceil((screen.width-780) / 2);
		var chattop = Math.ceil((screen.height-530) / 2);
        PopItUp =  window.open(str,'popitup',"scrollbars=no,resizable=yes,width=780,height=530,status=no,location=no,toolbar=no,top=" + chattop + ",left="+chatleft);
}

function popupagain(str) {
        PopItUp =  window.open(str,'popagain',"scrollbars=yes,resizable=yes,width=350,height=250,status=no,location=no,toolbar=no,top="+tops+",left="+lefts);
}
function popupsmlagenzie(str) {
        PopItUp =  window.open(str,'popitup','scrollbars=no,resizable=no,width=350,height=200,status=no,location=no,toolbar=no, top="+tops+",left="+lefts"');
}

function popupagenzie(str) {
        PopItUp =  window.open(str,'popagain',"scrollbars=yes,resizable=yes,width=550,height=350,status=no,location=no,toolbar=no,top="+tops+",left="+lefts);
}

function popupcns(str) {
        popcns =  window.open(str,'popcns','scrollbars=yes,resizable=no,width=350,height=500,status=no,location=no,toolbar=no');
}

function post(str){
PopItUp =  window.open('', 'popitup',"scrollbars=yes,resizable=no,width=550,height=400,status=no,location=no,toolbar=no,top="+top+",left="+left);
PopItUp.focus();
PopItUp.document.location.replace(str + "?text=" + document.formcomm.text.value + "&itemid=" + document.formcomm.itemid.value + "&father=" + document.formcomm.father.value);
}

function kk() {
window.opener.location.reload()
window.opener.focus();
window.close();
}
function kkconsole() {
window.opener.location.href=('http://www.estesia.com/pubblicazione/');
window.close()
}
function kkurl(url) {
window.opener.location.href( url );
window.close()
}

function inputok(x) { 
if (x.value=='') { x.value=initialValues[x.id];} else if (x.value != initialValues[x.id]) { x.style.fontWeight = "bold"; }}

function controllo()    //funzione per il controllo dei dati inseriti nella sezione pubblicazione

        {
				var controllo_stat=false;
				var campivuoti = 0;
                if (document.pubblicazione.title.value == "" )
                        {
                                controllo_stat=true;
                                campivuoti = campivuoti + 1;
				campo = "titolo"; 
                        }
               if (document.pubblicazione.text.value == "" )
               	{
                        controllo_stat=true;
                        if (campivuoti == 1) {
						campo = campo + " e testo";
						campivuoti = campivuoti + 1; 
						}
						else { campo = "testo"; campivuoti = campivuoti + 1; } }     
				if (campivuoti == 1) {
				alert("Il campo " + campo + " va compilato!"); 		 }
				else {
				alert ("I campi " + campo + " vanno compilati!"); }
				
                if (controllo_stat)
                 {return false}
                else {return true}

                }
				

var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
