
$(function(){var wFrame=45;var hFrame=70;var in_array=function(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict)
for(key in haystack){if(haystack[key]===needle)
return true;}
else
for(key in haystack){if(haystack[key]==needle)
return true;}
return false;};$('a[href$=.pdf]').each(function(){var $this=$(this);var img=$this.find('img[alt$=.swf]');var ref=$this.attr('href');if(img.length!=0){var w=img.width()+wFrame;var h=img.height()+hFrame;var src=img.attr('alt');var node=$this;var tagsAllowed=['p','div'];var cicla=true;while(cicla){var father=node.parent();var kids=father.children().length;if((kids==1)&&in_array(father.get(0).tagName.toLowerCase(),tagsAllowed))
node=father;else
cicla=false;}
var container=$('<div class="zViewer"></div>').flash({swf:'http://www.medicocompetente.it/zviewer/zviewer.swf',expressInstaller:'http://www.medicocompetente.it/expressinstall/expressinstall.swf',hasVersion:'9.0.45',width:w,height:h,params:{menu:false,bgcolor:'#efefef',allowFullScreen:true},flashvars:{doc_url:src}}).append('<p class="pdf"><a href="'+ref+'">Scarica il file in formato pdf</a></p>');node.replaceWith(container);}});});