// MAXLENGHT per i campi TEXTAREA --> da chiamare con: onKeyDown="javascript: textCounter(this,[nmax char],[nmax char]);" onKeyUp="javascript: textCounter(this,[nmax char],[nmax char]);"
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else 
		countfield.value = maxlimit - field.value.length;
}

// Apre url in nuove pagine
function popup(url,width,height)
{	
	var newwindow;
	var NewScreen = false;
	if( !parseInt(width) > 0 && !parseInt(height) > 0 )	{
		NewScreen = "fullscreen=yes";
	}
	else {
		NewScreen = "width=" + width + "height=" + height;
	}
	newwindow=window.open(url,'name',NewScreen);
	if (window.focus) {newwindow.focus()}
        return false; // important
}