/*
		Form sulle pagine
		CiBer 7/2008
*/
function fillFormLogin()
{
	var txt='';
	if (document.getElementById('proFormLogin')){
		txt=(msgLogin != "")?msgLogin:nickName;
		if (codOpe!=0){
			txt+='<a href="page.cfm?page=scriviArticolo" title="Aggiungi scritto"><img src="img/scrArt.png" height=30 alt="Aggiungi scritto" border=0 /></a>'
				+'<a href="page.cfm?page=datiUtente" title="Modifica dati utente"><img src="img/datuten.png" height=30 alt="Modifica dati utente" border=0 /></a>';
			if(codOpe > 0){
				var a1=aGrpUte.split(","), a2=aGrpUteDes.split(","), agd=new Array(), x=grpUte.split("|"), nn=x[(x.length-1)];
				for (i in a1){agd[a1[i]]=a2[a1[i]];}
				txt+='<a href="autore.cfm?id='+codOpe+'" class="ute'+nn+'" title="Accedi alla tua pagina (Gruppo: '+agd[nn]+')">&nbsp;</a>';
			}
			txt+='<a href="index.cfm?sz=1" title="Clicca per chiudere la sessione"><img src="img/logOut.png" height=30 alt="Clicca per chiudere la sessione" border=0 /></a>';

		}else{
			txt+='<form id="frmLogin" name="frmLogin" method="post"><table cellpadding=0 cellspacing=0><tr>'
				+'<td>User ID: <input name="userID" type="text" class="formlg" value="User ID" onfocus="chkVal(this)" size=11 maxlength=25 /></td>'
				+'<td>Password: <input name="psw" type="password" class="formlg" size=12 maxlength=25 /></td>'
				+'<td><input type="submit"  value="Login" /><input type="Hidden" name="w2do" value="chk"></td></tr></table></form>'
				+'<table cellpadding=0 cellspacing=0 width="94%"><tr><td><a href="registrati.cfm" title="Ancora non sei dei nostri? che aspetti!">Registrati</td> '
				+'<td id="proFormForgotPsw" align="right"><a href="Javascript:forgotPSW()">UserName o Password dimenticati?</a></td></tr></table>'
			+'';
		}
		document.getElementById('proFormLogin').innerHTML='<p class="logtxt">'+txt+'</p>';
	}
}

fillFormLogin();


function forgotPSW(){document.getElementById('proFormForgotPsw').innerHTML='<form method="post" action="" name="frmPsw" title="fornire indirizzo e-mail inserito in fase di registrazione, a cui spedire i dati di accesso al sito">e-mail <input type="Text" size=22 maxlength=70 name="emailpsw"><input type="Submit" value="spedisci dati"></form>';}


function chkVal(id)
{
	if(id.name=='userID'){
		if (id.value=='User ID'){id.value='';}
	}else if(id.name=='pswRecover'){
		var f=document.forms['frmLogin'], k=f.userID.value;
		if (k!='' && k !='User ID'){f.w2do.value='pswRecover';f.submit();
		}else{alert('Fornire userId per recuperare password...');return;
		}
	}else if (id.name =='txtProdotto'){
		if (id.value=='Ricerca'){id.value='';}
	}else if(id.name=='btnCercaProd'){
		var f=document.forms['cercaProd'], k=f.txtProdotto.value;
		if (k!='' && k !='Ricerca'){f.submit();
		}else{alert('Scrivere qualcosa da cercare tra i prodotti...');return;
		}
	}
	return;
}