$(document).ready(function() {
   
    // voce di menu selezionata
    $("#"+currentMenu+" a").addClass("current");
    
    // prettyPhoto
    $("a[rel^='prettyPhoto']").prettyPhoto();
   
    // pngfix
    $(document).pngFix();
});



// popup windows
function calc_left (w) {
   var left = (screen.availWidth / 2) - (w / 2);
   return (left);
}
function calc_top (h) {
   var top = (screen.availHeight / 2) - (h / 2);
   return (top);
}
function popup (url, id, w, h, scrollbars) {
   var top = calc_top (h);
   var left = calc_left (w);
   popupwindow = window.open(url, id, 'width='+w+',height='+h+',scrollbars='+scrollbars+',left='+left+',top='+top+',screenX='+left+',screenY='+top);
   popupwindow.focus();
}


function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function miPiace() {
   
   if (ReadCookie('mi_piace') != 'Y') {
   
      $.ajax({ url: wwwroot+"/inc/mi_piace.ajax.php", success: function(data) {
            jAlert('Grazie per aver espresso il tuo apprezzamento!');
           $("#mi_piace a").html(data);
      }});
   
   } else {
      jAlert('Hai gi&agrave; espresso il tuo apprezzamento');
   }
}
