function pop(time)
{
		document.getElementById('excl').style.visibility="visible";
		document.getElementById('popup').style.visibility="visible";
		setTimeout("pphide();",time);
}

function fuap(object)
{
	var child = object.firstChild;
	var dest = child.getAttributeNode('href').nodeValue;
	document.location.href = dest;
}

	function hl(p){
	switch(p){
		case 1:
			document.getElementById('hl1').style.visibility="visible";
			document.getElementById('who').style.color="#e698bc";
			break;
		case 2:
			document.getElementById('hl2').style.visibility="visible";
			document.getElementById('how').style.color="#a8b5f7";
			break;
		case 3:
			document.getElementById('hl3').style.visibility="visible";
			document.getElementById('rul').style.color="#f8ff37";
			break;
		case 4:
			document.getElementById('hl4').style.visibility="visible";
			document.getElementById('ric').style.color="#6ac96a";
			break;
		case 5:
			document.getElementById('hl5').style.visibility="visible";
			document.getElementById('con').style.color="#888888";
			break;
		case 6:
			document.getElementById('hl1').style.visibility="hidden";
			document.getElementById('who').style.color="#555555";
			break;
		case 7:
			document.getElementById('hl2').style.visibility="hidden";
			document.getElementById('how').style.color="#555555";
			break;
		case 8:
			document.getElementById('hl3').style.visibility="hidden";
			document.getElementById('rul').style.color="#555555";
			break;
		case 9:
			document.getElementById('hl4').style.visibility="hidden";
			document.getElementById('ric').style.color="#555555";
			break;
		case 10:
			document.getElementById('hl5').style.visibility="hidden";
			document.getElementById('con').style.color="#555555";
			break;
	}
}

	function col(p){
	switch(p){
		case 1:
			window.location.href="who.html";
			break;
		case 2:
			window.location.href="how.html";
			break;
		case 3:
			window.location.href="rul.html";
			break;
		case 4:
			window.location.href="ric.html";
			break;
		case 5:
			window.location.href="cont.html";
			break;
	}
}


function usnfoc ()
{
	document.flogin.elements['codice'].value="";
	document.flogin.elements['codice'].style.color="#000000";
}
function loggati ()
{
	document.flogin.elements['codice'].style.color="#999999";
	document.flogin.elements['pwd'].style.color="#999999";
	document.flogin.elements['azione'].value="accedi";
	document.flogin.action="http://www.jcard.it:8014/jcpwebp/jcregcr.pgm";
	window.open("attesa.htm","farcli","width=1020,height=764,menubar=no,toolbar=no,scrollbars=no,status=no,location=no,resizable=no");
	document.flogin.target="farcli";
	
	var stringa=document.flogin.elements['codice'].value;
	var re="/ /g";
	stringa=stringa.replace(re, '');
	if (stringa.substring(0,1)=="&")
	{
		var len = stringa.length;
		stringa=stringa.substring(1,len-1);
	}
	
	if (stringa.length==9) stringa=stringa.substring(0,5)+"0"+stringa.substring(5,9);
	if (stringa.length==8) stringa=stringa.substring(0,5)+"00"+stringa.substring(5,8);
	if (stringa.length==7) stringa=stringa.substring(0,5)+"000"+stringa.substring(5,7);
	if (stringa.length==6) stringa=stringa.substring(0,5)+"0000"+stringa.substring(5,6);
 
	document.flogin.elements['codice'].value=stringa.toUpperCase();
  			
	document.flogin.submit();
	document.flogin.elements['pwd'].value="";
}

var control=0;
function registrati (p)
{
	window.open('attesa.htm',"farcli","width=1020,height=764,menubar=no,toolbar=no,scrollbars=no,status=no,location=no,resizable=no");
	document.flogin.elements['codice'].style.color="#999999";
	document.flogin.elements['pwd'].style.color="#999999";
	document.flogin.elements['pwd'].value="";
	document.flogin.elements['azione'].value="pagreg";
	document.flogin.action="http://www.jcard.it:8014/jcpwebp/jcregc.pgm";
	document.flogin.target="farcli";
	if ((p==1)&&(control==1))document.flogin.elements['codice'].value=document.form1.elements['emnl'].value;

	document.flogin.submit();
	
}
 
function swapF(from){
	var to,setF=false;
	if(from.type=='password'){
		to=from.form.holder;
	}
	else {
		to=from.form.pwd;
		setF=true;
	}
	if(setF || from.value==''){
		// swappa solo se:
		// e' da settare il focus (quindi to e' pass)
		// oppure non viene inserito valore nel campo pass 
		to.style.display='inline-block';
		to.style.color='#000000';
		from.style.display='none';
	}
	if(setF) to.focus();
}

function ckcogn()
{
	if (document.fisc.elements['cognome'].value!="")
	{
		if (document.fisc.elements['via'].value!="")
		{
			if (document.fisc.elements['cap'].value!="")
			{
				document.fisc.action="sendreq.php";
				fsendd();
			}
			else
			{
				alert('Devi inserire il cap!');
			}
		}
		else
		{
			alert('Devi inserire la via!');
		}
	}
	else
	{
		alert('Devi inserire il cognome!');
	}
}

function fsendd ()
{
	var con=0;
	if (document.fisc.elements['consenso'].checked)
	{
		if (document.fisc.elements['nome'].value!="")
		{
			if (document.fisc.elements['cognome'].value!="")
			{
				if (document.fisc.elements['localita'].value!="")
				{
					if (document.fisc.elements['provincia'].value!="")
					{
						if (document.fisc.elements['email'].value!="")
						{
							if (document.fisc.elements['cemail'].value!="")
							{
								if(document.fisc.elements['email'].value==document.fisc.elements['cemail'].value)
								{
									var email=document.fisc.elements['email'].value;
									if (email.match('@')=='@')
									{
										document.fisc.submit();
									}
									else
									{
										alert('Controlla l\'esattezza dell\'eMail');
									}
								}
								else
								{
									alert('Controlla l\'esattezza dell\'eMail');
								}
							}
							else
							{
								alert('Devi confermare l\'indirizzo eMail');
							}
						}
						else
						{
							alert('Devi inserire l\'indirizzo eMail');
						}
					}
					else
					{
						alert('Devi inserire la provincia');	
					}
				}
				else
				{
					alert('Devi inserire il cognome');
				}
			}
			else
			{
				alert('Devi inserire la località');
			}
		}
		else
		{
			alert('Devi inserire il nome');
		}
	}
	else
	{
		alert('Devi dare il consenso al trattamento dei dati...');
	}
}


function fsende ()
{
	var con=0;
	if (document.fisc.elements['consenso'].checked)
	{
		if (document.fisc.elements['nome'].value!="")
		{
			if (document.fisc.elements['localita'].value!="")
			{
				if (document.fisc.elements['provincia'].value!="")
				{
					if (document.fisc.elements['email'].value!="")
					{
						var email=document.fisc.elements['email'].value;
						if (email.match('@')=='@')
						{
							document.fisc.submit();
						}
						else
						{
							alert('Controlla l\'esattezza dell\'eMail');
						}
					}
					else
					{
						alert('Devi inserire l\'indirizzo eMail');
					}
				}
				else
				{
					alert('Devi inserire la provincia');	
				}
			}
			else
			{
				alert('Devi inserire la località');
			}
		}
		else
		{
			alert('Devi inserire il nome');
		}
	}
	else
	{
		alert('Devi dare il consenso al trattamento dei dati...');
	}
}



function pphide()
{
	document.getElementById('excl').style.visibility="hidden";
	document.getElementById('whycond1').style.visibility="hidden";
	document.getElementById('whycond2').style.visibility="hidden";
	document.getElementById('popup').style.visibility="hidden";
}
function ppshow(p)
{
	document.getElementById('excl').style.visibility="visible";
	if(p==1)
	{
		document.getElementById('whycond1').style.visibility="visible";
	}
	else
	{
		document.getElementById('whycond2').style.visibility="visible";
	}
}
