var ShowLoop = 0; var ShowLoopLimit = 15; var reducePhoto = 75; var zOOmInterval =1000;
jQuery(document).ready(function(){if (!document.getElementById('bLock')){jQuery('body').prepend('<div id="bLock"><div id="bLock1"><div id="fotoBox"><div id="closer"></div><img id="fotoObj" src="" /></div></div></div>');}});
jQuery("a").live("click", function(event){if(jQuery(this).attr("href") && jQuery(this).attr("href").search(HOmeDir)===0){if(jQuery(this).attr("href").search("uploads")<=0 && jQuery(this).attr("href").search("download-monitor")<=0 && jQuery(this).attr("href").search("wp-admin")<=0){}else{if(jQuery(this).attr("href").substr(jQuery(this).attr("href").length -4) == '.pdf') {return;} if(jQuery(this).attr("href").search("uploads")>0){zOOm(jQuery(this).attr("href"));event.preventDefault();}else{jQuery(this).attr("target", "_blank");}}}});
function bLock(){
    // nascondo l'oggetto flash
    jQuery("#flashcontent").css("display", "none");
    jQuery(".flashBox").css("display", "none");jQuery("#bLock").fadeIn(speed,function(){jQuery("#bLock1").fadeIn(speed);});}
function MostraFoto(fOtO){jQuery("#fotoObj").removeAttr("width");jQuery("#fotoObj").removeAttr("height");if(navigator.userAgent.indexOf("MSIE")<0){var NewWidth = jQuery("#fotoObj").attr("width");var NewHeight = jQuery("#fotoObj").attr("height");}else{jQuery("#fotoObj").attr("src",fOtO);jQuery('#fotoBox').css('display','block');var NewWidth = jQuery("#fotoObj").attr("width");var NewHeight = jQuery("#fotoObj").attr("height");jQuery('#fotoBox').css('display','none');}if (NewWidth<=0 || NewHeight<=0){if (ShowLoop<=ShowLoopLimit){ShowLoop++;window.setTimeout("MostraFoto('"+fOtO+"');", 500);return;}else{ShowLoop = 0;}}var rApporto = 1;if(jQuery(window).width()<=jQuery("#fotoObj").attr("width")){var rApporto = Math.round(((jQuery(window).width()-reducePhoto) / jQuery("#fotoObj").attr("width"))*100)/100;}if (jQuery(window).height()<=jQuery("#fotoObj").attr("height")){var rApporto = Math.round(((jQuery(window).height()-reducePhoto) / jQuery("#fotoObj").attr("height"))*100)/100;}NewWidth = Math.round(NewWidth*rApporto);NewHeight = Math.round(NewHeight*rApporto);jQuery("#fotoObj").attr("width", NewWidth);jQuery("#fotoObj").attr("height", NewHeight);var tOp = Math.abs((jQuery(window).height()-NewHeight)/2);var lEft = Math.round((jQuery(window).width()-NewWidth)/2);jQuery('#fotoBox').css('width', NewWidth);jQuery('#fotoBox').css('height', NewHeight);jQuery('#fotoBox').css('left', lEft);jQuery('#fotoBox').css('top', tOp);jQuery('#fotoBox').fadeIn(speed);}
function uNLock(){
    jQuery('#fotoBox').fadeOut(speed, function(){jQuery("#bLock1").fadeOut(speed,function(){jQuery("#bLock").fadeOut(speed);});});
    jQuery("#flashcontent").css("display", "block");

}
function zOOm(fOtO){bLock();jQuery("#fotoObj").removeAttr("src");jQuery("#fotoObj").attr("src", fOtO);window.setTimeout("MostraFoto('"+fOtO+"');", zOOmInterval);}

