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}|biz|cat|com|edu|int|org|net|gov|mil|pro|aero|asia|coop|info|jobs|mobi|name|nato|post|museum|travel)$/gi) == null)
		return false;
	return true;
}

function changeLang(l, a) {
	if (l != '' && a != '') {
		var frm = document.frmChgLng;
		frm.lang.value = l;
		frm.action = a;
		frm.submit();
	}
}
