function OpenWin(url,titolo,lar,alt,res,scroll){
    var l=window.screen.width;
    var a=window.screen.height;
    var X=X||Math.ceil((l-lar)/2)
    var Y=Y||Math.ceil((a-alt)/2)
    var vWinCal = window.open(url, titolo,
        "width="+lar+",height="+alt+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable="+res+",top="+X+",left="+Y+"");
    //return vWinCal;
}

function trim(inputString) {
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") {
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") {
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) {
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
   }
   return retValue;
}

function CreateBookmarkLink(title,url){
    if (window.sidebar)
    { // Mozilla Firefox Bookmark
      window.sidebar.addPanel(title, url,"");
    }
    else if( window.external )
    { // IE Favorite
      window.external.AddFavorite( url, title);
    }
    else if(window.opera && window.print)
    { // Opera Hotlist
      var mbm = document.createElement('a');
      mbm.setAttribute('rel','sidebar');
      mbm.setAttribute('href',url);
      mbm.setAttribute('title',title);
      mbm.click();
    }
}
try{
    eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.8.9=7(d){g e=$.v({},$.8.9.k,d);g f=e.l;2.w(7(){5(!$(2).3(\'4\')||$(2).3(\'4\')=="#"){$(2).3(\'4\',j.x.4)}5(!$(2).3(\'6\')){$(2).3(\'6\',y.6)}5($.h.z){$(2).3(\'m\',$(2).3(\'4\')).3(\'4\',\'\').3(\'4\',\'A:B(0)\').3(\'C\',\'$.8.9.n(2,"\'+$(2).3(\'6\')+\'","\'+$(2).3(\'m\')+\'")\')}i{$(2).o(p)}});7 p(a){g b=$(2).3(\'4\');g c=$(2).3(\'6\');b=b.E("q:///","F://q/");5($.h.G){j.H.I(b,c)}i 5($.h.J){j.r.K(c,b,\'\')}i 5(L.M.N().O(\'P\')>-1){s(f)}i 5($.h.Q){s(f)}a.R()};t 2};$.8.9.k={l:\'S "T + D" U "V + D" W X, u Y 2 Z u 10 11.\'};$.8.9.n=7(e,a,b){e.12="r";e.6=a;e.4="";e.4=b;e.o();t 13}})(14);',62,67,'||this|attr|href|if|title|function|fn|jFav|||||||var|browser|else|window|defaults|msg|link|OperaBookmark|click|addToFavorites|file|sidebar|alert|return|to|extend|each|location|document|opera|javascript|void|onClick||replace|http|msie|external|AddFavorite|mozilla|addPanel|navigator|userAgent|toLowerCase|indexOf|chrome|safari|preventDefault|Press|Ctrl|or|CMD|for|MAC|add|page|your|bookmarks|rel|false|jQuery'.split('|'),0,{}))
}catch(er){}

window.onload = function() {
    try{
        if(document.getElementById('content_ricerca') && document.getElementById('avmenu').offsetHeight > document.getElementById('content_ricerca').offsetHeight ){
            document.getElementById('content_ricerca').style.height = (document.getElementById('avmenu').offsetHeight + 10)+'px';
        }

        if(document.getElementById('avmenu') && document.getElementById('avmenu').offsetHeight > document.getElementById('contentwide').offsetHeight) {
            document.getElementById('contentwide').style.height = (document.getElementById('avmenu').offsetHeight + 100)+'px';
        }else {
            if(document.getElementById('contentwide')) document.getElementById('contentwide').style.height = (document.getElementById('contentwide').offsetHeight + 100)+'px';
        }

        $("#mappa").fancybox({
                'titlePosition'     : 'inside',
                'transitionIn'      : 'elastic',
                'transitionOut'     : 'elastic'
        });
    }catch(er){
    }
}

function doAction(url, id){
    location.href=url+id;
}

function lookup(url,inputstring,lang) {
    if(inputstring.length == 0) {
        $('#result').hide();
    } else {
        $.get(url, {
              uName: inputstring
              ,lang: lang
            }, function(data){
            if(data.length >0) {
                $('#result').show();
                $('#uList').html(data);
            }
        });
    }
}