			checkNav()
			function checkNav(){
				setNav();
				if (document.getElementById('pagina')){
					var pag= document.getElementById('pagina').value;
				}

				if (document.getElementById('zona')){
					//var zona=document.getElementById('zona').value;
					//alert("checknav "+pag+"  o="+ord+" z="+zona+" s="+sot);
					if ((zona!='' && zona.toString()!='undefined') || (sot!='' && sot.toString()!='undefined' )){
						if (zona=='NO'){ zona='TO';}
						if (zona.toString()=='undefined'){ zona='';}
						if (zona=='' && sot!='' && sot.toString()!='undefined'){ zona='TO';}
						document.getElementById('zona').value=zona;
					} else {
						document.getElementById('zona').selectedIndex = 0;
						zona='';
					}
					if (zona=="TO" || zona=='NO' || (zona=='' && sot!='' )){
						document.getElementById('filtrosotzona').style.display="block"
					} else {
						document.getElementById('filtrosotzona').style.display="none"
					}

					//var ord=document.getElementById('ordinam').value;
					try{
						if (ord!='' && ord.toString()!="undefined" ){
							document.getElementById('ordinam').value=ord;
						}else {
							document.getElementById('ordinam').selectedIndex = 0;
							ord=''
						}
					}catch(e){
						ord='';
					}
					try{
						if (can!='' && can.toString()!="undefined" ){
							document.getElementById('cantieri').value=can;
						}else {
							document.getElementById('cantieri').selectedIndex = 0;
							can=''
						}
					}catch(e){
						can='';
					}

					//var sot=document.getElementById('sotzona').value;
					if (sot!='' && sot.toString()!="undefined" ){
						document.getElementById('sotzona').value=sot;
					} else {
						document.getElementById('sotzona').selectedIndex = 0;
						sot=''
					}
					//alert(pag+"xxx  o="+ord+" z="+zona+" s="+sot)
					if ((pag!="" && pag!=undefined) || ((pag=="" || pag==undefined) && (zona!='' || sot!='' || ord!='' || can!=''))){
						var offset
						if (pag!="" && pag!=1 ){
							offset= (pag-1) * 7
						} else if (pag==1){
							offset=0
						} else {
							offset=0
							pag=''
						}
						if (pag.toString()=="undefined"){
							offset=0
							pag=''
						}
						/*if (isNaN(offset)){
							offset=0
							pag=''
						}*/
						//alert(pag+"ssss c="+contratto+" t="+typ+" t="+tip+" o="+ord+" z="+zona+" s="+sot);
						navImmob(pag,offset,contratto,typ,tip,ord,zona,sot,can);
					}
				}


			}
			function setNav(){
				if (getCookie('c_pag') || getCookie('c_zon') || getCookie('c_sot') || getCookie('c_ord') || getCookie('c_can')){
					pag= getCookie('c_pag')
					zona= getCookie('c_zon')
					sot= getCookie('c_sot')
					ord= getCookie('c_ord')
					can= getCookie('c_can')
				} else {
					/*pag= '<?=$_REQUEST['xpagina'];?>'
					zona= '<?=$_REQUEST['xzona'];?>'
					sot= '<?=$_REQUEST['xsotzona'];?>'
					ord= '<?=$_REQUEST['xordinam'];?>'
					can= '<?=$_REQUEST['xcantieri'];?>'*/
				}

				if (pag!=''){
					document.getElementById('pagina').value=pag;
				}

			}

			function cleanCookie(){
			//pulizia dei cookie per la navigazione
      setCookie('c_zon', '', 1)
    	setCookie('c_ord', '', 1)
    	setCookie('c_sot', '', 1)
    	setCookie('c_pag', '', 1)
    	setCookie('c_can', '', 1)
      }

			function rollimgover(idx){
				document.getElementById(idx).style.display='block';
				//document.getElementById('fotoimg'+idx).style.visibility='hidden';
			}

			function rollimgout(idx){
				document.getElementById(idx).style.display='none';
				//document.getElementById('fotoimg'+idx).style.visibility='visible';
			}
