function WriteEmail(anchortext, mailpart1, mailpart2)
{
	document.write("<a href=\"mail" + "to:" + mailpart1 + "@" + mailpart2 + "\">" + anchortext + "<\/a>");
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
//-->

function preloadImages() //v3.0
{
  	var d=document;
	if(d.images)
	{
		if(!d.p) d.p=new Array();
    	var i,j=d.p.length
		a=preloadImages.arguments; 
		for(i=0; i<a.length; i++)
    	if (a[i].indexOf("#")!=0)
		{
			d.p[j]=new Image;
			d.p[j++].src=a[i];
		}
	}
}
function cambia(nome)
{
	document.images[nome].src="images/link"+nome+"on.gif"
}
function torna(nome)
{
	document.images[nome].src="images/link"+nome+".gif"
}

function OnSubmitForm()
{
	if(document.pressed == 'GO' )
	{
		document.FormCerca.action ="/gruppo/ricerca.asp";
	}
	return true;
}

function controlla(todo)
{
	var blnflag = "True";
	mystring = new String(document.firma.messaggio.value);
	intmess = mystring.length;
	if ((document.firma.nome.value=="") && (blnflag=="True"))
	{
		alert("Ci dispiace, ma il tuo nome ce lo devi proprio dire!");
		document.firma.nome.focus();
		blnflag = "False";
	}
	if ((document.firma.messaggio.value=="") && (blnflag=="True"))
	{
		alert("Neanche due paroline di messaggio? Su, fai uno sforzo!")
		document.firma.messaggio.focus()
		blnflag = "False";
	}
	if (blnflag=="True")
	{
		document.firma.action="scriviguest.asp?todo=" + todo
		document.firma.submit()
	}
}

function controllamail(todo)
{
	var blnflag = "True";
	mystring = new String(document.mailtowebmaster.messaggio.value);
	intmess = mystring.length;
	if ((document.mailtowebmaster.nome.value=="") && (blnflag=="True"))
	{
		alert("Ci dispiace, ma il tuo nome ce lo devi proprio dire!");
		document.mailtowebmaster.nome.focus();
		blnflag = "False";
	}
	if ((document.mailtowebmaster.email.value=="") && (blnflag=="True"))
	{
		alert("Ci dispiace, ma devi inserire la tua mail!");
		document.mailtowebmaster.email.focus();
		blnflag = "False";
	}
	if ((document.mailtowebmaster.messaggio.value=="") && (blnflag=="True"))
	{
		alert("Neanche due paroline di messaggio? Su, fai uno sforzo!")
		document.mailtowebmaster.messaggio.focus()
		blnflag = "False";
	}
	if (blnflag=="True")
	{
		document.mailtowebmaster.action="inviomail.asp?todo=" + todo
		document.mailtowebmaster.submit()
	}
}


<!---->
	function controllaCapo()
	{
		blnflag = "True"
		strpassw = new String(document.schedacapo.passw1.value)
		intpassw = strpassw.length
		if (document.schedacapo.nick.value=="")
		{
			alert("Devi inserire il tuo nome (o soprannome), con cui verrai identificato nell'Area capi")
			blnflag = "False"
			document.schedacapo.nick.focus()
		}
		if ((document.schedacapo.email.value=="") && (blnflag=="True"))
		{
			alert("Devi inserire la tua Email, alla quale potrai essere contattato da genitori e altri")
			blnflag = "False"
			document.schedacapo.email.focus()
		}
		if ((intpassw<4) && (blnflag=="True"))
		{
			alert("La password deve essere lunga almeno 4 caratteri.")
			blnflag = "False"
			document.schedacapo.passw1.value=""
			document.schedacapo.passw2.value=""
			document.schedacapo.passw1.focus()
		}
		if ((document.schedacapo.passw1.value!=document.schedacapo.passw2.value) && (blnflag=="True"))
		{
			alert("Hai inserito due password diverse! Riscrivile correttamente.")
			blnflag = "False"
			document.schedacapo.passw1.value=""
			document.schedacapo.passw2.value=""
			document.schedacapo.passw1.focus()
		}
		if ((document.schedacapo.descri.value=="") && (blnflag=="True"))
		{
			alert("Devi inserire una tua descrizione personale")
			blnflag = "False"
			document.schedacapo.descri.focus()
		}
		if (blnflag=="True")
		{
			document.schedacapo.submit()
		}
	}

function checkEmail(email) 
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) 
	{
		alert('Inserisci una mail valida!');
		return false;
	}
	return true;
}


function controllanewsletter()
	{
		var em = document.news.email;
		if (em && em.value=="")
		{
			alert("Devi inserire il tuo indirizzo email!")
			document.news.email.focus()
			return
		}
		if(em && !checkEmail(em.value))
		{
			em.focus();
			return;
		}
		if (!document.news.sito.checked && !document.news.gruppo.checked && !document.news.lc.checked && !document.news.eg.checked && !document.news.nov.checked && !document.news.clan.checked)
		{
			alert("Devi scegliere almeno una newsletter!")
			return
		}
		document.news.submit()
	}





var oMarquees = [], oMrunning,
   oMInterv =        20,     //interval between increments
   oMStep =          2,      //number of pixels to move between increments
   oStopMAfter =     0,     //how many seconds should marquees run (0 for no limit)
   oResetMWhenStop = false,  //set to true to allow linewrapping when stopping
   oMDirection =     'left'; //'left' for LTR text, 'right' for RTL text

/***     Do not edit anything after here     ***/

function doMStop() {
   clearInterval(oMrunning);
   for( var i = 0; i < oMarquees.length; i++ ) {
      oDiv = oMarquees[i];
      oDiv.mchild.style[oMDirection] = '0px';
      if( oResetMWhenStop ) {
         oDiv.mchild.style.cssText = oDiv.mchild.style.cssText.replace(/;white-space:nowrap;/g,'');
         oDiv.mchild.style.whiteSpace = '';
         oDiv.style.height = '';
         oDiv.style.overflow = '';
         oDiv.style.position = '';
         oDiv.mchild.style.position = '';
         oDiv.mchild.style.top = '';
      }
   }
   oMarquees = [];
}
function doDMarquee() {
   if( oMarquees.length || !document.getElementsByTagName ) {
return; }
   var oDivs = document.getElementsByTagName('div');
   for( var i = 0, oDiv; i < oDivs.length; i++ ) {
      oDiv = oDivs[i];
      if( oDiv.className && oDiv.className.match(/\bdmarquee\b/) ) {
         if( !( oDiv = oDiv.getElementsByTagName('div')[0] ) ) { continue; }
         if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) ) { continue; }
         oDiv.mchild.style.cssText += ';white-space:nowrap;';
         oDiv.mchild.style.whiteSpace = 'nowrap';
         oDiv.style.height = oDiv.offsetHeight + 'px';
         oDiv.style.overflow = 'hidden';
         oDiv.style.position = 'relative';
         oDiv.mchild.style.position = 'absolute';
         oDiv.mchild.style.top = '0px';
         oDiv.mchild.style[oMDirection] = oDiv.offsetWidth + 'px';
         oMarquees[oMarquees.length] = oDiv;
         i += 2;
      }
   }
   oMrunning = setInterval('aniMarquee()',oMInterv);
   if( oStopMAfter ) { setTimeout('doMStop()',oStopMAfter*1000); }
}
function aniMarquee() {
   var oDiv, oPos;
   for( var i = 0; i < oMarquees.length; i++ ) {
      oDiv = oMarquees[i].mchild;
      oPos = parseInt(oDiv.style[oMDirection]);
      if( oPos <= -1 * oDiv.offsetWidth ) {
         oDiv.style[oMDirection] = oMarquees[i].offsetWidth + 'px';
      } else {
         oDiv.style[oMDirection] = ( oPos - oMStep ) + 'px';
      }
   }
}
if( window.addEventListener ) {
   window.addEventListener('load',doDMarquee,false);
} else if( document.addEventListener ) {
   document.addEventListener('load',doDMarquee,false);
} 
else if( window.attachEvent ) {
   window.attachEvent('onload',doDMarquee);
}