
	//var myError ;
	//var StateManager = EXANIMO.managers.StateManager;
	//var navigazione = new Array;
	//var principale ='centerColInside';
	function makeRequest(url,div,title){
			var log = $(div).empty().addClass('ajax-loading');
			var a = new Request.HTML({
				url:url,					 
				method: 'POST',
				evalScripts:true,
				update:div,
				onComplete: function(e) {
					log.removeClass('ajax-loading');
					
					//$(div).load=e;
					//document.getElementsByTagName('h5')[0].innerHTML = title;
					//StateManager.setState(title, site_name+' :: ' + title);
					//navigazione[title] = url+"|"+div;
					//urls = url.split('?');
					//setCookie('domanda_pg',urls[0]+'|'+div+'|'+title,0.5);
					setCookie('immobiliare_pg',url+'|'+div+'|'+title,0.5);
				}
			});
			a.send();
			
	}
	
	function makeRequestSimple(url,div,title){
			var log = $(div).empty().addClass('ajax-loading');
			var a = new Request.HTML({
				url:url,					 
				method: 'POST',
				evalScripts:true,
				update:div,
				onComplete: function(e) {
					log.removeClass('ajax-loading');
				}
			});
	a.send();
			
	}
	
	//la gestione dei movimenti nel broowser vengono fatti con i cookie con scadenza 
	
	
	function readCookie(name) { 
		//legge il cookie
		
	}
		

		
	function setCookie(sNome, sValore, iGiorni) {
	  var dtOggi = new Date()
	  var dtExpires = new Date()
	  dtExpires.setTime
		(dtOggi.getTime() + 24 * iGiorni * 3600000)
	  	document.cookie = sNome + "=" + escape(sValore) + "; expires=" + dtExpires.toGMTString();
	}

	// restituisce il valore del cookie sNome
	function getCookie(sNome) {
	  var asCookies = document.cookie.split("; ");
	  // ciclo su tutti i cookies
	  for (var iCnt = 0; iCnt < asCookies.length; iCnt++)	  {
		// leggo singolo cookie "Nome = Valore"
		var asCookie = asCookies[iCnt].split("=");
		if (sNome == asCookie[0]) { 
		  return (unescape(asCookie[1]));
		}
	  }
	  return("");
	}

// rimuove un cookie
	function delCookie(sNome) {
	  setCookie(sNome, "");
	}







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 MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- il campo '+nm+' deve contenere un indirizzo email.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- il campo '+nm+' deve contenere un numero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- il campo '+nm+' deve contenere un numero tra '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- il campo '+nm+' e\' richiesto.\n'; }
  } if (errors) alert('Sono stati rilevati errori:\n'+errors);
  document.MM_returnValue = (errors == '');
}

	function cElimina(pg,form) {
		var send='';
		var campi = window.eval("document."+form+".Sel");
		if(campi.length==undefined){
			if($('Sel').checked){
				var cRet = confirm('Vuoi eliminare i record selezionati?');
					if(cRet)
						window.location=pg+'?elimina=1&del='+$('Sel').value;
					else
						alert("Operazione annullata dall'utente");		
			}else
				alert('Rilevato errore!\nSeleziona almeno un record;');
		}else{
			send += "&del=";
			for (n=0;n<campi.length;n++){
				if(campi[n].checked==true)
					send += ","+campi[n].value;
				}
				if(send!=''){		
					var cRet = confirm('Vuoi eliminare i record selezionati?');
					if(cRet)
						window.location=pg+'?elimina=1'+send;
					else
						alert("Operazione annullata dall'utente");
							
				}else{
					if(window.eval("document."+form+".Sel.checked")==true){
						send = id+'tabella='+tag+'&elimina=1&del='+window.eval("document."+form+".Sel.value");
						window.location=pg+'?elimina=1'+send;
					}else
						alert('Rilevato errore!\nSeleziona almeno un record;');
				}
		}
	}