<!--SITO NEWSLETTER: VALIDA INSERIMENTO DELLA MAIL NELL'HOMEPAGE -->
function validaNewsletterHome(){ 

if (formNewsletterHome.mail.value ==''){
alert ("Attenzione! Inserisci il tuo indirizzo E-mail");
return false; 
}

g = document.formNewsletterHome.mail.value; 
h = g.indexOf("@"); 
i = g.lastIndexOf(".");

if (i<3 || i<(h+4) || i>(g.length-3)) { 
alert("Attenzione! Inserire un indirizzo E-mail valido"); 
return false; 
} 
else
document.formNewsletterHome.submit()
}


<!--SITO NEWSLETTER: VALIDA INVIO RICHIETA DI INSERIMENTO -->
function validaNewsletter(){ 

if (formNewsletter.nome.value ==''){
alert ("Attenzione! Inserisci il tuo nome");
return false; 
}

if (formNewsletter.cognome.value ==''){
alert ("Attenzione! Inserisci il tuo cognome");
return false; 
}

if (formNewsletter.mail.value ==''){
alert ("Attenzione! Inserisci il tuo indirizzo E-mail");
return false; 
}

g = document.formNewsletter.mail.value; 
h = g.indexOf("@"); 
i = g.lastIndexOf(".");

if (i<3 || i<(h+4) || i>(g.length-3)) { 
alert("Attenzione! Inserire un indirizzo E-mail valido"); 
return false; 
} 
} 


<!--SITO AREA RISERVATA: VALIDA LOGIN -->
function validaAreaLogin() {
frm=document.formArea;

if (frm.user.value =='') { 
alert("Attenzione! Inserisci lo username") 
return false;
}

if (frm.password.value =='') { 
alert("Attenzione! Inserisci la password") 
return false;
}
else
document.formArea.submit()
}


<!--SITO AREA RISERVATA: VALIDA INVIA REGISTRAZIONE -->
function validaAreaInvia() {

if (formAreaRiservata.nome.value =='') { 
alert("Attenzione! Inserisci il tuo Nome/Cognome") 
return false;
}

if (formAreaRiservata.indirizzo.value =='') { 
alert("Attenzione! Inserisci il tuo indirizzo") 
return false;
}

if (formAreaRiservata.telefono.value =='') { 
alert("Attenzione! Inserisci il tuo telefono") 
return false;
}

if (formAreaRiservata.mail.value =='') { 
alert ("Attenzione! Inserisci il tuo indirizzo E-mail");
return false;
}

g = document.formAreaRiservata.mail.value; 
h = g.indexOf("@"); 
i = g.lastIndexOf(".");

if (i<3 || i<(h+4) || i>(g.length-3)) { 
alert("Attenzione! Inserire un indirizzo E-mail valido"); 
return false; 
} 
} 


<!--SITO CERCA: CONTROLLO CAMPO CERCA-->
function validaCerca() {

lunghezza=document.formCerca.cerca.value.length; 

if (document.formCerca.cerca.value ==''){ 
alert ("Attenzione! Inserire almeno una chiave di ricerca");
return false; 
}
else if (lunghezza<3)  
{
alert("Attenzione! Inserire una chiave di ricerca di almeno 3 caratteri");
return false; 
}
else
document.formCerca.submit()
}


<!--SITO HELPDESK: VALIDA INVIO DOMANDA -->
function validaHelpdesk(){ 

if (formHelpdesk.nome.value ==''){
alert ("Attenzione! Inserisci il tuo nome/cognome");
return false; 
}

if (formHelpdesk.domanda.value ==''){
alert ("Attenzione! Fai la tua domanda");
return false; 
}

if (formHelpdesk.mail.value ==''){
alert ("Attenzione! Inserisci il tuo indirizzo E-mail");
return false; 
}

g = document.formHelpdesk.mail.value; 
h = g.indexOf("@"); 
i = g.lastIndexOf(".");

if (i<3 || i<(h+4) || i>(g.length-3)) { 
alert("Attenzione! Inserire un indirizzo E-mail valido"); 
return false; 
} 
} 


<!--SITO FORUM: VALIDA LOGIN -->
function validaForumLogin() {
frm=document.formForum;

if (frm.username.value =='') { 
alert("Attenzione! Inserisci lo username") 
return false;
}

if (frm.password.value =='') { 
alert("Attenzione! Inserisci la password") 
return false;
}
else
document.formForum.submit()
}


<!--SITO GENERALE: INGRANDIMENTO FOTO-->
function apri(url_foto,des_foto){
addr="ingrandimento.htm?"+url_foto+"&"+escape(des_foto)
alt=150
lar=150
rszb=(document.layers)?1:0;
props='height='+alt+',width='+lar+',top='+parseInt((screen.availHeight-alt)/2)+',left='+parseInt((screen.availWidth-lar)/2)+',scrollbars=0,resizable='+rszb+',toolbar=0,menubar=0,location=0,status=0';
window.open(addr,'_blank',props);
}

<!--SITO GENERALE: INGRANDIMENTO FOTO-->
// se vuoi dare dei margini alla foto cambia questi 2 valori
w_add=0; 
h_add=0; 

ww=0; 
hh=0; 
OP=(window.opera)?1:0;
timer=false;

if(location.search) {
addr=location.search.substr(1);
addr=addr.split('&');
document.write('<title>'+unescape(addr[1])+'<\/title>');
}

b_w=function() {return ((window.innerWidth)?window.innerWidth:document.body.clientWidth)}
b_h=function() {return ((window.innerHeight)?window.innerHeight:document.body.clientHeight)}
rsz=function() {self.resizeTo(ww,hh)}

function init() {
ww=b_w()
hh=b_h()
rsz()
ww2=b_w()
hh2=b_h()
w_add+=(ww-ww2)
h_add+=(hh-hh2)
ridimensiona()
}

function ridimensiona(){
	var w_pix=(OP)?document.getElementById('pix').width:document.pix.width
	var h_pix=(OP)?document.getElementById('pix').height:document.pix.height

		if(w_pix>28 && h_pix>30){
			ww=w_pix+w_add
			hh=h_pix+h_add

			y_coord=((screen.availHeight-hh)<0)?0:parseInt((screen.availHeight-hh)/2)
			x_coord=((screen.availWidth-ww)<0)?0:parseInt((screen.availWidth-ww)/2)

			rsz()
			self.moveTo(x_coord,y_coord)
			self.focus()

			if (OP && !timer) {
				w_tmp=b_w(); h_tmp=b_h();				
				timer=setInterval('if(w_tmp!=window.innerWidth || h_tmp!=window.innerHeight){self.location.reload(true)}',1000)
			}		
		}
		else setTimeout('ridimensiona()',1000)
}


<!--SITO GENERALE: PRELOAD DELLE IMMAGINI-->
function preload() {
  if (!document.images) return;
  var wl = new Array();
  var arguments = preload.arguments;
  for (var i = 0; i < arguments.length; i++) {
    wl[i] = new Image();
    wl[i].src = arguments[i];
  }
}


<!--GENERALI: FUNZIONE PER LA STAMPA-->
function stampa(ident) {
var testo = "<html><head><title>"+document.title+"</title>";
testo += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
testo += "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">";
testo += "</head>";
testo += "<body>";
testo += "<table width=\"380\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
testo += "<tr>";
testo += "<td width=\"380\"><img src=\"images/interf_top_01.jpg\" width=\"189\" height=\"103\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\"><hr width=\"380\" noshade style=\"color:#004487\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\"><img src=\"images/space.gif\" width=\"380\" height=\"20\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\" align=\"center\">"+document.getElementById('livello1').innerHTML+"</td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\"><img src=\"images/space.gif\" width=\"380\" height=\"20\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\"><hr width=\"380\" noshade style=\"color:#004487\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\"><img src=\"images/space.gif\" width=\"380\" height=\"20\"></td>";
testo += "</tr>";
testo += "<tr>";
testo += "<td width=\"380\" align=\"center\" class=\"sitoTestoBlu\"><span class=\"sitoTestoBluBold\">MB Time Informatica</span><br>";
testo += "Via A.Lolli 21/A - 41037 Mirandola (MO)<br>";
testo += "Tel: + 39 0535 21146 - Fax: + 39 0535 21277<br>";
testo += "Email <a href=\"mailto:info@mbtimeinformatica.com\" class=\"sitoLinkBluSott\" onFocus=\"this.blur()\" target=\"_blank\">info@mbtimeinformatica.com</a></td>";
testo += "</tr>";
testo += "</table>";
testo += "</body>";
testo += "</html>";
var ident_finestra = window.open("","finestra_stampa","height=10,width=10");
ident_finestra.document.open();
ident_finestra.document.write(testo);
ident_finestra.document.close();
if(ident) {
ident_finestra.print();
ident_finestra.close();  

}
}



<!--********** ========== **********-->



<!--GESTIONE NEWS: ARCHIVIA-->
function ArchiviaNews(url){ 
	if (confirm("Sei sicuro di voler archiviare la news?")) 
	window.location = url
}


<!--GESTIONE NEWS: ELIMINA-->
function EliminaNews(url){ 
	if (confirm("Sei sicuro di voler eliminare definitivamente la news?")) 
	window.location = url
}


<!--GESTIONE NEWS: NASCONDI-->
function NascondiNews(url){ 
	if (confirm("Sei sicuro di voler rendere visibile la news?")) 
	window.location = url
}


<!--GESTIONE NEWS: ELIMNA FOTO-->
function EliminaFoto(url){ 
	if (confirm("Sei sicuro di voler eliminare la foto?")) 
	window.location = url
	return false;
} 


<!--GESTIONE NEWS: ELIMINA LINK-->
function EliminaLink(url){ 
	if (confirm("Sei sicuro di voler eliminare il link?")) 
	window.location = url
	return false;
} 


<!--GESTIONE NEWS: ELIMINA ALLEGATO-->
function EliminaAllegato(url){ 
	if (confirm("Sei sicuro di voler eliminare l' allegato?")) 
	window.location = url
	return false;
} 


<!--GESTIONE NEWS: RIPRISITNA-->
function RipristinaNews(url){ 
	if (confirm("La news verrą ripristinata")) 
	window.location = url
	return false;
}


<!--GESTIONE NEWS: CONTROLLO CARATTERI TITOLO-->
function TitoloIt() {
str=String(formNews.titolo.value);
var Lunghezza =str.length;
formNews.it_car_titolo.value=Lunghezza
if (str.length>250) { alert('AL MASSIMO 250 CARATTERI!'); formNews.titolo.select(); }
}


<!--GESTIONE NEWS: CONTROLLO CARATTERI ABSTRACT-->
function AbstractIt() {
str=String(formNews.abstract.value);
var Lunghezza =str.length;
formNews.it_car_abstract.value=Lunghezza
if (str.length>250) { alert('AL MASSIMO 250 CARATTERI!'); formNews.abstract.select(); }
}


<!--GESTIONE NEWS: CONTROLLO CARATTERI KEYWORDS-->
function KeyIt() {
str=String(formNews.keywords.value);
var Lunghezza =str.length;
formNews.it_car_key.value=Lunghezza
if (str.length>250) { alert('AL MASSIMO 250 CARATTERI!'); formNews.keywords.select(); }
}


<!--GESTIONE NEWS: FORMATTAZIONE TESTO-->
function AddFormatCaratteriIt(formattazione) 
{ 
txtdaformattare=prompt('Inserire il testo da porre fra <'+formattazione+'> Testo </'+formattazione+'>:'); 
txt="<"+formattazione+">"+txtdaformattare+"</"+formattazione+">"; 
document.formNews.testo.value+=txt; 
} 

function AddFormatAllineamIt(formattazione) 
{ 
txtdaformattare=prompt('Inserire il testo da porre fra <'+formattazione+'> Testo </'+formattazione+'>:'); 
txt="<div aling="+formattazione+">"+txtdaformattare+"</div>"; 
document.formNews.testo.value+=txt; 
} 


<!--GESTIONE NEWS: CONTROLLO INSERIMENTO LINK-->
function DescrizioneLink() {
if (/http:/.test(document.formAggiungiLink.url_link.value)) { 
alert("Attenzione! Eliminare il prefisso http:// dall' indirizzo del link");
return false;
} 

lin=String(formAggiungiLink.url_link.value);
formAggiungiLink.descr_link.value=lin
}


<!--GESTIONE NEWS: CONTROLLO DATE E MAIL-->
function validaNews() {
frm=document.formNews;

if (frm.titolo.value =='') { 
alert("Attenzione! Inserisci il titolo della news") 
return false;
}

if (frm.testo.value =='') { 
alert("Attenzione! Inserisci testo della news") 
return false;
}


if (frm.data_inizio.value != '' && frm.data_inizio.value.length!=10) { 
alert("Attenzione! Inserire la data di inizio validitą news nel formato gg/mm/aaaa. Es --> 01/01/2004") 
return false;
}

if (frm.data_fine.value != '' && frm.data_fine.value.length!=10) { 
alert("Attenzione! Inserire la data di fine validitą news nel formato gg/mm/aaaa. Es --> 01/01/2004") 
return false;
}

if (frm.mail.value !='')  {
mail = frm.mail.value; 
b = mail.indexOf("@"); 
c = mail.lastIndexOf("."); 

if (b<3 || c<(b+4) || c>(mail.length-3)) { 
alert("Attenzione! Inserire un indirizzo e-mail valido"); 
return false; 
}
}

}


<!--GESTIONE NEWS: DESCRIZIONE ALLEGATO-->
function validaAllegato() {
frm=document.formAggiungiAllegati;

if (frm.descr_allegato.value =='') { 
alert("Attenzione! Inserire la descrizione dell'allegato in italiano") 
return false;
}

}


<!--GESTIONE NEWS: ELIMINAZIONE NEWS DALL' HOMEPAGE-->
function EliminaHomepage(url){ 
	if (confirm("Attenzione! Stai elimando la news dall'hompage.")) 
	window.location = url
	return false;
} 



<!--********** ========== **********-->



<!--GESTIONE HELPDESK: ELIMINAZIONE RISPOSTA IN HOMEPAGE-->
function EliminaHomepageDomanda(url){ 
	if (confirm("Attenzione! Stai elimando la risposta dall'hompage")) 
	window.location = url
	return false;
} 


<!--GESTIONE HELPDESK: DESCRIZIONE ALLEGATO-->
function ValidaRisposta() {
frm=document.formScheda;

if (frm.elements['homepage'].checked==true) {
	if (frm.titolo.value =='') { 
	alert("Attenzione! Inserire il titolo abbreviato per l'homepage") 
	return false;
	}
}

if (frm.elements['pubblica'].checked==true) {
	if (frm.risposta.value =='') { 
	alert("Attenzione! Inserire la risposta alla domanda") 
	return false;
	}
}


if (frm.titolo.value !='') { 
str=String(frm.titolo.value);
var Lunghezza =str.length;
if (str.length>30) { 
alert('Attenzione! Al massimo 30 caratteri'); 
return false;
}
}
}


<!--GESTIONE HELPDESK: ELIMINAZIONE RISPOSTA-->
function EliminaDomanda(url){ 
	if (confirm("Attenzione! Sei sicuro di voler eliminare la domanda")) 
	window.location = url
	return false;
} 



<!--********** ========== **********-->



<!--GESTIONE AREA RISERVATA: VALIDAZIONE AGGIUNGI-->
function validaUtente() {
frm=document.formUtente;

if (frm.nome.value =='') {
alert ("Attenzione! Inserisci il nome dell'utente");
return false;
}

if (frm.indirizzo.value =='') {
alert("Attenzione! Inserire l'indirizzo dell'utente");
return false;
}  

if (frm.telefono.value =='') {
alert("Attenzione! Inserire il recapito telefonico dell'utente");
return false;
} 

if (frm.mail.value !='')  {
mail = frm.mail.value; 
b = mail.indexOf("@"); 
c = mail.lastIndexOf("."); 

if (b<3 || c<(b+4) || c>(mail.length-3)) { 
alert("Attenzione! Inserire un indirizzo e-mail valido"); 
return false; 
}
}
}


<!--GESTIONE AREA RISERVATA: ELIMINA-->
function EliminaUtente(url){ 
	if (confirm("Sei sicuro di voler eliminare l'utente?")) 
	window.location = url
}



<!--********** ========== **********-->



<!--GESTIONE INDICIZZAZIONE: ELIMINA-->
function EliminaPagina(url){ 
	if (confirm("Sei sicuro di voler eliminare definitivamente l'indicizzazione della pagina scelta?")) 
	window.location = url
}
