
// newsletter.php
function setNL() {
	if (document.frmNL.emailNL.value=="")
		alert("Inserire la propria email")
	else if (!document.frmNL.dlg.checked)
		alert("Per iscriversi occorre acconsentire al trattamento dei dati");
	else {
		document.frmNL.action="index.php?act=innl";
		document.frmNL.submit();
	}
}

// blog.php
function setPost(idpr) {
	if (trim(document.frmPost.nomebl.value) == "")
		alert("Inserire il nome");
	else if (trim(document.frmPost.titolobl.value) == "")
		alert("Inserire il titolo");
	else if (trim(document.frmPost.messaggiobl.value) == "")
		alert("Inserire il messaggio!");
	else if (trim(document.frmPost.emailbl.value) == "")
		alert("Inserire l\'email");
	else if (trim(document.frmPost.codicebl.value) == "")
		alert("Inserire il codice di sicurezza");
	else {
		if (idpr > 0)
			document.frmPost.action = "index.php?page=blog.php&act=npt&idpr="+idpr;
		else
			document.frmPost.action = "index.php?page=blog.php&act=npt";
		document.frmPost.submit();
	}
}

//mk_video.php
function newVd() {
	alert("qui");
	if (document.frmVD.nome.value == "")
		alert("Inserire il titolo");
	else if (document.frmVD.descrizione.value == "")
		alert("Inserire la descrizione");
	else if (document.frmVD.videolink.value == "")
		alert("Inserire il videolink");
	else {
		document.frmVD.action = "adm.php?page=mk_video.php&act=new";
		document.frmVD.submit();
	}
}

// funzioni generali
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function ricerca() {
	if (document.frmSrc.search.value == "")
		alert("Inserire la chiave di ricerca");
	else {
		document.frmSrc.action="index.php?act=src";
		document.frmSrc.submit();
	}
}

function aggiorna() {
	var data1=document.frmArc.data.value;
	document.frmArc.action="index.php?page=archivio.php&more="+data1;
	document.frmArc.submit();
}
