var thumbnailviewer={enableTitle:true,enableAnimation:true,definefooter:'<div class="footerbar">CHIUDI X</div>',defineLoading:'<img src="loading.gif" /> Sto caricando...',scrollbarwidth:16,opacitystring:"filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1",targetlinks:[],createthumbBox:function(){document.write('<div id="thumbBox" onClick="thumbnailviewer.closeit()"><div id="thumbImage"></div>'+this.definefooter+"</div>");document.write('<div id="thumbLoading">'+this.defineLoading+"</div>");this.thumbBox=document.getElementById("thumbBox");this.thumbImage=document.getElementById("thumbImage");this.thumbLoading=document.getElementById("thumbLoading");this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body},centerDiv:function(c){var b=document.all&&!window.opera;var d=document.getElementById;var f=(b)?this.standardbody.scrollTop:window.pageYOffset;var e=(b)?this.standardbody.scrollLeft:window.pageXOffset;var g=(b)?this.standardbody.clientWidth:window.innerWidth-this.scrollbarwidth;var k=(b)?this.standardbody.clientHeight:window.innerHeight;var h=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)?this.standardbody.offsetHeight:this.standardbody.scrollHeight;var j=c.offsetWidth;var i=c.offsetHeight;var a=(k>i)?f+k/2-i/2+"px":f+10+"px";c.style.left=g/2-j/2+"px";c.style.top=Math.floor(parseInt(a))+"px";c.style.visibility="visible"},showthumbBox:function(){this.centerDiv(this.thumbBox);if(this.enableAnimation){this.currentopacity=0.1;this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()",20)}},loadimage:function(b){if(this.thumbBox.style.visibility=="visible"){this.closeit()}var a='<img src="'+b.getAttribute("href")+'" style="'+this.opacitystring+'" />';if(this.enableTitle&&b.getAttribute("title")){a+="<br />"+b.getAttribute("title")}this.centerDiv(this.thumbLoading);this.thumbImage.innerHTML=a;this.featureImage=this.thumbImage.getElementsByTagName("img")[0];this.featureImage.onload=function(){thumbnailviewer.thumbLoading.style.visibility="hidden";thumbnailviewer.showthumbBox()};if(document.all&&!window.createPopup){this.featureImage.src=b.getAttribute("href")}this.featureImage.onerror=function(){thumbnailviewer.thumbLoading.style.visibility="hidden"}},setimgopacity:function(b){var a=this.featureImage;if(a.filters&&a.filters[0]){if(typeof a.filters[0].opacity=="number"){a.filters[0].opacity=b*100}else{a.style.filter="alpha(opacity="+b*100+")"}}else{if(typeof a.style.MozOpacity!="undefined"){a.style.MozOpacity=b}else{if(typeof a.style.opacity!="undefined"){a.style.opacity=b}else{this.stopanimation()}}}},opacityanimation:function(){this.setimgopacity(this.currentopacity);this.currentopacity+=0.1;if(this.currentopacity>1){this.stopanimation()}},stopanimation:function(){if(typeof this.opacitytimer!="undefined"){clearInterval(this.opacitytimer)}},closeit:function(){this.stopanimation();this.thumbBox.style.visibility="hidden";this.thumbImage.innerHTML="";this.thumbBox.style.left="-2000px";this.thumbBox.style.top="-2000px"},cleanup:function(){this.thumbLoading=null;if(this.featureImage){this.featureImage.onload=null}this.featureImage=null;this.thumbImage=null;for(var a=0;a<this.targetlinks.length;a++){this.targetlinks[a].onclick=null}this.thumbBox=null},dotask:function(b,c,a){var a=(window.addEventListener)?a:"on"+a;if(b.addEventListener){b.addEventListener(a,c,false)}else{if(b.attachEvent){b.attachEvent(a,c)}}},init:function(){if(!this.enableAnimation){this.opacitystring=""}var b=document.getElementsByTagName("a");for(var a=0;a<b.length;a++){if(b[a].getAttribute("rel")&&b[a].getAttribute("rel")=="thumbnail"){b[a].onclick=function(){thumbnailviewer.stopanimation();thumbnailviewer.loadimage(this);return false};this.targetlinks[this.targetlinks.length]=b[a]}}this.dotask(window,function(){if(thumbnailviewer.thumbBox.style.visibility=="visible"){thumbnailviewer.centerDiv(thumbnailviewer.thumbBox)}},"resize")}};thumbnailviewer.createthumbBox();thumbnailviewer.dotask(window,function(){thumbnailviewer.init()},"load");thumbnailviewer.dotask(window,function(){thumbnailviewer.cleanup()},"unload");var niftyOk=(document.getElementById&&document.createElement&&Array.prototype.push);var niftyCss=false;String.prototype.find=function(a){return(this.indexOf(a)>=0?true:false)};var oldonload=window.onload;if(typeof(NiftyLoad)!="function"){NiftyLoad=function(){}}if(typeof(oldonload)=="function"){window.onload=function(){oldonload();AddCss();NiftyLoad()}}else{window.onload=function(){AddCss();NiftyLoad()}}function AddCss(){niftyCss=true;var a=CreateEl("link");a.setAttribute("type","text/css");a.setAttribute("rel","stylesheet");a.setAttribute("href","niftyCorners.css");a.setAttribute("media","screen");document.getElementsByTagName("head")[0].appendChild(a)}function Nifty(a,c){if(niftyOk==false){return}if(niftyCss==false){AddCss()}var d,b=a.split(","),e=0;if(c==null){c=""}if(c.find("fixed-height")){e=getElementsBySelector(b[0])[0].offsetHeight}for(d=0;d<b.length;d++){Rounded(b[d],c)}if(c.find("height")){SameHeight(a,e)}}function Rounded(a,d){var e,f="",c="",b=new Array();if(d!=""){d=d.replace("left","tl bl");d=d.replace("right","tr br");d=d.replace("top","tr tl");d=d.replace("bottom","br bl");d=d.replace("transparent","alias");if(d.find("tl")){f="both";if(!d.find("tr")){f="left"}}else{if(d.find("tr")){f="right"}}if(d.find("bl")){c="both";if(!d.find("br")){c="left"}}else{if(d.find("br")){c="right"}}}if(f==""&&c==""&&!d.find("none")){f="both";c="both"}b=getElementsBySelector(a);for(e=0;e<b.length;e++){FixIE(b[e]);if(f!=""){AddTop(b[e],f,d)}if(c!=""){AddBottom(b[e],c,d)}}}function AddTop(c,l,m){var k=CreateEl("b"),e=4,h="",a,j,b="r",f,g;k.style.marginLeft="-"+getPadding(c,"Left")+"px";k.style.marginRight="-"+getPadding(c,"Right")+"px";if(m.find("alias")||(g=getBk(c))=="transparent"){g="transparent";f="transparent";h=getParentBk(c);b="t"}else{f=getParentBk(c);h=Mix(g,f)}k.style.background=f;k.className="niftycorners";a=getPadding(c,"Top");if(m.find("small")){k.style.marginBottom=(a-2)+"px";b+="s";e=2}else{if(m.find("big")){k.style.marginBottom=(a-10)+"px";b+="b";e=8}else{k.style.marginBottom=(a-5)+"px"}}for(j=1;j<=e;j++){k.appendChild(CreateStrip(j,l,g,h,b))}c.style.paddingTop="0";c.insertBefore(k,c.firstChild)}function AddBottom(c,l,m){var k=CreateEl("b"),e=4,h="",a,j,b="r",f,g;k.style.marginLeft="-"+getPadding(c,"Left")+"px";k.style.marginRight="-"+getPadding(c,"Right")+"px";if(m.find("alias")||(g=getBk(c))=="transparent"){g="transparent";f="transparent";h=getParentBk(c);b="t"}else{f=getParentBk(c);h=Mix(g,f)}k.style.background=f;k.className="niftycorners";a=getPadding(c,"Bottom");if(m.find("small")){k.style.marginTop=(a-2)+"px";b+="s";e=2}else{if(m.find("big")){k.style.marginTop=(a-10)+"px";b+="b";e=8}else{k.style.marginTop=(a-5)+"px"}}for(j=e;j>0;j--){k.appendChild(CreateStrip(j,l,g,h,b))}c.style.paddingBottom=0;c.appendChild(k)}function CreateStrip(d,e,b,c,f){var a=CreateEl("b");a.className=f+d;a.style.backgroundColor=b;a.style.borderColor=c;if(e=="left"){a.style.borderRightWidth="0";a.style.marginRight="0"}else{if(e=="right"){a.style.borderLeftWidth="0";a.style.marginLeft="0"}}return(a)}function CreateEl(a){return(document.createElement(a))}function FixIE(a){if(a.currentStyle!=null&&a.currentStyle.hasLayout!=null&&a.currentStyle.hasLayout==false){a.style.display="inline-block"}}function SameHeight(a,d){var g,b=a.split(","),f,c,e=[],h;for(g=0;g<b.length;g++){f=getElementsBySelector(b[g]);e=e.concat(f)}for(g=0;g<e.length;g++){if(e[g].offsetHeight>d){d=e[g].offsetHeight}e[g].style.height="auto"}for(g=0;g<e.length;g++){h=d-e[g].offsetHeight;if(h>0){f=CreateEl("b");f.className="niftyfill";f.style.height=h+"px";nc=e[g].lastChild;if(nc.className=="niftycorners"){e[g].insertBefore(f,nc)}else{e[g].appendChild(f)}}}}function getElementsBySelector(d){var h,g,b="",n="",x=d,t="",r,e,m,q,w=[],p=[],o;if(d.find("#")){if(d.find(" ")){w=d.split(" ");var l=w[0].split("#");if(l.length==1){return(p)}m=document.getElementById(l[1]);if(m){u=m.getElementsByTagName(w[1]);for(h=0;h<u.length;h++){p.push(u[h])}}return(p)}else{w=d.split("#");x=w[0];b=w[1];if(b!=""){m=document.getElementById(b);if(m){p.push(m)}return(p)}}}if(d.find(".")){w=d.split(".");x=w[0];n=w[1];if(n.find(" ")){w=n.split(" ");n=w[0];t=w[1]}}var u=document.getElementsByTagName(x);if(n==""){for(h=0;h<u.length;h++){p.push(u[h])}return(p)}for(h=0;h<u.length;h++){o=u[h].className.split(" ");for(g=0;g<o.length;g++){if(o[g]==n){if(t==""){p.push(u[h])}else{r=u[h].getElementsByTagName(t);for(e=0;e<r.length;e++){p.push(r[e])}}}}}return(p)}function getParentBk(a){var b=a.parentNode,d;while(b.tagName.toUpperCase()!="HTML"&&(d=getBk(b))=="transparent"){b=b.parentNode}if(d=="transparent"){d="#FFFFFF"}return(d)}function getBk(a){var b=getStyleProp(a,"backgroundColor");if(b==null||b=="transparent"||b.find("rgba(0, 0, 0, 0)")){return("transparent")}if(b.find("rgb")){b=rgb2hex(b)}return(b)}function getPadding(a,b){var c=getStyleProp(a,"padding"+b);if(c==null||!c.find("px")){return(0)}return(parseInt(c))}function getStyleProp(a,b){if(a.currentStyle){return(a.currentStyle[b])}if(document.defaultView.getComputedStyle){return(document.defaultView.getComputedStyle(a,"")[b])}return(null)}function rgb2hex(f){var d="",a,c,b;var e=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var c=e.exec(f);for(b=1;b<4;b++){a=parseInt(c[b]).toString(16);if(a.length==1){d+="0"+a}else{d+=a}}return("#"+d)}function Mix(f,e){var d,c,b,a,h,g=new Array(3);if(f.length==4){c=1}else{c=2}if(e.length==4){b=1}else{b=2}for(d=0;d<3;d++){a=parseInt(f.substr(1+c*d,c),16);if(c==1){a=16*a+a}h=parseInt(e.substr(1+b*d,b),16);if(b==1){h=16*h+h}g[d]=Math.floor((a*50+h*50)/100);g[d]=g[d].toString(16);if(g[d].length==1){g[d]="0"+g[d]}}return("#"+g[0]+g[1]+g[2])}function formtest(){var a=null;if($("nome").value==""){alert("Non avete inserito il vostro nome!");a=1}if($("email").value==""){alert("Non avete inserito l'indirizzo email!");a=1}if($("messaggio").value==""){alert("Non avete inserito alcun messaggio!");a=1}if(a){return false}}function setform(){if($&&$("modulo")){$("modulo").onsubmit=formtest}}function prepare(){Nifty("div#container","big");Nifty("div.date","normal");Nifty("div#header","transparent top");setform()}$(document).ready(function(){jQuery(".maplink a, .mapclick").click(function(){jQuery("<iframe/>").attr("src","http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&ll=45.654698,13.775439&spn=0.009134,0.020556&z=16&msid=107009315416047737103.00048ed171f9dc46091d4&output=embed").appendTo("#map");jQuery("#map").modal();jQuery("a.modalCloseImg").click(function(){jQuery("#map").empty()});return false})});window.onload=prepare;
