

	function apriform(){
		window.open('index.php?action=index1b','login', "status=NO,toolbar=NO,directories=no,menubar=no,width=250,height=250,resizable=yes,scrollbars=no,top=200,left=250");
	}

	function apri1(){
		window.open('index.php?action=index1b','login', 'toolbar=no,directories=no,menubar=no,width=580,height=350,resizable=yes,scrollbars=no');
	}

	function apri(){
		window.open('index.php?action=index1b','login', "status=NO,toolbar=NO,directories=no,menubar=no,width=250,height=250,resizable=yes,scrollbars=no,top=200,left=250");
	}

	function windowOpen() {
    	var myWindow=window.open('index.php?action=index1b','toolbar=no,directories=no,menubar=no,width=250,height=250,resizable=yes,scrollbars=no,top=200,left=250');
    	if (!myWindow.opener) 
				myWindow.opener = self;
	}

	function apri_classe(){
		window.open('index.php?action=logclas','login', "status=NO,toolbar=NO,directories=no,menubar=no,width=250,height=250,resizable=yes,scrollbars=no,top=200,left=250");
	}


	function show(id) {
		ns4 = (document.layers)? true:false
		ie4 = (document.all)? true:false
        if (ns4) 
				document.layers[id].visibility = "show"
	        else 
				if (ie4) 
					document.all[id].style.visibility = "visible"
	}

	function hide(id) {
        if (ns4) 
				document.layers[id].visibility = "hide"
	        else 
				if (ie4) 
					document.all[id].style.visibility = "hidden"
	}



	function nick(){
		var cf_length=document.Logon.nickname.value.length;
		var cf_length1=document.Logon.password.value.length;
		if (cf_length < 1) {
			alert("Per antrare è necessario specificare nickname");
	        document.Logon.nickname.focus(); 
	        return true; 
		}
		if (cf_length1 < 1){
			alert("Per antrare è necessario specificare  password!");
	        document.Logon.password.focus(); 
	        return true; 
		}
	}
	
	function remember(url){
		window.opener.location=url;
		window.close();
	}


	function updateOpener() {
	    window.opener.document.form1.nickname.value = document.Logon.nickname.value;
	    window.opener.document.form1.password.value = document.Logon.password.value;
	    window.opener.document.form1.submit();
		window.close();
	} 
	

	function cod_fiscale(){
		var cf_length=document.attivazione.cod_fisc.value.length;
		if (cf_length != 16){
			alert("Il codice fiscale è inesatto\nDeve essere composto da 16 caratteri!");
	        document.attivazione.cod_fisc.focus(); 
	        return true; 
		}
		document.attivazione.submit() 
	} 

	function controlla(){
		var lunghezza=document.mod_pass.password_new.value.length;
		if (lunghezza==0){
			alert("La password vuota non è valida!");
			document.mod_pass.password_new.focus(); 
	        document.mod_pass.password_new.select(); 
	        return true; 
		}
	
		var cf_length=document.mod_pass.password_new.value;
		var cf_length1=document.mod_pass.password_new2.value;
		if (cf_length != cf_length1){
			alert("Hai scritto due password diverse!");
	        document.mod_pass.password_new.focus(); 
	        document.mod_pass.password_new.select(); 
	        return true; 
		}
	
		      document.mod_pass.submit() 
	 } 


function apri_admin(){
	window.open('admin/index.php?action=tutor&tutor=gen','login', "toolbar=no,directories=no,menubar=no,width=700,height=500,resizable=yes,scrollbars=yes,top=20,left=40");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
	
	
	function win_resize(what,id,way){
		var screen_width=window.screen.width;
		var screen_height=window.screen.height;
		switch (way) {
			case 1:
				what=what+'?ID='+id;
				break;
			case 2:
				what=what+'?showimg=yes&ID='+id;
				break;
			default:
				what=what+'?ID='+id;
		}
		winame='OpeWin'+id;
		win_witdth=screen_width-40;
		win_height=screen_height-40;
		how='scrollbars=1,toolbar=0,width='+win_witdth+',height='+win_height+',top=20,left=20,alwaysRaised=1,dependent=1'
		window.open(what,winame,how);
	}	
	
	
//immagine random per la testata
//base = path per le immagini
//max = 1 + numero immagini numerate da 0 a max

function rndimg(base){
var max = 12;
document.images['foto'].src = base + "foto_" + Math.floor(Math.random()*max) + ".jpg"
}

//sniffer browser

var brN4=document.layers?true:false;
var brIE=document.all?true:false;
var brMz=document.getElementById?true:false;
var brOp=window.opera?true:false;

//scambia immagine
//lang = lingua (it, en, de, fr...)
//id = id immagine (deve essere uguale al nome)

function on(root,lang,id){
document.images[id].src=root+'img/'+lang+'/on_'+id+'.gif'
return true;
}

function off(root,lang,id){
document.images[id].src=root+'img/'+lang+'/'+id+'.gif'
return true;
}


//sposta layer nella posizione corretta

function mL(nome)
{
 	if (brN4||brMz)
		var scrx = window.innerWidth;
	if (brIE)
		var scrx = document.body.clientWidth;

var basex = 234;		
var sw = 770 //larghezza della pagina		

		scrx=scrx<=sw?sw:scrx;

	layerleft = parseInt(basex+(.5*(parseInt(scrx)-sw)))+'px'; //unità misura inserita per compatibilità con Mozilla.
	
			layerObj=brN4?document.layers[nome]:brIE?document.all[nome].style:document.getElementById(nome).style;
			layerObj.left = layerleft ;
}
