function DoDots(numero)
   {
   numero=numero.toString();
   for (i=numero.length;i>0;i-=3)
      numero=numero.substring(0,i)+"'"+numero.substr(i)
   return numero.replace(/\'+$/,"");
   }
   
   var dxpopWin='';

   function open_dxpop(url,larg,alte) {
      
      larghFinestra=larg;
      posizSinistra=screen.width-larghFinestra;
      altezFinestra=alte;
      // se la finestra è aperta la aggiorno
      if (!dxpopWin.closed && dxpopWin.location)
	{
		dxpopWin.location.href = url;
	}
	else
	{
		 dxpopWin = window.open (url, "","top=0,left="+posizSinistra +",width="+larghFinestra+",height="+altezFinestra+",scrollbars=yes,resizable=yes");
		//if (!newwindow.opener) newwindow.opener = self;
	}
     
      dxpopWin.window.focus();

  }

// la funzione sottostante serve per ridimensionare la mappa, in termini di pixel per ottimizzare la risoluzione delle schermo

					function MapSizeSelected()
				{
    				if (document.myform.MapSize.selectedIndex != 0 &&
        			document.myform.MapSize.selectedIndex !=1)
    				document.myform.submit();
				}



				function Zoom_Str(sel_str)
				{
    					if (sel_str!="")
					{
						
						document.myform.sel_str.value="'"+sel_str+"'";
						alert("Valore = "+sel_str);
    						


						//alert("suma qui e son propri stanc");
					}
				}

function _def(){var i; for (i=0; i<arguments.length; ++i){if (typeof(arguments[i])=="" || typeof(arguments[i])=="undefined") return false;}return true;}
function cbeInnerWidth(){
  var w=0;
  if (is.opera5or6){w=window.innerWidth;}
  else if (is.ie && document.documentElement && document.documentElement.clientWidth) w=document.documentElement.clientWidth; // ie6 compat mode
  else if (document.body && document.body.clientWidth) w=document.body.clientWidth; // ie4up and gecko
  else if (_def(window.innerWidth,window.innerHeight,document.height)){// nn4
    w=window.innerWidth;
    if (document.height > window.innerHeight) w -=16;
 }
  return w;
}
function cbeInnerHeight(){
  var h=0;
  if (is.opera5or6){h=window.innerHeight;}
  else if (is.ie && document.documentElement && document.documentElement.clientHeight) h=document.documentElement.clientHeight;
  else if (document.body && document.body.clientHeight) h=document.body.clientHeight;
  else if (_def(window.innerWidth,window.innerHeight,document.width)){
    h=window.innerHeight;
    if (document.width > window.innerWidth) h -=16;
 }
  return h;
}
function cbePageXOffset(){
  var offset=0;
  if (_def(window.pageXOffset)) offset=window.pageXOffset; // gecko, nn4, opera
  else if (document.documentElement && document.documentElement.scrollLeft) offset=document.documentElement.scrollLeft; // ie6 compat mode
  else if (document.body && _def(document.body.scrollLeft)) offset=document.body.scrollLeft; // ie4up
  return offset;
}
function cbePageYOffset(){
  var offset=0;
  if (_def(window.pageYOffset)) offset=window.pageYOffset;
  else if (document.documentElement && document.documentElement.scrollTop) offset=document.documentElement.scrollTop;
  else if (document.body && _def(document.body.scrollTop)) offset=document.body.scrollTop;
  return offset;
}
// cookie implementations based on code from Netscape Javascript Guide
function cbeSetCookie(name, value, expire, path) {
  document.cookie = name + "=" + escape(value) + ((!expire) ? "" : ("; expires=" + expire.toGMTString())) + "; path=/";
}
function cbeGetCookie(name) {
  var value=null, search=name+"=";
  if (document.cookie.length > 0) {
    var offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      var end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      value = unescape(document.cookie.substring(offset, end));
    }
  }
  return value;
}
function ClientSnifferJr(){
  this.ua=navigator.userAgent.toLowerCase();
  this.major=parseInt(navigator.appVersion);
  this.minor=parseFloat(navigator.appVersion);
  if (document.addEventListener && document.removeEventListener) this.dom2events=true;
  if (document.getElementById) this.dom1getbyid=true;
  if (window.opera){
    this.opera=true;
    this.opera5=(this.ua.indexOf("opera 5") !=-1 || this.ua.indexOf("opera/5") !=-1);
    this.opera6=(this.ua.indexOf("opera 6") !=-1 || this.ua.indexOf("opera/6") !=-1);
    this.opera5or6=this.opera5 || this.opera6;
    this.opera7=(this.ua.indexOf("opera 7") !=-1 || this.ua.indexOf("opera/7") !=-1);
    return;
 }
  this.konq=this.ua.indexOf('konqueror') !=-1;
  this.ie=this.ua.indexOf('msie') !=-1;
  if (this.ie){
    this.ie3=this.major < 4;
    this.ie4=(this.major==4 && this.ua.indexOf('msie 5')==-1 && this.ua.indexOf('msie 6')==-1);
    this.ie4up=this.major >=4;
    this.ie5=(this.major==4 && this.ua.indexOf('msie 5.0') !=-1);
    this.ie5up=!this.ie3 && !this.ie4;
    this.ie6=(this.major==4 && this.ua.indexOf('msie 6.0') !=-1);
    this.ie6up=(!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5")==-1);
    return;
 }
  this.hotjava=this.ua.indexOf('hotjava') !=-1;
  this.webtv=this.ua.indexOf('webtv') !=-1;
  this.aol=this.ua.indexOf('aol') !=-1;
  if (this.hotjava || this.webtv || this.aol) return;
  // Gecko, NN4, and NS6
  this.gecko=this.ua.indexOf('gecko') !=-1;
  this.nav=(this.ua.indexOf('mozilla') !=-1 && this.ua.indexOf('spoofer')==-1 && this.ua.indexOf('compatible')==-1);
  if (this.nav){
    this.nav4=this.major==4;
    this.nav4up=this.major >=4;
    this.nav5up=this.major >=5;
    this.nav6=this.major==5;
    this.nav6up=this.nav5up;
 }
}
window.is=new ClientSnifferJr();


var table=function(){
	function sorter(n){
		this.n=n; this.t; this.b; this.r; this.d; this.p; this.w; this.a=[]; this.l=0
	}
	sorter.prototype.init=function(t,f){
		this.t=document.getElementById(t);
		this.b=this.t.getElementsByTagName('tbody')[0];
		this.r=this.b.rows; var l=this.r.length;
		for(var i=0;i<l;i++){
			if(i==0){
				var c=this.r[i].cells; this.w=c.length;
				for(var x=0;x<this.w;x++){
					if(c[x].className!='nosort'){
						c[x].className='head';
						c[x].onclick=new Function(this.n+'.work(this.cellIndex)')
					}
				}
			}else{
				this.a[i-1]={}; this.l++;
			}
		}
		if(f!=null){
			var a=new Function(this.n+'.work('+f+')'); a()
		}
	}
	sorter.prototype.work=function(y){
		this.b=this.t.getElementsByTagName('tbody')[0]; this.r=this.b.rows;
		var x=this.r[0].cells[y],i;
		for(i=0;i<this.l;i++){
			this.a[i].o=i+1; var v=this.r[i+1].cells[y].firstChild;
			this.a[i].value=(v!=null)?v.nodeValue:''
		}
		for(i=0;i<this.w;i++){
			var c=this.r[0].cells[i];
			if(c.className!='nosort'){c.className='head'}
		}
		if(this.p==y){
			this.a.reverse(); x.className=(this.d)?'asc':'desc';
			this.d=(this.d)?false:true
		}else{
			this.p=y; this.a.sort(compare); x.className='asc'; this.d=false
		}
		var n=document.createElement('tbody');
		n.appendChild(this.r[0]);
		for(i=0;i<this.l;i++){
			var r=this.r[this.a[i].o-1].cloneNode(true);
			n.appendChild(r); r.className=(i%2==0)?'even':'odd'
		}
		this.t.replaceChild(n,this.b)
	}
	function compare(f,c){
		f=f.value,c=c.value;

                var strdata1=f.substring(0,10);
                var strdata2=c.substring(0,10);
                if (strdata1.replace(/ /g,'').length==10 && strdata1.substring(2,3)=='/' && strdata1.substring(5,6)=='/' && !isNaN(strdata1.substring(0,2)) && !isNaN(strdata1.substring(3,5)) && !isNaN(strdata1.substring(6,10)) &&
                    strdata2.replace(/ /g,'').length==10 && strdata2.substring(2,3)=='/' && strdata2.substring(5,6)=='/' && !isNaN(strdata2.substring(0,2)) && !isNaN(strdata2.substring(3,5)) && !isNaN(strdata2.substring(6,10))    )
                { f=strdata1.substring(6,10)+strdata1.substring(3,5)+strdata1.substring(0,2)+f.substring(10);
                  c=strdata2.substring(6,10)+strdata2.substring(3,5)+strdata2.substring(0,2)+c.substring(10);
                  return (f>c?1:(f<c?-1:0)) }

		var i=parseFloat(f.replace(/(\$|\,)/g,'')),n=parseFloat(c.replace(/(\$|\,)/g,''));
		if(!isNaN(i)&&!isNaN(n)){f=i,c=n}

		return (f>c?1:(f<c?-1:0))
	}
	return{sorter:sorter}
}();


function tutti_docfa() {
document.myform["tutti_docfa"].value="1";   		     //alert("Submit in tutti_docfa");
document.myform.submit();
}

function esporta_xml() {
document.myform["esporta_xml"].value="1";   		     //alert("Submit in tutti_docfa");
document.myform.submit();
}

function carica_dettaglio_docfa() {
document.myform["carica_dettaglio_docfa"].value="1";   		     //alert("Submit in tutti_docfa");
document.myform.submit();
}



