function exit(opt) {
	if (window.event.keyCode == 13)
	{
		//alert( " ENTER !");
		switch (opt) {
			case 1 :
				Cerca();
				break;
			case 2 :
				IDValidate();
				break;
			case 3 :						
				NWLValidate();
				break;
			}
	}
	return;
}		

function mOvr(src, color)
{ 
	src.bgColor = color; 
}
 
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
}

function OpenSind() {
	if (document.frmSind.select2.value == 0)
		return; 
	document.location.href="sindacati.asp?id=" + document.frmSind.select2.value;
}

function IDValidate()
{
	var err, msg;
		
	err=0;
	if (document.frmUID.userID.value == "")
	{	
		alert( "User ID obbligatorio !");
		document.frmUID.userID.focus();
		document.frmUID.userID.select();
		return;
	}

	if( document.frmUID.password.value == "")
	{	
		alert( "PASSWORD obbligatoria !");
		document.frmUID.password.focus();
		document.frmUID.password.select();
		return;
	}									

	if (document.frmUID.password.value != "")
	{	
		msg=String(document.frmUID.password.value);		
		nCr=msg.length;
		if(nCr < 4)
		{
			alert("Il campo PASSWORD deve essere obbligatoriamente lungo 6 caratteri !");
			document.frmUID.password.focus();
			document.frmUID.password.select();
			return;
		}
	}

	document.frmUID.submit();
}
	
function NWLValidate()
{
	var err, msg, msg1, i;
	
	err=0;
	if (document.frmNWL.nome.value == "")
	{	
		alert( "User ID obbligatorio !");
		document.frmNWL.nome.focus();
		document.frmNWL.nome.select();
		return;
	}

	if( document.frmNWL.email.value == "")
	{	
		alert( "PASSWORD obbligatoria !");
		document.frmNWL.email.focus();
		document.frmNWL.email.select();
		return;
	}									

	if (document.frmNWL.email.value != "")
	{	
		msg=String(document.frmNWL.email.value);
		err=2;
		for(i=0;i<msg.length;i++)
		{	
			msg1=msg.substring(i,i+1);
			if (msg1 == ".")
				err--;
			if (msg1 == "@")
				err--;			
		}
		if (err > 0)
		{
			alert("Campo e-mail errato !");
			document.frmNWL.email.focus();
			document.frmNWL.email.select();
			return;
		}
	}
	
	document.frmNWL.submit();
}

function CheckLevel(IDBtn)
{
	var rPage;
		
	//alert("Btn= "+IDBtn+" LVL= "+frmSVA.lvlUtente.value);
	
	switch(IDBtn) 
	{
		case 1 :
			rPage="lavoro/offerte.asp?Parm=Reset&rst=1";	
			break;
		case 2 :
			if (frmSVA.lvlUtente.value == 0) 
			{
				if (confirm("Area Protetta da Login. Se non sei registrato iscriviti ora.") == false)
					return;
				else
					rPage="iscrizione2.asp"
			}
			else 
			{
				if (frmSVA.lvlUtente.value > 1) 
				{
					alert("Opzione non disponibile.");
					return;
				}
				else 
					rPage="lavoro/curriculum.asp"
			}
			break;
		case 3 :
			if (frmSVA.lvlUtente.value < 2) 
			{
				if (confirm("Area Protetta da Login. Se non sei registrato iscriviti ora.") == false)
					return;
				else
					rPage="iscrizione1.asp"
			}
			else
				rPage="reserved.asp"
			break;
	}

	document.location.href=rPage
}

function Cerca()
{
	
	if (document.frmSRC.str1.value == "")
	{	
		alert("Testo ricerca obbligatorio !");
		document.frmSRC.str1.focus();
		document.frmSRC.str1.select();
		return;
	}

	document.frmSRC.submit();
}

function Iscrizione()
{
	document.location.href="iscrizione2.asp?Parm=Reset";
}

function wOpen()
{
	var w2;
	w2=window.open("presidente.htm","Presidenza","width=400,height=310");
}

function w2Open(var1)
{
	var w2

	if (var1 == "")
	{	
		alert( "Nessun dato in Archivio !");
		return;
	}

	ind="notizie.asp?idx="+var1;
	w2=window.open(ind,"","width=400,height=320");
	
}

function w3Open(var1, var2)
{
	var w2

	if (var1 == "")
	{	
		alert( "Nessun dato in Archivio !");
		return;
	}

	ind=var2+"?idx="+var1;
	w2=window.open(ind,"","width=400,height=310");
	
}

function w4Open(var1)
{
	var w2

	if (var1 == "")
	{	
		alert( "Nessun dato in Archivio !");
		return;
	}

	ind="fotobig.asp?idx="+var1;
	w2=window.open(ind,"","width=463,height=315");
	
}
