var gazzadisc; gazzadisc=0;var gazzasped;gazzasped = 1;var partneruser = "";var stopvaiavantigaz = 0; var bvsc;var bottnocanc;bottnocanc = "";var bottnocancprice;bottnocancprice=0;var mappa; mappa=1;var richiestagusti;richiestagusti=0;var proven;proven = "null";var ricercaincorso;ricercaincorso=0;var sechiuderla;sechiuderla="";var chichichi;chichichi="";var multiplo6;multiplo6=0;var registrazionedaordine;registrazionedaordine=0;var fissabottgrowed;fissabottgrowed=0;var spostament;spostament=0;var imgselezionata;imgselezionata="";var slidedownpos;slidedownpos=1;var elementicart;elementicart=0;var imgselezionatasrc;imgselezionatasrc="";var growfinished;growfinished=0;var finestraperta;finestraperta=0;var growing;growing=0;var gThumbWidth;if(gThumbWidth==undefined){gThumbWidth=44;}var gThumbHeight;if(gThumbHeight==undefined){gThumbHeight=110;}var gSlideShowInterval;if(gSlideShowInterval==undefined){gSlideShowInterval=100;}var gAutoStartSlideShow;if(gAutoStartSlideShow==undefined){gAutoStartSlideShow=true;}var gBehaviorsArray=[];var gSlideShowOn=false;var gSlideShowTimer=null;var gImageLoader=null;Spry.Data.Region.addObserver("thumbnails",function(_1,_2,_3){if(_1=="onPostUpdate"){ShowCurrentImage();if(gAutoStartSlideShow){StartSlideShow(true);}}});function SetMainImage(_4,_5,_6,_7){var _8=document.getElementById("mainImage");if(!_8){return;}CancelBehavior("mainImage");Spry.Utils.SelectionManager.clearSelection("thumbnailSelection");if(_7){Spry.Utils.SelectionManager.select("thumbnailSelection",document.getElementById(_7),"selectedThumbnail");}if(gImageLoader){gImageLoader.onload=function(){};gImageLoader=null;}gBehaviorsArray["mainImage"]=new Spry.Effect.Opacity(_8,Spry.Effect.getOpacity(_8),0,{duration:400,finish:function(){gBehaviorsArray["mainImage"]=new Spry.Effect.Size(_8.parentNode,Spry.Effect.getDimensions(_8.parentNode),{width:_5,height:_6,units:"px"},{duration:400,finish:function(){gImageLoader=new Image();gImageLoader.onload=function(){_8.src=gImageLoader.src;gImageLoader=null;gBehaviorsArray["mainImage"]=new Spry.Effect.Opacity(_8,0,1,{duration:400,finish:function(){gBehaviorsArray["mainImage"]=null;_8.style.opacity="";_8.style.filter="";if(gSlideShowOn){SetSlideShowTimer();}}});gBehaviorsArray["mainImage"].start();};gImageLoader.src=_4;}});gBehaviorsArray["mainImage"].start();}});gBehaviorsArray["mainImage"].start();};function CancelBehavior(id){if(gBehaviorsArray[id]){gBehaviorsArray[id].cancel();gBehaviorsArray[id]=null;}};function SizeAndPosition(id,_9,_a,_b,_c,_d){CancelBehavior(id);var _e=new Spry.Effect.Cluster({finish:_d,finish:accertaposizgrowaperto});var _f=Spry.Effect.getElement(id);var _10=new Spry.Effect.Move(_f,{x:0,y:0,units:"px"},{x:-22,y:-44,units:"px"},{duration:200});var _11=new Spry.Effect.Size(_f,Spry.Effect.getDimensions(_f),{width:_b,height:_c,units:"px"},{duration:200});_e.addParallelEffect(_10);_e.addParallelEffect(_11);gBehaviorsArray[id]=_e;gBehaviorsArray[id].start();};function accertaposizgrowaperto(){imgtoshrink.style.top=-44;imgtoshrink.style.left=-22;makeitdraggable();};function SizeAndPositionend(id,toX,toY,_12,_13,_14){CancelBehavior(id);var _15=new Spry.Effect.Cluster({finish:_14,finish:_16});var ele=Spry.Effect.getElement(id);var _17=new Spry.Effect.Move(ele,Spry.Effect.getPosition(ele),{x:0,y:0,units:"px"},{duration:200});var _18=new Spry.Effect.Size(ele,Spry.Effect.getDimensions(ele),{width:_12,height:_13,units:"px"},{duration:200});_15.addParallelEffect(_17);_15.addParallelEffect(_18);gBehaviorsArray[id]=_15;gBehaviorsArray[id].start();function _16(){document.getElementById(id).style.top=0;document.getElementById(id).style.left=0;};};function gt(_19){GrowThumbnail(_19.getElementsByTagName("img")[0],"59","170","44","110");};function st(_1a){ShrinkThumbnail(_1a.getElementsByTagName("img")[0]);};function ms(_1b){mostraschedina(_1b.getElementsByTagName("img")[0]);};function GrowThumbnail(img,_1c,_1d,_1e,_1f){fissabottgrowed=0;if(document.getElementById("overbottlecont").style.visibility!="visible"&&growing==0&&spostament==0&&img.src!="http://www.viniamo.it/images/bottfantasma.gif"){definiscititle(img);Spry.Utils.addClassName(img,"inFocus");img.style.zIndex=150;var id=img.getAttribute("id");precwidth=44;precheight=110;var _20=88;var _21=220;var tx=-22;var ty=-55;SizeAndPosition(id,tx,ty,_20,_21,function(b){gBehaviorsArray[id]=null;});actualimg=img.src;newimg=actualimg.replace("_ss.png","_s.gif").replace("bottlespng_ss","bottles_s");img.src=newimg;img.parentNode.style.zIndex=100000;img.style.zIndex=100000;finestraperta=1;imgtoshrink=img;document.getElementById("qualechiud").title=img.id;}};function iniziadrag(){growing=1;dragrunning=1;};function finiscedrag(){growing=0;dragrunning=0;};function hoverslidedown(){document.getElementById("imghoverslidedown").src=imgtoshrink.src.replace("_s.gif","_ss.png").replace("bottles_s","bottlespng_ss");document.getElementById("hoverslidedown").style.visibility="visible";};function hoveroutslidedown(){document.getElementById("hoverslidedown").style.visibility="hidden";document.getElementById("hoverwish").style.visibility="hidden";};function makeitdraggable(){new Draggable(imgtoshrink,{revert:true,ghosting:true,zindex:10000000,onStart:iniziadrag,onEnd:finiscedrag});};function dragbackend(){ShrinkThumbnail(imgtoshrink);};function mostraghost(){divpostop2=getPos(imgtoshrink.parentNode).top;divposleft2=getPos(imgtoshrink.parentNode).left;divparentpostop2=getPos(document.getElementById("contenitore")).top;divparentposleft2=getPos(document.getElementById("contenitore")).left;document.getElementById("overbottleghost").style.top=divpostop2-divparentpostop2+130+"px";document.getElementById("overbottleghost").style.left=divposleft2-divparentposleft2+142+"px";document.getElementById("overbottleghost").getElementsByTagName("img")[0].src=imgtoshrink.src;document.getElementById("overbottleghost").style.visibility="visible";cicciotto=document.getElementById("overbottleghost").getElementsByTagName("img")[0];new Draggable(cicciotto,{revert:true,ghosting:true,zindex:50000000});};function makeitdroppable(){Droppables.add("droppablearea",{accept:"dragimg",onHover:function(_22){hoverslidedown();},onDrop:function(_23){inserisciarticolonelcart(_23);}});};function ShrinkThumbnail(img){finestraperta=0;richiestashrink=1;if(document.getElementById("overbottlecont").style.visibility!="visible"&&growing==0&&fissabottgrowed==0&&spostament==0&&img.src!="../images/bottfantasma.gif"){Spry.Utils.addClassName(imgtoshrink,"inFocus");imgtoshrink.style.zIndex=1;var id=imgtoshrink.getAttribute("id");SizeAndPositionend(id,0,0,precwidth,precheight,function(b){gBehaviorsArray[id]=null;Spry.Utils.removeClassName(imgtoshrink,"inFocus");});actualimg=imgtoshrink.src;newimg=actualimg.replace("_s.gif","_ss.png").replace("bottles_s/","bottlespng_ss/");imgtoshrink.src=newimg;imgtoshrink.parentNode.style.zIndex=1000;}};function ShowCurrentImage(){var _24=dsPhotos.getCurrentRow();SetMainImage("galleries/"+dsGalleries.getCurrentRow()["@base"]+"images/"+_24["@path"],_24["@width"],_24["@height"],"tn"+_24["ds_RowID"]);};function AdvanceToNextImage(_25){var _26=dsPhotos.getData();var _27=dsPhotos.getCurrentRow();if(_26.length<1){return;}for(var i=0;i<_26.length;i++){if(_26[i]==_27){if(_25){--i;}else{++i;}break;}}if(!_25&&i>=_26.length){i=0;}else{if(_25&&i<0){i=_26.length-1;}}_27=_26[i];dsPhotos.setCurrentRow(_27["ds_RowID"]);ShowCurrentImage();};function SetSlideShowTimer(){KillSlideShowTimer();gSlideShowTimer=setTimeout(function(){gSlideShowTimer=null;AdvanceToNextImage(false);},gSlideShowInterval);};function KillSlideShowTimer(){if(gSlideShowTimer){clearTimeout(gSlideShowTimer);}gSlideShowTimer=null;};function StartSlideShow(_28){gSlideShowOn=true;if(!_28){SetSlideShowTimer();}var _29=document.getElementById("playLabel");if(_29){_29.firstChild.data="Pause";}};function StopSlideShow(){gSlideShowOn=false;KillSlideShowTimer();var _2a=document.getElementById("playLabel");if(_2a){_2a.firstChild.data="Play";}};function HandleThumbnailClick(id){StopSlideShow();dsPhotos.setCurrentRow(id);ShowCurrentImage();};