function Trim(obj) { 
	return obj.replace(/\s+$|^\s+/g,""); 
} 

function getkey(e){
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}

function SoloNumeri(e, goods){
	var key, keychar;
	key = getkey(e);
	if (key == null) return true;
	
	// get character
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();
	
	// check goodkeys
	if (goods.indexOf(keychar) != -1)
		return true;
	
	// control keys
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 ) 
		return true;		
		// else return false
		return false;
}

function prendiElementoDaId(id_elemento) {
	if (document.getElementById){
		elemento = document.getElementById(id_elemento);
	} else {
		elemento = document.all[id_elemento];
	}
	return elemento;
}

function OpenPhoto(STRUrl, strTitle, Width, Height){
	window.open(STRUrl,strTitle,"width=" + Width + ", height=" + Height + ", toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no");
}