    // For IE4+
    var ie = (document.all)?true:false;

    // For Altro
    var dom = ((document.getElementById) && (!ie))?true:false;

    function getObj(str)
    {
       if (dom) 
          return document.getElementById(str);
       if (ie) 
          return document.all[str];
    }

	
	var TextInput = new Object();

	//contenuto help che compare in alto a destra
	//č vietato utilizzare nel testo i caratteri:  "

	TextInput[0] = "Questo č un esempio di testo scorrevole tipo macchina da scrivere.";  
	TextInput[1] = "Con questa opzione si potrā comunicare all'utente una serie di messaggi."
	TextInput[2] = "I messaggi non potranno essere di lunghezza maggiore a 80 caratteri";
	TextInput[3] = "Esempio classico: La ditta rimarrā chiusa per le vacanze di natale: dal giorno 10 al giorno 20;"

	TotalTextInput = 3;

	var i = 0; 
	var TextNumber = 0;
	var HelpText="";                              
	var Text = "";  
	var Speed=100;
	var WaitSpace="           ";

	for (var addWait = 0; addWait <= TotalTextInput; addWait++) 
	{ 
      TextInput[addWait]+=WaitSpace; 
	}

	var TimerId
	var TimerSet=false;

	function startBanner (form)  
	{
	  if (!TimerSet)
	  {
	    TimerSet=true;
	    banner();
	  }
    }

    function banner() 
    {
    	Text=rollMessage();
    	TimerId = setTimeout("banner()", Speed);
    	getObj("testoScorrevole").value=Text;
    }

    function rollMessage () 
    {
    	Wait_yn=false;
    	i++;
    	var CheckSpace = HelpText.substring(i-1, i);
    	CheckSpace = "" + CheckSpace;
    	if (CheckSpace == " ") i++;
	    if (i >= HelpText.length+1) 
    	{
    		i=0; 
	    	if (TextNumber < TotalTextInput) 
		    	TextNumber++;
    		else 
	    		TextNumber = 0; 
		    initBanner();
    	}
	    Text = HelpText.substring(0, i);
    	return (Text);
    }


    function initBanner() 
    {
    	if (getObj("testoScorrevole"))
    	{
		    Text = TextInput[TextNumber];
    		HelpText = Text;
	    	startBanner ();
	    }
    }
    
    function replaceAll(str,find,rep)
    {
    	var i = str.search(find);
    	while(i>=0)
    	{
    		str = str.replace(find,rep);
    		i = str.search(find);
    	}
    	return(str);
    }

	function getGiorno(d)
	{
		var pos;
		pos = d.indexOf("-");
		if (pos == -1) pos = d.indexOf("/");
		if (pos == -1) pos = d.indexOf("\\");
		if (pos == -1) pos = d.indexOf(".");
		if (pos == -1) return -1;
		var retVal = d.substr(0, pos);
		return retVal;
	}
	
	function getMese(d)
	{
		var pos = d.indexOf("-");
		if (pos == -1) pos = d.indexOf("/");
		if (pos == -1) pos = d.indexOf("\\");
		if (pos == -1) pos = d.indexOf(".");
		if (pos == -1) return -1;
		d = d.substr(pos+1,d.length);
		pos = d.indexOf("-");
		if (pos == -1) pos = d.indexOf("/");
		if (pos == -1) pos = d.indexOf("\\");
		if (pos == -1) pos = d.indexOf(".");
		if (pos == -1) return -1;
		var retVal = d.substr(0, pos);
		return retVal;
	}
	
	function getAnno(d)
	{
		var pos = d.indexOf("-");
		if (pos == -1) pos = d.indexOf("/");
		if (pos == -1) pos = d.indexOf("\\");
		if (pos == -1) pos = d.indexOf(".");
		if (pos == -1) return -1;
		d = d.substr(pos+1,d.length);
		pos = d.indexOf("-");
		if (pos == -1) pos = d.indexOf("/");
		if (pos == -1) pos = d.indexOf("\\");
		if (pos == -1) pos = d.indexOf(".");
		if (pos == -1) return -1;
		var retVal = d.substr(pos+1,d.length);
		return retVal;
	}

	function getFomattedDate(d,l)
	{
		var convertLimitOnTwoChar = 15;
		var separator = "-";
		var comp = new Array("-", "/", ".", "\\");
		var pos = -1;
		var i = 0;
		var cl, dd, mm, yy, hhmm;

		pos = d.indexOf(" ");
		if (pos > 0) 
			hhmm = " " + d.substr(pos+1,d.length);
		else
			hhmm = "";
		
		pos = -1;
		while((pos == -1)&&(i < comp.length))
			pos = d.indexOf(comp[i++]);
		if (pos == -1) return(-1);
		if (((pos == 1) || (pos == 2)) && (d.length > 8))
			cl = "it";
		else
			cl = "uk";

		if (cl == "it")
		{
			dd = d.substr(0,pos);
			d = d.substr(pos+1,d.length);
			pos = -1;
			i = 0;
			while((pos == -1)&&(i < comp.length))
				pos = d.indexOf(comp[i++]);
			if (pos == -1) return(-1);
			mm = d.substr(0,pos);
			yy = d.substr(pos+1,d.length);
			pos = yy.indexOf(" ");
			if (pos != -1)
				yy = yy.substr(0,pos);
		}
		else
		if (cl == "uk")
		{
			yy = d.substr(0,pos);
			d = d.substr(pos+1,d.length);
			pos = -1;
			i = 0;
			while((pos == -1)&&(i < comp.length))
				pos = d.indexOf(comp[i++]);
			if (pos == -1) return(-1);
			mm = d.substr(0,pos);
			dd = d.substr(pos+1,d.length);
			pos = dd.indexOf(" ");
			if (pos != -1)
				dd = dd.substr(0,pos);
		}
		else return(d);
		if (yy.length == 2) 
		{
			if (0+yy >= convertLimitOnTwoChar)
				yy = "19"+yy;
			else
				yy = "20"+yy;
		}
		if (yy.length == 3) 
		{
			if (0+yy >= 0+("5"+convertLimitOnTwoChar))
				yy = "1"+yy;
			else
				yy = "2"+yy;
		}
		if (l == "it")
			return(dd+separator+mm+separator+yy+hhmm);
		else
		if (l == "uk")
			return(yy+separator+mm+separator+dd+hhmm);
		else return(yy+separator+mm+separator+dd+hhmm);
	}

	function contains (container, containee) 
	{
		while (containee) 
		{
			if (container == containee) 
				return true;
			containee = containee.parentNode;
		}
		return false;
	}


