// JavaScript Document

	function controls(lg){
		var ok=true;
		var al="";
		if (lg==1){al="Immettere un dato per la ricerca"};
		if (lg==2){al="Enter a key word to search for"};
		if (lg==3){al="écrivez une ou plus mots pour rechercher"};
		if(document.search.fieldSearch.value.length==0){
			alert(al);
			ok=false;
		}
		if(ok){
			document.search.action="search.asp";
			document.search.submit();
		}
	}
	function viewGlox(strVoce){
			glox=window.open("glossario.html",'Glossario','width=600,height=450,scrollbars=yes');
			eval('glox.location.href="glossario.html' + strVoce + '"');
	}
	function openWinImg(theURL,winName,features) { 
  		winImg=window.open(theURL,winName,features);
	}
	
	function openPop(theURL,winName,features) { 
  		winPop=window.open(theURL,winName,features);
	}
	
	function openNews(newID){
			strURLCV='showNew.asp?newID=' + newID;
			res=window.open(strURLCV,'News','width=600,height=560,scrollbars=yes');
			
	}

	function openPopTab(theURL) { 
  		PopTab=window.open(theURL,'','width=600,height=230,scrollbars=yes');
	}

              function openPopTaba(theURL) { 
  		PopTab=window.open(theURL,'','width=600,height=600,scrollbars=yes');
	}

function aprinews(abc){
		var Finestra;
	    	x=(screen.width-550)/2;
	    	y=((screen.height-400)/2);
	   	Finestra=window.open(abc,"News","toolbars=0, menubar=0, width=550, height=400, scrollbars=1,top="+y+",left="+x+";");  
	   	Finestra.focus();
}

function imager(myimg){

    //DA SETTARE!!!!!!!
    var nomecartellaimg="img/foto";
    var prefisso="_z.jpg";
    //FINE SETTAGGIO

    var t=myimg.src;

    var lunghezzacartella=nomecartellaimg.length+1;
    var stringa=t.replace(".jpg",prefisso);
    stringa=stringa.replace(".gif","_z.gif");

    
if(myimg.descrizione==undefined) apri(stringa,"");
   else apri(stringa,myimg.descrizione);
} 



function imagerXXX(myimg){
    
    //DA SETTARE!!!!!!!
    var nomecartellaimg="img/foto";
    var prefisso="_z";
    //FINE SETTAGGIO
    
    var lunghezzacartella=nomecartellaimg.length+1;
    var stringa=myimg.src;
    //alert(stringa);
    var i=stringa.length;
    i--;    
var    z=0;
    var stringa2="";
    do {
        stringa2=stringa2 + stringa.substr(i,1);
        i--;
        if((stringa.substr(i,1)=='/')&&(z==0)) {
                                                stringa2=stringa2 + prefisso; 
                                                z++;
                                               }
       // alert(stringa.substr(i,lunghezzacartella) + " ?=? " + "/"+nomecartellaimg);
       }     
    while (stringa.substr(i,lunghezzacartella)!="/"+nomecartellaimg);
    stringa="";
    for(i=stringa2.length; i>-1; i--){    
       stringa=stringa + stringa2.substr(i,1);}
if(myimg.descrizione==undefined) apri(stringa,"");
   else apri(stringa,myimg.descrizione);
} 

function apri(cosa,descr){
    //  alert(cosa);
      
      window.open('about:blank','','toolbar=no,scrollbar=yes,resizable=no,width=1,height=1,align=center;').document.write('<html><head><title>ASL 2 savonese</title><script language=javascript>function resizeWin(thisimg){w=thisimg.width;h=thisimg.height;window.resizeTo(w+80, h+180);}</script></head><body bgcolor=#e15e90 scroll=no onLoad=resizeWin()><table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td align=center><br><img style="border: solid 0px #e15e90;" src='+cosa+' onload="javascript:resizeWin(this)"><br><font face=verdana size=1 color=#ffffff><br>'+descr+'<br><br><a style="color:FFFFFF; font weight:bold;" href=javascript:window.close()>CHIUDI</a></font></td></tr></table></body></html>');
      
    }

function setOrderBy(o)
	{
	 var obj = document.Reload;
	 obj.orderBy.value = o;
	 if (obj.Verso.value==" ASC")
	    {
	     obj.Verso.value=" DESC";
	    }
	 else
	    {
	     obj.Verso.value=" ASC";
	    }
	 obj.submit();
	}
