function setFontSize(link){	
        if(document.getElementById('stile').href.indexOf('css/stile.css')!=-1){
	    document.getElementById('stile').href="css/stileBig.css";
	    link.innerHTML='diminuisci carattere';
	    document.getElementById('fontImg').src='img/riduci.gif';
	    setCookie('stile','css/stileBig.css');	 
	}else{
	    document.getElementById('stile').href="css/stile.css";
	    link.innerHTML='ingrandisci carattere';
	    document.getElementById('fontImg').src='img/ingrandisci.gif'; 
	    setCookie('stile','css/stile.css');
	}	  	
}
function loadFontSize(link){
	if(getCookie('stile')!=null){
		if(getCookie('stile')==('css/stile.css')){
		    document.getElementById('stile').href="css/stile.css";
		    if(link!=null){
			link.innerHTML='ingrandisci carattere';
		    	document.getElementById('fontImg').src='img/ingrandisci.gif'; 
                    }
		    setCookie('stile','css/stile.css');	 
		}else{
		    document.getElementById('stile').href="css/stileBig.css";
		    if(link!=null){
		    	link.innerHTML='diminuisci carattere';
		        document.getElementById('fontImg').src='img/riduci.gif';
                    }
		    setCookie('stile','css/stileBig.css');
		}	
	}		
}
function getCookie(name) { 
    var sPos = document.cookie.indexOf(name + "="); 
    var len = sPos + name.length + 1;
    if((!sPos) && (name != document.cookie.substring(0, name.length))){
        return null; 
    } 
    if(sPos == -1){ 
        return null; 
    } 
    var ePos = document.cookie.indexOf(';', len); 
    if(ePos == -1) ePos = document.cookie.length; 
    return unescape(document.cookie.substring(len, ePos)); 
} 

function setCookie(name, value){ 
    document.cookie = name+'='+escape(value);
} 

function testFields(form){
  sub=false;
  for(t=0;t<form.elements.length;t++) {
     if(form.elements[t].type=="select-one"){
	 if(form.elements[t].selectedIndex!=0){
	    sub=true;
	 }
     }else if(form.elements[t].type=="text"){
         if(trim(form.elements[t].value)!=''){
             sub=true;
         }    
     }
  }
  if(sub){
    form.submit();
  }else{
    alert('Impostare almeno un parametro di ricerca');
  }
}
function trim(wstr) {	
	
	if (wstr==null) return null;
	if (wstr=="") return "";
	var vuoto = true;
	wstr+=" ";
	for (var i=wstr.length-1;i+1;i--)
		if (wstr.substring(i,i+1)!=" ") {
			vuoto = false;
			break;
		}
	if (vuoto) return "";
	else return wstr.substring(0,i+1);
}
function printPage(div_toprint){
 if(document.getElementById(div_toprint).style!=null && document.getElementById(div_toprint).style.backgroundImage!=null && document.getElementById(div_toprint).style.backgroundImage!=''){
     document.getElementById('toPrintArea_style').value='style="background: '+document.getElementById(div_toprint).style.backgroundImage+' no-repeat top left;background-position:6px 25px;"';
 }
 document.getElementById('toPrintArea').value=document.getElementById(div_toprint).innerHTML;
 openPrint();
}
function openPrint(){
    window.open('','printer');
    document.printForm.target="printer";
    document.printForm.submit();
    return false;
}