function openWin(pg, w, h) {
	winpopup = window.open(pg, "WinPopUp", "scrollbars=yes,menubar=no,resizable=no,location=no,status=no,top=100,left=100,width=" + w + ",height=" + h);
	winpopup.focus();
}

function trim(fld) {
	fld.value=fld.value.replace(/^\s*/,'').replace(/\s*$/,'');
}

function maxL(fld, msg, ml) {
	if (fld.value.length>ml) {
		alert(msg + " puņ essere lungo al massimo "+ml+" caratteri.\nNe hai inseriti "+fld.value.length+".");
		fld.select();
		fld.focus();
		return true;
	}
	return false;
}

function isEmpty(fld, msg) {
	var theMsg
	if (msg!='')
		theMsg = msg + " ";
	else
		theMsg = "Il campo "+fld.name+" deve essere compilato!";
	if (fld.value=='') {
		alert(theMsg);
		fld.focus();
		return true;
	}
	return false;
}

function isEmailAddr(emailAddr) {
	if (emailAddr.match(/^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/gi) == null)
		return false;
	return true;
}