$(function()
{
  $('h1').click(function(){document.location='/';});

  $('#qRicerca').autocomplete('/index.php?a=ajax&f=acricerca',{delay: 200, max: 100, formatItem: function(row){return row[1];}}).result(function(event, data, formatted) {if(data[0]!=''){document.location='/previsioni/'+data[0]+'/';}});

  if($('body').attr('className')=='home' || $('body').attr('className')=='regione' || $('body').attr('className')=='provincia')
  {
    var maxH=0;
    $('a.boxPrevisione span.dove').each(function(){if($(this).height()>maxH){maxH=$(this).height();}}).css('height',maxH+'px');
    maxH=0;
    $('a.boxPrevisione span.testo').each(function(){if($(this).height()>maxH){maxH=$(this).height();}}).css('height',maxH+'px');
  }
  else if($('body').attr('className')=='comune')
  {
    var maxW=0;
    $('div.comuni a').each(function(){if($(this).width()>maxW){maxW=$(this).width();}}).css('width',maxW+'px');
    $('div.comuni h2').click(function(){$('div.comuni a').css('display','block');});
  }
});

