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)
{
	window.open('./foto.php?id='+param,'Foto','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));
//	alert("charCode "+ charCode);
//    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
    if (charCode > 31 && charCode != 44 && charCode != 46 && (charCode < 48 || charCode > 57)) {
        alert("Puoi inserire solo numeri o virgola per separate i decimali!");
	//	document.GetElementByName("mq").focus();
        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;
		}
}

function SelectFilter (theKind, theSelect, source, theSelIndex)
{
	if (source)
	{
		if (theSelIndex == '')	theSelIndex = 0;
		theModList = (document.getElementById(theKind + 'data').value).match (new RegExp ('#' + source + '[^#]*'));
		
		if (theModList)
		{
			theModItems = theModList[0].split ('|');
			for ( theIndex = 1; theIndex < theModItems.length -1; theIndex++) 
			{
				document.formpre.um.value=theModItems[theIndex];				
			}
		}
	}
}
