// JavaScript Document
function getById(name){
    if (document.getElementById) return document.getElementById(name);  // Mozilla, Safari, W3C

    else if (document.all) return document.all[name];                   // Internet Explorer
    else if (document.layers) return document.layers[name];             // Netscape 4
    return null;
} 

function tagliaStringa(stringa, max_char){
		if(strlen(stringa)>max_char){
			stringa_tagliata=substr(stringa, 0,max_char);
			last_space=strrpos(stringa_tagliata," ");
			stringa_ok=substr(stringa_tagliata, 0,last_space);
			return stringa_ok + "...";
		}else{
			return stringa;
		}
	}
	
	


var win = null;
function NewWindow(mypage, w, h) {
	LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable';
	win = window.open(mypage,'',settings)
	if(win.window.focus) {
		win.window.focus();
	}
}


function IsNumeric(strString)
   //  check for valid numeric strings 
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
/*
function intercetta() {
    for (var i=0; i<document.links.length; i++){
        if ((document.links[i].className=="leggi_tutto")||(document.links[i].className=="apri_popup")||(document.links[i].className=="story")) {
			document.links[i].onclick=function (){ MM_openBrWindow(this.href,'vedi','width=620,height=520');return false;};
			document.links[i].onkeypress=function (){ MM_openBrWindow(this.href,'vedi','width=620,height=520');return false;};
        }
	}
}
*/
//----------




