var mywindow=null;
if (mywindow)
{
	mywindow.close();
}
function popupopen(pagina,titolo,l,h,scroll,pos,ext,name,menusi) {
	prep = site_domain + external_path + script_name + "/";
	post = ".html";
	menu = "no";
	win_name = "mywindow";
	if(ext != null) {
		if(ext == true) {
			prep = "";
			post = "";
		}
	}
	if(name != null) {
		win_name = name;
	}
	if(menusi != null) {
		if(menusi == true) {
			menu = "yes";
		}
	}
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-l)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-l)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	if(pos=="right"){LeftPosition=screen.width-l-20;TopPosition=20;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+l+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar='+menu+',toolbar=no,resizable=no';
	eval(win_name+"=window.open('http://' + prep + pagina + post,titolo,settings)");
}



function JumpMenu(targ,screen,selObj,restore,ext){
  if (selObj.options[selObj.selectedIndex].value != 0) {
	prep = site_domain + external_path + script_name + "/";
	post = ".html";
	if(ext != null) {
		if(ext == true) {
			prep = "";
			post = "";
		}
	}
    if ((screen != "") && (ext == null)) { screen += "/"; }
    eval(targ+".location='http://"+prep+screen+selObj.options[selObj.selectedIndex].value+post+"'");
    if (restore) selObj.selectedIndex=0;
  }
}

function clear_field(inputname, formname) {
	eval('document.'+formname+'.'+inputname+'.value=""');
}

function setMaxLength(obj, length) {
	if(obj.value.length > length) {
		obj.value = obj.value.substr(0, length);
	}
}

function stopMaxLength(obj, length, text) {
	if(obj.value.length > length) {
		alert("Attenzione la lunghezza del testo del campo " + text + "  e' superiore al limite consentito,\nil testo verra' ridotto a " + length + " caratteri.\n\nBe careful! The length of " + text + " text area exceeds the maximum extent,\ntext will be cut down at " + length + " characters. ");
		setMaxLength(obj, length);	
		eval('document.' + obj.form.name + '.' + obj.name + '.select();');	
		eval('document.' + obj.form.name + '.' + obj.name + '.focus();');
		return false;
	}
	return true;
}


function HideContent(d) {
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	document.getElementById(d).style.display = "block";
}
function ReverseDisplay(d) {
	if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
	else { document.getElementById(d).style.display = "none"; }
}