// JavaScript Document
function colore1(class1,class2)
{
	document.getElementById("testo_news").className = class1;
	attesa = window.setTimeout("colore2('"+class1+"','"+class2+"')",500);
}

function colore2(class1,class2)
{
	document.getElementById("testo_news").className = class2;
	attesa = window.setTimeout("colore1('"+class1+"','"+class2+"')",500)
}
function avvia(class1,class2)
{
	attesa = window.setTimeout("colore1('"+class1+"','"+class2+"')",500);
}
function view(param)
{
	window.open('./view.php?id='+param,'Annuncio','scrollbars=yes,resizable=no,width=500,height=450,status=no,location=no,toolbar=no');
}
function foto(param,num)
{
	window.open('foto.php?foto='+param,'Foto'+num,'scrollbars=yes,resizable=no,width=500,height=450,status=no,location=no,toolbar=no');
}
function foto_admin(param)
{
	window.open('/foto.php?id='+param,'Foto','scrollbars=yes,resizable=no,width=500,height=450,status=no,location=no,toolbar=no');
}

function lettersOnly(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 65 || charCode > 90) && 
        (charCode < 97 || charCode > 122)) {
        alert("Puoi inserire solo lettere!");
        return false;
    }
    return true;
}

function numeralsOnly(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        alert("Puoi inserire solo numeri!");
        return false;
    }
    return true;
}


// richiamata per verificare che abbia immesso i dati nel form codice cliente di cash.php per completare l'ordine
function cod_validate(form)
{
	if (form.cod_utente.value.length == 0)
		{
			alert('Nessun codice inserito!');
			return false;
		}
}

// richiamata per verificare che abbia immesso i dati nel form
function valid(form)
{

	titolo = form.titolo.value;
	testo_ann = form.testo_ann.value;
	
	if (titolo == '' || testo_ann=='')
		{
			alert('Attenzione, dati mancanti nella compilazione!');
			return false;
		}
}
// richiamata per verificare che abbia immesso i dati nel form
function valid2(form)
{

	tipo_ann = form.tipo_ann.value;
	
	if (tipo_ann=='')
		{
			alert('Attenzione, dati mancanti nella compilazione!');
			return false;
		}
}
// richiamata per verificare che abbia immesso i dati nel form
function valid3(form)
{

	nome = form.nome.value;
	msg = form.msg.value;
	email = form.email.value;
	
	if (nome=='' || msg=='' || email =='')
		{
			alert('Attenzione, dati mancanti nella compilazione!');
			return false;
		}
}