<!--
  function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  } 
  function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  }
// -->

<!--
function RollOver(strImgName, strPageImg) {
		this.strImgOff = strImgName + "_0.gif";
		this.strImgOn = strImgName + "_1.gif";
		this.objPageImg = null;
		this.strPageImg = strPageImg;
		this.objImgOn = new Image();
		this.objImgOff = new Image();
		this.rollOn = rollOn;
		this.rollOff = rollOff;
		this.objImgOn.src = this.strImgOn;
		this.objImgOff.src = this.strImgOff;
	}
	function rollOn() {
	   if (this.objPageImg != null) this.objPageImg.src = this.objImgOn.src;
	   else if ((this.objPageImg = eval("document.images." + this.strPageImg)) != null) this.objPageImg.src = this.objImgOn.src;
	}
	function rollOff() {
	   if (this.objPageImg != null) this.objPageImg.src = this.objImgOff.src;
	   else if ((this.objPageImg = eval("document.images." + this.strPageImg)) != null) this.objPageImg.src = this.objImgOff.src;
	}
	
	
	// create rollover buttons, for header...
	roHome = new RollOver("../images/home_up", "home");
	roEmail = new RollOver("../images/email", "email");
	roLalipu = new RollOver("../images/lalipu_up", "lalipu");
	roSostienici = new RollOver("../images/sostie_up", "sostienici");
	roEventi = new RollOver("../images/eventi_up", "eventi");
	roOasi = new RollOver("../images/oasi_up", "oasi");
	roSedi = new RollOver("../images/sedi_up", "sedi");
	
	roProgetti = new RollOver("../images/prog", "progetti");
	roStrategie = new RollOver("../images/strat", "strategie");
	roAntibracconaggio = new RollOver("../images/anti", "antibracconaggio");
	roAnimferiti = new RollOver("../images/anim", "animferiti");
	roBirdwatching = new RollOver("../images/bird", "birdwatching");
	roAgricoltura = new RollOver("../images/agri", "agricoltura");
	roEducazione = new RollOver("../images/educ", "educazione");
	roCampi = new RollOver("../images/campi", "campi");
	roVolontariato = new RollOver("../images/volon", "volontariato");
	roCaccia = new RollOver("../images/caccia", "caccia");
	roEmporio = new RollOver("../images/empo", "emporio");

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function Jump(list) {
	if (list.options[list.selectedIndex].value == ''){
	}
	else{
		window.top.location.href = list.options[list.selectedIndex].value
		}
}//modifiche rbessone per carrello/emporio	//funzione per formattare il prezzo
	function formattaPrezzo(thisone){
		var wd
		wd="w"
		var tempnum=thisone
			for (i=0;i<tempnum.length;i++){
				if (tempnum.charAt(i)=="."){
					wd="d"
					break
				}
			}
			if (wd=="w")
				return tempnum+".00"
			else{
				if (tempnum.charAt(tempnum.length-2)=="."){
					return tempnum+"0"
				}
				
				else{
					tempnum=Math.round(tempnum*100)/100
					return tempnum
				}
			}
	}		//funzione per controllare il campo vuoto
	function campoVuoto(campo,messaggio)
	{
		if(campo.value.trim() == ''){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare il valore con una regexp
	function campoRegExp(campo,exp,messaggio)
	{
		var reg = exp
		if(!reg.test(campo.value)){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare la selezione di una combo box
	function selectVuoto(campo,messaggio)
	{
		if(campo.value == "0"){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare la lunghezza di una textarea
	function maxChars(ogg,maxchars)
	{
		if (ogg.value.length > maxchars){
		  ogg.value=ogg.value.substr(0,maxchars);
		}
	}			/*function : format_number()  
	version: 1.0.0  
	This function formats a numeric value passed in to it with specified number of  
	decimal values. numeric value will not be rounded.  
	pnumber : numeric value to be formatted.  
	decimals : number of decimal points desired.  

	Author: Buddhike de Silva  
	Date: 21-Nov-2002 11:16 AM*/  

	/*  
	revision: 1.1.0  
	Author: M. Cassim Farook  
	Date: 21-Nov-2002 10:16 PM  
	Notes: No offense buddhike...but i had to rewrite the code  
	works for ADT (any dam thing)  
	usage: x = format_number(123.999, 2)  
	*/  

	/*  
	revision: 1.2.0  
	Authors: Buddhike de Silva  
	Date: 22-Nov-2002 12:07 PM  
	Notes: Optimized for best performence.  
	usage: x = format_number(123.999, 2)  
	*/  

	/* 
	 * Revision: 1.3 
	 * Author: Mike Robb (JS-X.com) 
	 * Date: May 26, 2003 
	 * Notes:  Changed to deal with negative numbers. 
	 *         Fixed length of final answer. 
	 *         Work-around for javascript internal math problem with rounding negative numbers. 
	 */ 

	/*
	 * Revision 1.4
	 * Author: LeAnn Roberts
	 * Date: September, 2003
	 * Note: Modified the if logic: Math.pow()
	 */

	/*
	 * Revision 1.5
	 * Author: Robert Heggdal
	 * Date: February, 2004
	 * Note: Modified check for negative number by replacing parseInt with parseFloat so that negative numbers between zero and minus one are recognized as such.
	 */ 

	/*
	 * Revision 1.6
	 * Author: Naveen
	 * Date: February, 2004
	 * Note: Rewrote format_number to correct a logic problem.
	 */

	/*
	 * Revision 1.7
	 * Author: JS-X.com
	 * Date: February, 2004
	 * Note: Added wrapper around format_number as negative values were dropped from
	 *       the logic.
	 */

	function format_number(p,d) 
	{
	  var r;
	  if(p<0){p=-p;r=format_number2(p,d);r="-"+r;}
	  else   {r=format_number2(p,d);}
	  return r;
	}
	function format_number2(pnumber,decimals) 
	{
	  var strNumber = new String(pnumber);
	  var arrParts = strNumber.split('.');
	  var intWholePart = parseInt(arrParts[0],10);
	  var strResult = '';
	  if (isNaN(intWholePart))
	    intWholePart = '0';
	  if(arrParts.length > 1)
	  {
	    var decDecimalPart = new String(arrParts[1]);
	    var i = 0;
	    var intZeroCount = 0;
	     while ( i < String(arrParts[1]).length )
	     {
	       if( parseInt(String(arrParts[1]).charAt(i),10) == 0 )
	       {
	         intZeroCount += 1;
	         i += 1;
	       }
	       else
	         break;
	    }
	    decDecimalPart = parseInt(decDecimalPart,10)/Math.pow(10,parseInt(decDecimalPart.length-decimals-1)); 
	    Math.round(decDecimalPart); 
	    decDecimalPart = parseInt(decDecimalPart)/10; 
	    decDecimalPart = Math.round(decDecimalPart); 

	    //If the number was rounded up from 9 to 10, and it was for 1 'decimal' 
	    //then we need to add 1 to the 'intWholePart' and set the decDecimalPart to 0. 

	    if(decDecimalPart==Math.pow(10, parseInt(decimals)))
	    { 
	      intWholePart+=1; 
	      decDecimalPart="0"; 
	    } 
	    var stringOfZeros = new String('');
	    i=0;
	    if( decDecimalPart > 0 )
	    {
	      while( i < intZeroCount)
	      {
	        stringOfZeros += '0';
	        i += 1;
	      }
	    }
	    decDecimalPart = String(intWholePart) + "." + stringOfZeros + String(decDecimalPart); 
	    var dot = decDecimalPart.indexOf('.');
	    if(dot == -1)
	    {
	      decDecimalPart += '.'; 
	      dot = decDecimalPart.indexOf('.'); 
	    } 
	    var l=parseInt(dot)+parseInt(decimals); 
	    while(decDecimalPart.length <= l) 
	    {
	      decDecimalPart += '0'; 
	    }
	    strResult = decDecimalPart;
	  }
	  else
	  {
	    var dot; 
	    var decDecimalPart = new String(intWholePart); 

	    decDecimalPart += '.'; 
	    dot = decDecimalPart.indexOf('.'); 
	    var l=parseInt(dot)+parseInt(decimals); 
	    while(decDecimalPart.length <= l) 
	    {
	      decDecimalPart += '0'; 
	    }
	    strResult = decDecimalPart;
	  }
	  return strResult;
	}
		
	//trim di stringhe
	function stringTrim() 
	{
		return this.replace(/^\s+/, '').replace(/\s+$/, '');
	}
	
	String.prototype.trim = stringTrim;
