// comandi per pagina private

// rev blog init ***************************************************************************************************
// input dei form
function controllaletter() {
	window.defaultstatus="";
	at = document.forms["letter"].email.value.indexOf("@");
	if (document.forms["letter"].email.value == "" || at == -1) {
		alert("Devi immettere la tua E-MAIL se vuoi continuare");
		document.forms["letter"].email.focus();
	} else {
		document.forms["letter"].submit();
	}
}
// rev blog fine ***************************************************************************************************


// routine javascript per controllo user-password
function controlla() 
{ 
//	window.defaultstatus="";
	testu = new String(document.forms("formaccesso").user.value); 
	testp = new String(document.forms("formaccesso").password.value); 
	if (testu == "" || testu.length < 4) 
	{
		alert("Devi inserire User"); 
		document.forms("formaccesso").user.focus(); 
	} else if (testp == "" || testp.length < 4) 
	{
		alert("Devi inserire password"); 
		document.forms("formaccesso").password.focus(); 
	} else 
	{
		document.forms("formaccesso").submit(); 
	}
}

// rev blog init ***************************************************************************************************
// routine javascript per modifica user-password
function controllap(esco) 
{ 
	if (esco == 1) 
	{ 
		testn1p = new String(document.forms('formaccesso').n1password.value); 
		testn2p = new String(document.forms('formaccesso').n2password.value); 
		if (testn1p == '' || testn1p.length < 4) 
		{
			alert('Devi inserire la nuova password'); 
			document.forms('formaccesso').n1password.focus(); 
		} else if (testn2p == '' || testn2p.length < 4) 
		{
			alert('Devi inserire due volte la nuova password'); 
			document.forms('formaccesso').n2password.focus(); 
		} else if (String(testn1p) != String(testn2p)) 
		{
			alert('*' + testn1p + '*'); 
			alert('*' + testn2p + '*'); 
			alert('Nuova password ERRATA'); 
			document.forms('formaccesso').n1password.focus(); 
		} else 
		{
			document.forms('formaccesso').comando.value = '00';
			document.forms('formaccesso').submit(); 
		}
	} else 
	{
		document.forms('formaccesso').comando.value = '000';
		document.forms('formaccesso').submit(); 
	}
}
// rev blog fine ***************************************************************************************************

// rev blog init ***************************************************************************************************
// routine javascript per controllo dati form redazionale devo generalizzare la routine .......
function controllaarticolo() 
{ 
	testn1p = new String(document.forms('farticolo').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('farticolo').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('farticolo').data.focus(); 
	} else
	{
//		document.forms('farticolo').nomecampo.value = '000';
		document.forms('farticolo').submit(); 
	}
}
// rev blog fine ***************************************************************************************************

// rev blog init ***************************************************************************************************
// routine javascript per controllo dati form redazionale devo generalizzare la routine .......
function controllafoto() 
{ 
	testn1p = new String(document.forms('ffoto').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('ffoto').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('ffoto').data.focus(); 
	} else
	{
//		document.forms('ffoto').nomecampo.value = '000';
		document.forms('ffoto').submit(); 
	}
}
// rev blog fine ***************************************************************************************************


// rev blog init ***************************************************************************************************
// routine javascript per controllo dati form redazionale devo generalizzare la routine .......
function controllalink() 
{ 
	testn1p = new String(document.forms('flink').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('flink').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('flink').data.focus(); 
	} else
	{
//		document.forms('flink').nomecampo.value = '000';
		document.forms('flink').submit(); 
	}
}
// rev blog fine ***************************************************************************************************


// routine javascript per controllo dati form territori devo generalizzare la routine .......
function controllaterritori() 
{ 
	testn1p = new String(document.forms('fterritori').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fterritori').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fterritori').data.focus(); 
	} else
	{
//		document.forms('fterritori').nomecampo.value = '000';
		document.forms('fterritori').submit(); 
	}
}

// routine javascript per controllo dati form redazionale devo generalizzare la routine .......
function controllacomics() 
{ 
	testn1p = new String(document.forms('fcomics').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fcomics').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fcomics').data.focus(); 
	} else
	{
//		document.forms('fcomics').nomecampo.value = '000';
		document.forms('fcomics').submit(); 
	}
}

// routine javascript per controllo dati form newsletter devo generalizzare la routine .......
function controllanewsletter() 
{ 
	testn1p = new String(document.forms('fnewsletter').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fnewsletter').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fnewsletter').data.focus(); 
	} else
	{
//		document.forms('fnewsletter').nomecampo.value = '000';
		document.forms('fnewsletter').submit(); 
	}
}

// routine javascript per controllo dati form newsletter devo generalizzare la routine .......
function controllanewsletteriscritti() 
{ 
		document.forms('fnewsletteriscritti').submit(); 
}

// routine javascript per controllo dati form fnews
function controllacerca() 
{ 
//	document.forms('fcerca').co.value = 'nu';
	document.forms('fcerca').submit(); 
}

// routine javascript per controllo dati form fnews
function controllanews() 
{ 
	testn1p = new String(document.forms('fnews').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fnews').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fnews').data.focus(); 
	} else
	{
//		document.forms('fnews').nomecampo.value = '000';
		document.forms('fnews').submit(); 
	}
}

// routine javascript per controllo dati form fnews
function controllaarca() 
{ 
	testn1p = new String(document.forms('farca').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('farca').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('farca').data.focus(); 
	} else
	{
//		document.forms('farca').nomecampo.value = '000';
		document.forms('farca').submit(); 
	}
}

// routine javascript per controllo dati form fagenda
function controllaagenda() 
{ 
	testn1p = new String(document.forms('fagenda').data.value); 
	if (testn1p == '' || testn1p.length < 8) 
	{
	alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fagenda').data.focus(); 
	} else if (testn1p == '' || testn1p.length < 8) 
	{
		alert('Devi inserire una data valida xx/xx/xxxx'); 
		document.forms('fagenda').data.focus(); 
	} else
	{
//		document.forms('fagenda').nomecampo.value = '000';
		document.forms('fagenda').submit(); 
	}
}

// routine per max lunghezza dei campi textarea in un form!
// response.write "<textarea rows='5' cols='50' name='testo' onkeyup='contatxt(this.form.testo,1000)' onkeydown='contatxt(this.form.testo,1000)'>" & testo & "</textarea>"
function contatxt(textfield, maxlength) {
	if (textfield.value.length > maxlength) {
	textfield.value = textfield.value.substring(0,maxlength);
	}
}

// invia l'url ad un indirizzo da scrivere tramite posta elettronica
function inviaurl(){
indirizzo=document.URL;
titolo=document.title;
s="mailto:?subject="+titolo;
s+="&body="+indirizzo;
location.href = s;
}

// aggiunge l'indirizzo ai preferiti
function aggiungipreferiti(){
indirizzo=document.URL;
titolo=document.title;
window.external.AddFavorite(indirizzo,titolo);
}

// apre la pagina ridotta per l'upload documento
function apriforum(){
	indirizzo =	"public/snitz/default.asp";
	titolo =	"FlaeiSardegnaForum";
	future = 	"top=30, left=30, menubar=yes, fullscreen=no, scrollbar=yes, toolbar=yes, resizable=yes, status=yes, width=600, height=300";
//	future = 	"width=700, height=400, scrollbar=yes";
	finestra1 = window.open(indirizzo,titolo,future);
//	finestra1 = window.open(indirizzo);
}

// apre la pagina ridotta per l'upload documento
function apricardocumento(numrecord){
	indirizzo =	"cardocumento.asp?re="+numrecord;
	titolo =	"documento";
	future = 	"toolbar=no,resizable=no,status=no,width=900,height=300";
	finestra1 = window.open(indirizzo,titolo,future);
	finestra1.focus;
}

// apre la pagina ridotta per l'upload foto
function apricarfoto(nomeurl){
	finestra1 = window.open(nomeurl,"Fotografia","toolbar=no,resizable=no,status=no,width=900,height=300");
	finestra1.focus;
}

// aggiorna pagina madre e chiude popup
function aggiornachiudi() {
	opener.location.reload()
	window.close();
}


// aggiorna pagina madre e chiude popup
function mostrafoto(immagine) {
	finestra1 = window.open("","Fotografia","toolbar=no,resizable=no,status=no,width=620,height=600");
	finestra1.document.write("<html><head></head><body scroll=yes>");
	finestra1.document.write("<img src='"+immagine+"' border='0' width='580'><br>");
	finestra1.document.write("<p align='center'><form>");
	finestra1.document.write("<input type='button' onclick='javascript:window.close()' value='C H I U D I'>");
	finestra1.document.write("</form></p>");
	finestra1.document.write("</body></html>");
	finestra1.focus;
}



// non funziona per il momento

// chiude una pagina 
function chiudipagina(finestra) {
	window.close(finestra);
}

// fine non funzionano

// tipica di apertura pagina
function apripaginaaiuto(){
	finestra1 = window.open("aiuto.htm","aiuto","toolbar=no,resizable=no,status=no,width=320,height=400");
	finestra1.focus;
}


