

﻿//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

var MooTools={version:"1.11"};function $defined(A){return(A!=undefined);}function $type(B){if(!$defined(B)){return false;}if(B.htmlElement){return"element";
}var A=typeof B;if(A=="object"&&B.nodeName){switch(B.nodeType){case 1:return"element";case 3:return(/\S/).test(B.nodeValue)?"textnode":"whitespace";}}if(A=="object"||A=="function"){switch(B.constructor){case Array:return"array";
case RegExp:return"regexp";case Class:return"class";}if(typeof B.length=="number"){if(B.item){return"collection";}if(B.callee){return"arguments";}}}return A;
}function $merge(){var C={};for(var B=0;B<arguments.length;B++){for(var E in arguments[B]){var A=arguments[B][E];var D=C[E];if(D&&$type(A)=="object"&&$type(D)=="object"){C[E]=$merge(D,A);
}else{C[E]=A;}}}return C;}var $extend=function(){var A=arguments;if(!A[1]){A=[this,A[0]];}for(var B in A[1]){A[0][B]=A[1][B];}return A[0];};var $native=function(){for(var B=0,A=arguments.length;
B<A;B++){arguments[B].extend=function(C){for(var D in C){if(!this.prototype[D]){this.prototype[D]=C[D];}if(!this[D]){this[D]=$native.generic(D);}}};}};
$native.generic=function(A){return function(B){return this.prototype[A].apply(B,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);
function $chk(A){return !!(A||A===0);}function $pick(B,A){return $defined(B)?B:A;}function $random(B,A){return Math.floor(Math.random()*(A-B+1)+B);}function $time(){return new Date().getTime();
}function $clear(A){clearTimeout(A);clearInterval(A);return null;}var Abstract=function(A){A=A||{};A.extend=$extend;return A;};var Window=new Abstract(window);
var Document=new Abstract(document);document.head=document.getElementsByTagName("head")[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject){window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true;
}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){window.webkit=window[window.xpath?"webkit420":"webkit419"]=true;}else{if(document.getBoxObjectFor!=null){window.gecko=true;
}}}window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=="undefined"){var HTMLElement=function(){};if(window.webkit){document.createElement("iframe");
}HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};}HTMLElement.prototype.htmlElement=function(){};if(window.ie6){try{document.execCommand("BackgroundImageCache",false,true);
}catch(e){}}var Class=function(B){var A=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this;
};$extend(A,this);A.prototype=B;A.constructor=Class;return A;};Class.empty=function(){};Class.prototype={extend:function(B){var C=new this(null);for(var D in B){var A=C[D];
C[D]=Class.Merge(A,B[D]);}return new Class(C);},implement:function(){for(var B=0,A=arguments.length;B<A;B++){$extend(this.prototype,arguments[B]);}}};Class.Merge=function(C,D){if(C&&C!=D){var B=$type(D);
if(B!=$type(C)){return D;}switch(B){case"function":var A=function(){this.parent=arguments.callee.parent;return D.apply(this,arguments);};A.parent=C;return A;
case"object":return $merge(C,D);}}return D;};var Chain=new Class({chain:function(A){this.chains=this.chains||[];this.chains.push(A);return this;},callChain:function(){if(this.chains&&this.chains.length){this.chains.shift().delay(10,this);
}},clearChain:function(){this.chains=[];}});var Events=new Class({addEvent:function(B,A){if(A!=Class.empty){this.$events=this.$events||{};this.$events[B]=this.$events[B]||[];
this.$events[B].include(A);}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].each(function(D){D.create({bind:this,delay:A,"arguments":B})();
},this);}return this;},removeEvent:function(B,A){if(this.$events&&this.$events[B]){this.$events[B].remove(A);}return this;}});var Options=new Class({setOptions:function(){this.options=$merge.apply(null,[this.options].extend(arguments));
if(this.addEvent){for(var A in this.options){if($type(this.options[A]=="function")&&(/^on[A-Z]/).test(A)){this.addEvent(A,this.options[A]);}}}return this;
}});Array.extend({forEach:function(C,D){for(var B=0,A=this.length;B<A;B++){C.call(D,this[B],B,this);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;
B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;},map:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){C[B]=D.call(E,this[B],B,this);
}return C;},every:function(C,D){for(var B=0,A=this.length;B<A;B++){if(!C.call(D,this[B],B,this)){return false;}}return true;},some:function(C,D){for(var B=0,A=this.length;
B<A;B++){if(C.call(D,this[B],B,this)){return true;}}return false;},indexOf:function(C,D){var A=this.length;for(var B=(D<0)?Math.max(0,A+D):D||0;B<A;B++){if(this[B]===C){return B;
}}return -1;},copy:function(D,C){D=D||0;if(D<0){D=this.length+D;}C=C||(this.length-D);var A=[];for(var B=0;B<C;B++){A[B]=this[D++];}return A;},remove:function(C){var B=0;
var A=this.length;while(B<A){if(this[B]===C){this.splice(B,1);A--;}else{B++;}}return this;},contains:function(A,B){return this.indexOf(A,B)!=-1;},associate:function(C){var D={},B=Math.min(this.length,C.length);
for(var A=0;A<B;A++){D[C[A]]=this[A];}return D;},extend:function(C){for(var B=0,A=C.length;B<A;B++){this.push(C[B]);}return this;},merge:function(C){for(var B=0,A=C.length;
B<A;B++){this.include(C[B]);}return this;},include:function(A){if(!this.contains(A)){this.push(A);}return this;},getRandom:function(){return this[$random(0,this.length-1)]||null;
},getLast:function(){return this[this.length-1]||null;}});Array.prototype.each=Array.prototype.forEach;Array.each=Array.forEach;function $A(A){return Array.copy(A);
}function $each(C,B,D){if(C&&typeof C.length=="number"&&$type(C)!="object"){Array.forEach(C,B,D);}else{for(var A in C){B.call(D||C,C[A],A);}}}Array.prototype.test=Array.prototype.contains;
String.extend({test:function(A,B){return(($type(A)=="string")?new RegExp(A,B):A).test(this);},toInt:function(){return parseInt(this,10);},toFloat:function(){return parseFloat(this);
},camelCase:function(){return this.replace(/-\D/g,function(A){return A.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/\w[A-Z]/g,function(A){return(A.charAt(0)+"-"+A.charAt(1).toLowerCase());
});},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase();});},trim:function(){return this.replace(/^\s+|\s+$/g,"");
},clean:function(){return this.replace(/\s{2,}/g," ").trim();},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);return(A)?A.rgbToHex(B):false;},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return(A)?A.slice(1).hexToRgb(B):false;},contains:function(A,B){return(B)?(B+this+B).indexOf(B+A+B)>-1:this.indexOf(A)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");
}});Array.extend({rgbToHex:function(D){if(this.length<3){return false;}if(this.length==4&&this[3]==0&&!D){return"transparent";}var B=[];for(var A=0;A<3;
A++){var C=(this[A]-0).toString(16);B.push((C.length==1)?"0"+C:C);}return D?B:"#"+B.join("");},hexToRgb:function(C){if(this.length!=3){return false;}var A=[];
for(var B=0;B<3;B++){A.push(parseInt((this[B].length==1)?this[B]+this[B]:this[B],16));}return C?A:"rgb("+A.join(",")+")";}});Function.extend({create:function(A){var B=this;
A=$merge({bind:B,event:false,"arguments":null,delay:false,periodical:false,attempt:false},A);if($chk(A.arguments)&&$type(A.arguments)!="array"){A.arguments=[A.arguments];
}return function(E){var C;if(A.event){E=E||window.event;C=[(A.event===true)?E:new A.event(E)];if(A.arguments){C.extend(A.arguments);}}else{C=A.arguments||arguments;
}var F=function(){return B.apply($pick(A.bind,B),C);};if(A.delay){return setTimeout(F,A.delay);}if(A.periodical){return setInterval(F,A.periodical);}if(A.attempt){try{return F();
}catch(D){return false;}}return F();};},pass:function(A,B){return this.create({"arguments":A,bind:B});},attempt:function(A,B){return this.create({"arguments":A,bind:B,attempt:true})();
},bind:function(B,A){return this.create({bind:B,"arguments":A});},bindAsEventListener:function(B,A){return this.create({bind:B,event:true,"arguments":A});
},delay:function(B,C,A){return this.create({delay:B,bind:C,"arguments":A})();},periodical:function(A,C,B){return this.create({periodical:A,bind:C,"arguments":B})();
}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(B,A){return Math.min(A,Math.max(B,this));
},round:function(A){A=Math.pow(10,A||0);return Math.round(this*A)/A;},times:function(B){for(var A=0;A<this;A++){B(A);}}});var Element=new Class({initialize:function(D,C){if($type(D)=="string"){if(window.ie&&C&&(C.name||C.type)){var A=(C.name)?' name="'+C.name+'"':"";
var B=(C.type)?' type="'+C.type+'"':"";delete C.name;delete C.type;D="<"+D+A+B+">";}D=document.createElement(D);}D=$(D);return(!C||!D)?D:D.set(C);}});var Elements=new Class({initialize:function(A){return(A)?$extend(A,this):this;
}});Elements.extend=function(A){for(var B in A){this.prototype[B]=A[B];this[B]=$native.generic(B);}};function $(B){if(!B){return null;}if(B.htmlElement){return Garbage.collect(B);
}if([window,document].contains(B)){return B;}var A=$type(B);if(A=="string"){B=document.getElementById(B);A=(B)?"element":false;}if(A!="element"){return null;
}if(B.htmlElement){return Garbage.collect(B);}if(["object","embed"].contains(B.tagName.toLowerCase())){return B;}$extend(B,Element.prototype);B.htmlElement=function(){};
return Garbage.collect(B);}document.getElementsBySelector=document.getElementsByTagName;function $$(){var D=[];for(var C=0,B=arguments.length;C<B;C++){var A=arguments[C];
switch($type(A)){case"element":D.push(A);case"boolean":break;case false:break;case"string":A=document.getElementsBySelector(A,true);default:D.extend(A);
}}return $$.unique(D);}$$.unique=function(G){var D=[];for(var C=0,A=G.length;C<A;C++){if(G[C].$included){continue;}var B=$(G[C]);if(B&&!B.$included){B.$included=true;
D.push(B);}}for(var F=0,E=D.length;F<E;F++){D[F].$included=null;}return new Elements(D);};Elements.Multi=function(A){return function(){var D=arguments;
var B=[];var G=true;for(var E=0,C=this.length,F;E<C;E++){F=this[E][A].apply(this[E],D);if($type(F)!="element"){G=false;}B.push(F);}return(G)?$$.unique(B):B;
};};Element.extend=function(A){for(var B in A){HTMLElement.prototype[B]=A[B];Element.prototype[B]=A[B];Element[B]=$native.generic(B);var C=(Array.prototype[B])?B+"Elements":B;
Elements.prototype[C]=Elements.Multi(B);}};Element.extend({set:function(A){for(var C in A){var B=A[C];switch(C){case"styles":this.setStyles(B);break;case"events":if(this.addEvents){this.addEvents(B);
}break;case"properties":this.setProperties(B);break;default:this.setProperty(C,B);}}return this;},inject:function(C,A){C=$(C);switch(A){case"before":C.parentNode.insertBefore(this,C);
break;case"after":var B=C.getNext();if(!B){C.parentNode.appendChild(this);}else{C.parentNode.insertBefore(this,B);}break;case"top":var D=C.firstChild;if(D){C.insertBefore(this,D);
break;}default:C.appendChild(this);}return this;},injectBefore:function(A){return this.inject(A,"before");},injectAfter:function(A){return this.inject(A,"after");
},injectInside:function(A){return this.inject(A,"bottom");},injectTop:function(A){return this.inject(A,"top");},adopt:function(){var A=[];$each(arguments,function(B){A=A.concat(B);
});$$(A).inject(this);return this;},remove:function(){return this.parentNode.removeChild(this);},clone:function(C){var B=$(this.cloneNode(C!==false));if(!B.$events){return B;
}B.$events={};for(var A in this.$events){B.$events[A]={keys:$A(this.$events[A].keys),values:$A(this.$events[A].values)};}return B.removeEvents();},replaceWith:function(A){A=$(A);
this.parentNode.replaceChild(A,this);return A;},appendText:function(A){this.appendChild(document.createTextNode(A));return this;},hasClass:function(A){return this.className.contains(A," ");
},addClass:function(A){if(!this.hasClass(A)){this.className=(this.className+" "+A).clean();}return this;},removeClass:function(A){this.className=this.className.replace(new RegExp("(^|\\s)"+A+"(?:\\s|$)"),"$1").clean();
return this;},toggleClass:function(A){return this.hasClass(A)?this.removeClass(A):this.addClass(A);},setStyle:function(B,A){switch(B){case"opacity":return this.setOpacity(parseFloat(A));
case"float":B=(window.ie)?"styleFloat":"cssFloat";}B=B.camelCase();switch($type(A)){case"number":if(!["zIndex","zoom"].contains(B)){A+="px";}break;case"array":A="rgb("+A.join(",")+")";
}this.style[B]=A;return this;},setStyles:function(A){switch($type(A)){case"object":Element.setMany(this,"setStyle",A);break;case"string":this.style.cssText=A;
}return this;},setOpacity:function(A){if(A==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";
}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(window.ie){this.style.filter=(A==1)?"":"alpha(opacity="+A*100+")";}this.style.opacity=this.$tmp.opacity=A;
return this;},getStyle:function(C){C=C.camelCase();var A=this.style[C];if(!$chk(A)){if(C=="opacity"){return this.$tmp.opacity;}A=[];for(var B in Element.Styles){if(C==B){Element.Styles[B].each(function(F){var E=this.getStyle(F);
A.push(parseInt(E)?E:"0px");},this);if(C=="border"){var D=A.every(function(E){return(E==A[0]);});return(D)?A[0]:false;}return A.join(" ");}}if(C.contains("border")){if(Element.Styles.border.contains(C)){return["Width","Style","Color"].map(function(E){return this.getStyle(C+E);
},this).join(" ");}else{if(Element.borderShort.contains(C)){return["Top","Right","Bottom","Left"].map(function(E){return this.getStyle("border"+E+C.replace("border",""));
},this).join(" ");}}}if(document.defaultView){A=document.defaultView.getComputedStyle(this,null).getPropertyValue(C.hyphenate());}else{if(this.currentStyle){A=this.currentStyle[C];
}}}if(window.ie){A=Element.fixStyle(C,A,this);}if(A&&C.test(/color/i)&&A.contains("rgb")){return A.split("rgb").splice(1,4).map(function(E){return E.rgbToHex();
}).join(" ");}return A;},getStyles:function(){return Element.getMany(this,"getStyle",arguments);},walk:function(A,C){A+="Sibling";var B=(C)?this[C]:this[A];
while(B&&$type(B)!="element"){B=B[A];}return $(B);},getPrevious:function(){return this.walk("previous");},getNext:function(){return this.walk("next");},getFirst:function(){return this.walk("next","firstChild");
},getLast:function(){return this.walk("previous","lastChild");},getParent:function(){return $(this.parentNode);},getChildren:function(){return $$(this.childNodes);
},hasChild:function(A){return !!$A(this.getElementsByTagName("*")).contains(A);},getProperty:function(D){var B=Element.Properties[D];if(B){return this[B];
}var A=Element.PropertiesIFlag[D]||0;if(!window.ie||A){return this.getAttribute(D,A);}var C=this.attributes[D];return(C)?C.nodeValue:null;},removeProperty:function(B){var A=Element.Properties[B];
if(A){this[A]="";}else{this.removeAttribute(B);}return this;},getProperties:function(){return Element.getMany(this,"getProperty",arguments);},setProperty:function(C,B){var A=Element.Properties[C];
if(A){this[A]=B;}else{this.setAttribute(C,B);}return this;},setProperties:function(A){return Element.setMany(this,"setProperty",A);},setHTML:function(){this.innerHTML=$A(arguments).join("");
return this;},setText:function(B){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){this.styleSheet.cssText=B;}else{if(A=="script"){this.setProperty("text",B);
}}return this;}else{this.removeChild(this.firstChild);return this.appendText(B);}}this[$defined(this.innerText)?"innerText":"textContent"]=B;return this;
},getText:function(){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){return this.styleSheet.cssText;}else{if(A=="script"){return this.getProperty("text");
}}}else{return this.innerHTML;}}return($pick(this.innerText,this.textContent));},getTag:function(){return this.tagName.toLowerCase();},empty:function(){Garbage.trash(this.getElementsByTagName("*"));
return this.setHTML("");}});Element.fixStyle=function(E,A,D){if($chk(parseInt(A))){return A;}if(["height","width"].contains(E)){var B=(E=="width")?["left","right"]:["top","bottom"];
var C=0;B.each(function(F){C+=D.getStyle("border-"+F+"-width").toInt()+D.getStyle("padding-"+F).toInt();});return D["offset"+E.capitalize()]-C+"px";}else{if(E.test(/border(.+)Width|margin|padding/)){return"0px";
}}return A;};Element.Styles={border:[],padding:[],margin:[]};["Top","Right","Bottom","Left"].each(function(B){for(var A in Element.Styles){Element.Styles[A].push(A+B);
}});Element.borderShort=["borderWidth","borderStyle","borderColor"];Element.getMany=function(B,D,C){var A={};$each(C,function(E){A[E]=B[D](E);});return A;
};Element.setMany=function(B,D,C){for(var A in C){B[D](A,C[A]);}return B;};Element.Properties=new Abstract({"class":"className","for":"htmlFor",colspan:"colSpan",rowspan:"rowSpan",accesskey:"accessKey",tabindex:"tabIndex",maxlength:"maxLength",readonly:"readOnly",frameborder:"frameBorder",value:"value",disabled:"disabled",checked:"checked",multiple:"multiple",selected:"selected"});
Element.PropertiesIFlag={href:2,src:2};Element.Methods={Listeners:{addListener:function(B,A){if(this.addEventListener){this.addEventListener(B,A,false);
}else{this.attachEvent("on"+B,A);}return this;},removeListener:function(B,A){if(this.removeEventListener){this.removeEventListener(B,A,false);}else{this.detachEvent("on"+B,A);
}return this;}}};window.extend(Element.Methods.Listeners);document.extend(Element.Methods.Listeners);Element.extend(Element.Methods.Listeners);var Garbage={elements:[],collect:function(A){if(!A.$tmp){Garbage.elements.push(A);
A.$tmp={opacity:1};}return A;},trash:function(D){for(var B=0,A=D.length,C;B<A;B++){if(!(C=D[B])||!C.$tmp){continue;}if(C.$events){C.fireEvent("trash").removeEvents();
}for(var E in C.$tmp){C.$tmp[E]=null;}for(var F in Element.prototype){C[F]=null;}Garbage.elements[Garbage.elements.indexOf(C)]=null;C.htmlElement=C.$tmp=C=null;
}Garbage.elements.remove(null);},empty:function(){Garbage.collect(window);Garbage.collect(document);Garbage.trash(Garbage.elements);}};window.addListener("beforeunload",function(){window.addListener("unload",Garbage.empty);
if(window.ie){window.addListener("unload",CollectGarbage);}});var Event=new Class({initialize:function(C){if(C&&C.$extended){return C;}this.$extended=true;
C=C||window.event;this.event=C;this.type=C.type;this.target=C.target||C.srcElement;if(this.target.nodeType==3){this.target=this.target.parentNode;}this.shift=C.shiftKey;
this.control=C.ctrlKey;this.alt=C.altKey;this.meta=C.metaKey;if(["DOMMouseScroll","mousewheel"].contains(this.type)){this.wheel=(C.wheelDelta)?C.wheelDelta/120:-(C.detail||0)/3;
}else{if(this.type.contains("key")){this.code=C.which||C.keyCode;for(var B in Event.keys){if(Event.keys[B]==this.code){this.key=B;break;}}if(this.type=="keydown"){var A=this.code-111;
if(A>0&&A<13){this.key="f"+A;}}this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else{if(this.type.test(/(click|mouse|menu)/)){this.page={x:C.pageX||C.clientX+document.documentElement.scrollLeft,y:C.pageY||C.clientY+document.documentElement.scrollTop};
this.client={x:C.pageX?C.pageX-window.pageXOffset:C.clientX,y:C.pageY?C.pageY-window.pageYOffset:C.clientY};this.rightClick=(C.which==3)||(C.button==2);
switch(this.type){case"mouseover":this.relatedTarget=C.relatedTarget||C.fromElement;break;case"mouseout":this.relatedTarget=C.relatedTarget||C.toElement;
}this.fixRelatedTarget();}}}return this;},stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();
}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();}else{this.event.returnValue=false;
}return this;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode;
}},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);}catch(A){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;
Event.keys=new Abstract({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Element.Methods.Events={addEvent:function(C,B){this.$events=this.$events||{};
this.$events[C]=this.$events[C]||{keys:[],values:[]};if(this.$events[C].keys.contains(B)){return this;}this.$events[C].keys.push(B);var A=C;var D=Element.Events[C];
if(D){if(D.add){D.add.call(this,B);}if(D.map){B=D.map;}if(D.type){A=D.type;}}if(!this.addEventListener){B=B.create({bind:this,event:true});}this.$events[C].values.push(B);
return(Element.NativeEvents.contains(A))?this.addListener(A,B):this;},removeEvent:function(C,B){if(!this.$events||!this.$events[C]){return this;}var F=this.$events[C].keys.indexOf(B);
if(F==-1){return this;}var A=this.$events[C].keys.splice(F,1)[0];var E=this.$events[C].values.splice(F,1)[0];var D=Element.Events[C];if(D){if(D.remove){D.remove.call(this,B);
}if(D.type){C=D.type;}}return(Element.NativeEvents.contains(C))?this.removeListener(C,E):this;},addEvents:function(A){return Element.setMany(this,"addEvent",A);
},removeEvents:function(A){if(!this.$events){return this;}if(!A){for(var B in this.$events){this.removeEvents(B);}this.$events=null;}else{if(this.$events[A]){this.$events[A].keys.each(function(C){this.removeEvent(A,C);
},this);this.$events[A]=null;}}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].keys.each(function(D){D.create({bind:this,delay:A,"arguments":B})();
},this);}return this;},cloneEvents:function(C,A){if(!C.$events){return this;}if(!A){for(var B in C.$events){this.cloneEvents(C,B);}}else{if(C.$events[A]){C.$events[A].keys.each(function(D){this.addEvent(A,D);
},this);}}return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({mouseenter:{type:"mouseover",map:function(A){A=new Event(A);
if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseenter",A);}}},mouseleave:{type:"mouseout",map:function(A){A=new Event(A);
if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseleave",A);}}},mousewheel:{type:(window.gecko)?"DOMMouseScroll":"mousewheel"}});
Element.NativeEvents=["click","dblclick","mouseup","mousedown","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","keydown","keypress","keyup","load","unload","beforeunload","resize","move","focus","blur","change","submit","reset","select","error","abort","contextmenu","scroll"];
Function.extend({bindWithEvent:function(B,A){return this.create({bind:B,"arguments":A,event:Event});}});Elements.extend({filterByTag:function(A){return new Elements(this.filter(function(B){return(Element.getTag(B)==A);
}));},filterByClass:function(A,C){var B=this.filter(function(D){return(D.className&&D.className.contains(A," "));});return(C)?B:new Elements(B);},filterById:function(C,B){var A=this.filter(function(D){return(D.id==C);
});return(B)?A:new Elements(A);},filterByAttribute:function(B,A,D,E){var C=this.filter(function(F){var G=Element.getProperty(F,B);if(!G){return false;}if(!A){return true;
}switch(A){case"=":return(G==D);case"*=":return(G.contains(D));case"^=":return(G.substr(0,D.length)==D);case"$=":return(G.substr(G.length-D.length)==D);
case"!=":return(G!=D);case"~=":return G.contains(D," ");}return false;});return(E)?C:new Elements(C);}});function $E(A,B){return($(B)||document).getElement(A);
}function $ES(A,B){return($(B)||document).getElementsBySelector(A);}$$.shared={regexp:/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,xpath:{getParam:function(B,D,E,C){var A=[D.namespaceURI?"xhtml:":"",E[1]];
if(E[2]){A.push('[@id="',E[2],'"]');}if(E[3]){A.push('[contains(concat(" ", @class, " "), " ',E[3],' ")]');}if(E[4]){if(E[5]&&E[6]){switch(E[5]){case"*=":A.push("[contains(@",E[4],', "',E[6],'")]');
break;case"^=":A.push("[starts-with(@",E[4],', "',E[6],'")]');break;case"$=":A.push("[substring(@",E[4],", string-length(@",E[4],") - ",E[6].length,' + 1) = "',E[6],'"]');
break;case"=":A.push("[@",E[4],'="',E[6],'"]');break;case"!=":A.push("[@",E[4],'!="',E[6],'"]');}}else{A.push("[@",E[4],"]");}}B.push(A.join(""));return B;
},getItems:function(B,E,G){var F=[];var A=document.evaluate(".//"+B.join("//"),E,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var D=0,C=A.snapshotLength;
D<C;D++){F.push(A.snapshotItem(D));}return(G)?F:new Elements(F.map($));}},normal:{getParam:function(A,C,E,B){if(B==0){if(E[2]){var D=C.getElementById(E[2]);
if(!D||((E[1]!="*")&&(Element.getTag(D)!=E[1]))){return false;}A=[D];}else{A=$A(C.getElementsByTagName(E[1]));}}else{A=$$.shared.getElementsByTagName(A,E[1]);
if(E[2]){A=Elements.filterById(A,E[2],true);}}if(E[3]){A=Elements.filterByClass(A,E[3],true);}if(E[4]){A=Elements.filterByAttribute(A,E[4],E[5],E[6],true);
}return A;},getItems:function(A,B,C){return(C)?A:$$.unique(A);}},resolver:function(A){return(A=="xhtml")?"http://www.w3.org/1999/xhtml":false;},getElementsByTagName:function(D,C){var E=[];
for(var B=0,A=D.length;B<A;B++){E.extend(D[B].getElementsByTagName(C));}return E;}};$$.shared.method=(window.xpath)?"xpath":"normal";Element.Methods.Dom={getElements:function(A,H){var C=[];
A=A.trim().split(" ");for(var E=0,D=A.length;E<D;E++){var F=A[E];var G=F.match($$.shared.regexp);if(!G){break;}G[1]=G[1]||"*";var B=$$.shared[$$.shared.method].getParam(C,this,G,E);
if(!B){break;}C=B;}return $$.shared[$$.shared.method].getItems(C,this,H);},getElement:function(A){return $(this.getElements(A,true)[0]||false);},getElementsBySelector:function(A,E){var D=[];
A=A.split(",");for(var C=0,B=A.length;C<B;C++){D=D.concat(this.getElements(A[C],true));}return(E)?D:$$.unique(D);}};Element.extend({getElementById:function(C){var B=document.getElementById(C);
if(!B){return false;}for(var A=B.parentNode;A!=this;A=A.parentNode){if(!A){return false;}}return B;},getElementsByClassName:function(A){return this.getElements("."+A);
}});document.extend(Element.Methods.Dom);Element.extend(Element.Methods.Dom);Element.extend({getValue:function(){switch(this.getTag()){case"select":var A=[];
$each(this.options,function(B){if(B.selected){A.push($pick(B.value,B.text));}});return(this.multiple)?A:A[0];case"input":if(!(this.checked&&["checkbox","radio"].contains(this.type))&&!["hidden","text","password"].contains(this.type)){break;
}case"textarea":return this.value;}return false;},getFormElements:function(){return $$(this.getElementsByTagName("input"),this.getElementsByTagName("select"),this.getElementsByTagName("textarea"));
},toQueryString:function(){var A=[];this.getFormElements().each(function(D){var C=D.name;var E=D.getValue();if(E===false||!C||D.disabled){return ;}var B=function(F){A.push(C+"="+encodeURIComponent(F));
};if($type(E)=="array"){E.each(B);}else{B(E);}});return A.join("&");}});Element.extend({scrollTo:function(A,B){this.scrollLeft=A;this.scrollTop=B;},getSize:function(){return{scroll:{x:this.scrollLeft,y:this.scrollTop},size:{x:this.offsetWidth,y:this.offsetHeight},scrollSize:{x:this.scrollWidth,y:this.scrollHeight}};
},getPosition:function(A){A=A||[];var B=this,D=0,C=0;do{D+=B.offsetLeft||0;C+=B.offsetTop||0;B=B.offsetParent;}while(B);A.each(function(E){D-=E.scrollLeft||0;
C-=E.scrollTop||0;});return{x:D,y:C};},getTop:function(A){return this.getPosition(A).y;},getLeft:function(A){return this.getPosition(A).x;},getCoordinates:function(B){var A=this.getPosition(B);
var C={width:this.offsetWidth,height:this.offsetHeight,left:A.x,top:A.y};C.right=C.left+C.width;C.bottom=C.top+C.height;return C;}});Element.Events.domready={add:function(B){if(window.loaded){B.call(this);
return ;}var A=function(){if(window.loaded){return ;}window.loaded=true;window.timer=$clear(window.timer);this.fireEvent("domready");}.bind(this);if(document.readyState&&window.webkit){window.timer=function(){if(["loaded","complete"].contains(document.readyState)){A();
}}.periodical(50);}else{if(document.readyState&&window.ie){if(!$("ie_ready")){var C=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<script id="ie_ready" defer src="'+C+'"><\/script>');
$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){A();}};}}else{window.addListener("load",A);document.addListener("DOMContentLoaded",A);
}}}};window.onDomReady=function(A){return this.addEvent("domready",A);};window.extend({getWidth:function(){if(this.webkit419){return this.innerWidth;}if(this.opera){return document.body.clientWidth;
}return document.documentElement.clientWidth;},getHeight:function(){if(this.webkit419){return this.innerHeight;}if(this.opera){return document.body.clientHeight;
}return document.documentElement.clientHeight;},getScrollWidth:function(){if(this.ie){return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth);
}if(this.webkit){return document.body.scrollWidth;}return document.documentElement.scrollWidth;},getScrollHeight:function(){if(this.ie){return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight);
}if(this.webkit){return document.body.scrollHeight;}return document.documentElement.scrollHeight;},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;
},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getSize:function(){return{size:{x:this.getWidth(),y:this.getHeight()},scrollSize:{x:this.getScrollWidth(),y:this.getScrollHeight()},scroll:{x:this.getScrollLeft(),y:this.getScrollTop()}};
},getPosition:function(){return{x:0,y:0};}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(A){return -(Math.cos(Math.PI*A)-1)/2;
},duration:500,unit:"px",wait:true,fps:50},initialize:function(A){this.element=this.element||null;this.setOptions(A);if(this.options.initialize){this.options.initialize.call(this);
}},step:function(){var A=$time();if(A<this.time+this.options.duration){this.delta=this.options.transition((A-this.time)/this.options.duration);this.setNow();
this.increase();}else{this.stop(true);this.set(this.to);this.fireEvent("onComplete",this.element,10);this.callChain();}},set:function(A){this.now=A;this.increase();
return this;},setNow:function(){this.now=this.compute(this.from,this.to);},compute:function(B,A){return(A-B)*this.delta+B;},start:function(B,A){if(!this.options.wait){this.stop();
}else{if(this.timer){return this;}}this.from=B;this.to=A;this.change=this.to-this.from;this.time=$time();this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);
this.fireEvent("onStart",this.element);return this;},stop:function(A){if(!this.timer){return this;}this.timer=$clear(this.timer);if(!A){this.fireEvent("onCancel",this.element);
}return this;},custom:function(B,A){return this.start(B,A);},clearTimer:function(A){return this.stop(A);}});Fx.Base.implement(new Chain,new Events,new Options);
Fx.CSS={select:function(B,C){if(B.test(/color/i)){return this.Color;}var A=$type(C);if((A=="array")||(A=="string"&&C.contains(" "))){return this.Multi;
}return this.Single;},parse:function(C,D,A){if(!A.push){A=[A];}var F=A[0],E=A[1];if(!$chk(E)){E=F;F=C.getStyle(D);}var B=this.select(D,E);return{from:B.parse(F),to:B.parse(E),css:B};
}};Fx.CSS.Single={parse:function(A){return parseFloat(A);},getNow:function(C,B,A){return A.compute(C,B);},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=Math.round(C);
}return C+A;}};Fx.CSS.Multi={parse:function(A){return A.push?A:A.split(" ").map(function(B){return parseFloat(B);});},getNow:function(E,D,C){var A=[];for(var B=0;
B<E.length;B++){A[B]=C.compute(E[B],D[B]);}return A;},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=C.map(Math.round);}return C.join(A+" ")+A;}};
Fx.CSS.Color={parse:function(A){return A.push?A:A.hexToRgb(true);},getNow:function(E,D,C){var A=[];for(var B=0;B<E.length;B++){A[B]=Math.round(C.compute(E[B],D[B]));
}return A;},getValue:function(A){return"rgb("+A.join(",")+")";}};Fx.Style=Fx.Base.extend({initialize:function(B,C,A){this.element=$(B);this.property=C;
this.parent(A);},hide:function(){return this.set(0);},setNow:function(){this.now=this.css.getNow(this.from,this.to,this);},set:function(A){this.css=Fx.CSS.select(this.property,A);
return this.parent(this.css.parse(A));},start:function(C,B){if(this.timer&&this.options.wait){return this;}var A=Fx.CSS.parse(this.element,this.property,[C,B]);
this.css=A.css;return this.parent(A.from,A.to);},increase:function(){this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property));
}});Element.extend({effect:function(B,A){return new Fx.Style(this,B,A);}});Fx.Styles=Fx.Base.extend({initialize:function(B,A){this.element=$(B);this.parent(A);
},setNow:function(){for(var A in this.from){this.now[A]=this.css[A].getNow(this.from[A],this.to[A],this);}},set:function(C){var A={};this.css={};for(var B in C){this.css[B]=Fx.CSS.select(B,C[B]);
A[B]=this.css[B].parse(C[B]);}return this.parent(A);},start:function(C){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var E={},D={};
for(var B in C){var A=Fx.CSS.parse(this.element,B,C[B]);E[B]=A.from;D[B]=A.to;this.css[B]=A.css;}return this.parent(E,D);},increase:function(){for(var A in this.now){this.element.setStyle(A,this.css[A].getValue(this.now[A],this.options.unit,A));
}}});Element.extend({effects:function(A){return new Fx.Styles(this,A);}});Fx.Elements=Fx.Base.extend({initialize:function(B,A){this.elements=$$(B);this.parent(A);
},setNow:function(){for(var C in this.from){var F=this.from[C],E=this.to[C],B=this.css[C],A=this.now[C]={};for(var D in F){A[D]=B[D].getNow(F[D],E[D],this);
}}},set:function(G){var B={};this.css={};for(var D in G){var F=G[D],C=this.css[D]={},A=B[D]={};for(var E in F){C[E]=Fx.CSS.select(E,F[E]);A[E]=C[E].parse(F[E]);
}}return this.parent(B);},start:function(D){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var I={},J={};for(var E in D){var G=D[E],A=I[E]={},H=J[E]={},C=this.css[E]={};
for(var B in G){var F=Fx.CSS.parse(this.elements[E],B,G[B]);A[B]=F.from;H[B]=F.to;C[B]=F.css;}}return this.parent(I,J);},increase:function(){for(var C in this.now){var A=this.now[C],B=this.css[C];
for(var D in A){this.elements[C].setStyle(D,B[D].getValue(A[D],this.options.unit,D));}}}});Fx.Scroll=Fx.Base.extend({options:{overflown:[],offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.now=[];
this.element=$(B);this.bound={stop:this.stop.bind(this,false)};this.parent(A);if(this.options.wheelStops){this.addEvent("onStart",function(){document.addEvent("mousewheel",this.bound.stop);
}.bind(this));this.addEvent("onComplete",function(){document.removeEvent("mousewheel",this.bound.stop);}.bind(this));}},setNow:function(){for(var A=0;A<2;
A++){this.now[A]=this.compute(this.from[A],this.to[A]);}},scrollTo:function(B,F){if(this.timer&&this.options.wait){return this;}var D=this.element.getSize();
var C={x:B,y:F};for(var E in D.size){var A=D.scrollSize[E]-D.size[E];if($chk(C[E])){C[E]=($type(C[E])=="number")?C[E].limit(0,A):A;}else{C[E]=D.scroll[E];
}C[E]+=this.options.offset[E];}return this.start([D.scroll.x,D.scroll.y],[C.x,C.y]);},toTop:function(){return this.scrollTo(false,0);},toBottom:function(){return this.scrollTo(false,"full");
},toLeft:function(){return this.scrollTo(0,false);},toRight:function(){return this.scrollTo("full",false);},toElement:function(B){var A=this.element.getPosition(this.options.overflown);
var C=$(B).getPosition(this.options.overflown);return this.scrollTo(C.x-A.x,C.y-A.y);},increase:function(){this.element.scrollTo(this.now[0],this.now[1]);
}});Fx.Slide=Fx.Base.extend({options:{mode:"vertical"},initialize:function(B,A){this.element=$(B);this.wrapper=new Element("div",{styles:$extend(this.element.getStyles("margin"),{overflow:"hidden"})}).injectAfter(this.element).adopt(this.element);
this.element.setStyle("margin",0);this.setOptions(A);this.now=[];this.parent(this.options);this.open=true;this.addEvent("onComplete",function(){this.open=(this.now[0]===0);
});if(window.webkit419){this.addEvent("onComplete",function(){if(this.open){this.element.remove().inject(this.wrapper);}});}},setNow:function(){for(var A=0;
A<2;A++){this.now[A]=this.compute(this.from[A],this.to[A]);}},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;
},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},slideIn:function(A){this[A||this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[0,this.offset]);},slideOut:function(A){this[A||this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[-this.offset,0]);},hide:function(A){this[A||this.options.mode]();
this.open=false;return this.set([-this.offset,0]);},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(A){if(this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0){return this.slideIn(A);
}return this.slideOut(A);},increase:function(){this.element.setStyle(this.margin,this.now[0]+this.options.unit);this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit);
}});Fx.Transition=function(B,A){A=A||[];if($type(A)!="array"){A=[A];}return $extend(B,{easeIn:function(C){return B(C,A);},easeOut:function(C){return 1-B(1-C,A);
},easeInOut:function(C){return(C<=0.5)?B(2*C,A)/2:(2-B(2*(1-C),A))/2;}});};Fx.Transitions=new Abstract({linear:function(A){return A;}});Fx.Transitions.extend=function(A){for(var B in A){Fx.Transitions[B]=new Fx.Transition(A[B]);
Fx.Transitions.compat(B);}};Fx.Transitions.compat=function(A){["In","Out","InOut"].each(function(B){Fx.Transitions[A.toLowerCase()+B]=Fx.Transitions[A]["ease"+B];
});};Fx.Transitions.extend({Pow:function(B,A){return Math.pow(B,A[0]||6);},Expo:function(A){return Math.pow(2,8*(A-1));},Circ:function(A){return 1-Math.sin(Math.acos(A));
},Sine:function(A){return 1-Math.sin((1-A)*Math.PI/2);},Back:function(B,A){A=A[0]||1.618;return Math.pow(B,2)*((A+1)*B-A);},Bounce:function(D){var C;for(var B=0,A=1;
1;B+=A,A/=2){if(D>=(7-4*B)/11){C=-Math.pow((11-6*B-11*D)/4,2)+A*A;break;}}return C;},Elastic:function(B,A){return Math.pow(2,10*--B)*Math.cos(20*B*Math.PI*(A[0]||1)/3);
}});["Quad","Cubic","Quart","Quint"].each(function(B,A){Fx.Transitions[B]=new Fx.Transition(function(C){return Math.pow(C,[A+2]);});Fx.Transitions.compat(B);
});var Drag={};Drag.Base=new Class({options:{handle:false,unit:"px",onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:"left",y:"top"},grid:false,snap:6},initialize:function(B,A){this.setOptions(A);
this.element=$(B);this.handle=$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.bound={start:this.start.bindWithEvent(this),check:this.check.bindWithEvent(this),drag:this.drag.bindWithEvent(this),stop:this.stop.bind(this)};
this.attach();if(this.options.initialize){this.options.initialize.call(this);}},attach:function(){this.handle.addEvent("mousedown",this.bound.start);return this;
},detach:function(){this.handle.removeEvent("mousedown",this.bound.start);return this;},start:function(C){this.fireEvent("onBeforeStart",this.element);
this.mouse.start=C.page;var A=this.options.limit;this.limit={x:[],y:[]};for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue;}this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt();
this.mouse.pos[D]=C.page[D]-this.value.now[D];if(A&&A[D]){for(var B=0;B<2;B++){if($chk(A[D][B])){this.limit[D][B]=($type(A[D][B])=="function")?A[D][B]():A[D][B];
}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}document.addListener("mousemove",this.bound.check);
document.addListener("mouseup",this.bound.stop);this.fireEvent("onStart",this.element);C.stop();},check:function(A){var B=Math.round(Math.sqrt(Math.pow(A.page.x-this.mouse.start.x,2)+Math.pow(A.page.y-this.mouse.start.y,2)));
if(B>this.options.snap){document.removeListener("mousemove",this.bound.check);document.addListener("mousemove",this.bound.drag);this.drag(A);this.fireEvent("onSnap",this.element);
}A.stop();},drag:function(A){this.out=false;this.mouse.now=A.page;for(var B in this.options.modifiers){if(!this.options.modifiers[B]){continue;}this.value.now[B]=this.mouse.now[B]-this.mouse.pos[B];
if(this.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1];this.out=true;}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0];
this.out=true;}}}if(this.options.grid[B]){this.value.now[B]-=(this.value.now[B]%this.options.grid[B]);}this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit);
}this.fireEvent("onDrag",this.element);A.stop();},stop:function(){document.removeListener("mousemove",this.bound.check);document.removeListener("mousemove",this.bound.drag);
document.removeListener("mouseup",this.bound.stop);this.fireEvent("onComplete",this.element);}});Drag.Base.implement(new Events,new Options);Element.extend({makeResizable:function(A){return new Drag.Base(this,$merge({modifiers:{x:"width",y:"height"}},A));
}});Drag.Move=Drag.Base.extend({options:{droppables:[],container:false,overflown:[]},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.droppables=$$(this.options.droppables);
this.container=$(this.options.container);this.position={element:this.element.getStyle("position"),container:false};if(this.container){this.position.container=this.container.getStyle("position");
}if(!["relative","absolute","fixed"].contains(this.position.element)){this.position.element="absolute";}var D=this.element.getStyle("top").toInt();var C=this.element.getStyle("left").toInt();
if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){D=$chk(D)?D:this.element.getTop(this.options.overflown);
C=$chk(C)?C:this.element.getLeft(this.options.overflown);}else{D=$chk(D)?D:0;C=$chk(C)?C:0;}this.element.setStyles({top:D,left:C,position:this.position.element});
this.parent(this.element);},start:function(C){this.overed=null;if(this.container){var A=this.container.getCoordinates();var B=this.element.getCoordinates();
if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){this.options.limit={x:[A.left,A.right-B.width],y:[A.top,A.bottom-B.height]};
}else{this.options.limit={y:[0,A.height-B.height],x:[0,A.width-B.width]};}}this.parent(C);},drag:function(A){this.parent(A);var B=this.out?false:this.droppables.filter(this.checkAgainst,this).getLast();
if(this.overed!=B){if(this.overed){this.overed.fireEvent("leave",[this.element,this]);}this.overed=B?B.fireEvent("over",[this.element,this]):null;}return this;
},checkAgainst:function(B){B=B.getCoordinates(this.options.overflown);var A=this.mouse.now;return(A.x>B.left&&A.x<B.right&&A.y<B.bottom&&A.y>B.top);},stop:function(){if(this.overed&&!this.out){this.overed.fireEvent("drop",[this.element,this]);
}else{this.element.fireEvent("emptydrop",this);}this.parent();return this;}});Element.extend({makeDraggable:function(A){return new Drag.Move(this,A);}});
var XHR=new Class({options:{method:"post",async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:"utf-8",autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject("Microsoft.XMLHTTP"):false);
return this;},initialize:function(A){this.setTransport().setOptions(A);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=="post"){var B=(this.options.encoding)?"; charset="+this.options.encoding:"";
this.setHeader("Content-type","application/x-www-form-urlencoded"+B);}if(this.options.initialize){this.options.initialize.call(this);}},onStateChange:function(){if(this.transport.readyState!=4||!this.running){return ;
}this.running=false;var A=0;try{A=this.transport.status;}catch(B){}if(this.options.isSuccess.call(this,A)){this.onSuccess();}else{this.onFailure();}this.transport.onreadystatechange=Class.empty;
},isSuccess:function(A){return((A>=200)&&(A<300));},onSuccess:function(){this.response={text:this.transport.responseText,xml:this.transport.responseXML};
this.fireEvent("onSuccess",[this.response.text,this.response.xml]);this.callChain();},onFailure:function(){this.fireEvent("onFailure",this.transport);},setHeader:function(A,B){this.headers[A]=B;
return this;},send:function(A,C){if(this.options.autoCancel){this.cancel();}else{if(this.running){return this;}}this.running=true;if(C&&this.options.method=="get"){A=A+(A.contains("?")?"&":"?")+C;
C=null;}this.transport.open(this.options.method.toUpperCase(),A,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=="post")&&this.transport.overrideMimeType){this.setHeader("Connection","close");
}$extend(this.headers,this.options.headers);for(var B in this.headers){try{this.transport.setRequestHeader(B,this.headers[B]);}catch(D){}}this.fireEvent("onRequest");
this.transport.send($pick(C,null));return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;
this.setTransport();this.fireEvent("onCancel");return this;}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(B,A){this.addEvent("onSuccess",this.onComplete);
this.setOptions(A);this.options.data=this.options.data||this.options.postBody;if(!["post","get"].contains(this.options.method)){this._method="_method="+this.options.method;
this.options.method="post";}this.parent();this.setHeader("X-Requested-With","XMLHttpRequest");this.setHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");
this.url=B;},onComplete:function(){if(this.options.update){$(this.options.update).empty().setHTML(this.response.text);}if(this.options.evalScripts||this.options.evalResponse){this.evalScripts();
}this.fireEvent("onComplete",[this.response.text,this.response.xml],20);},request:function(A){A=A||this.options.data;switch($type(A)){case"element":A=$(A).toQueryString();
break;case"object":A=Object.toQueryString(A);}if(this._method){A=(A)?[this._method,A].join("&"):this._method;}return this.send(this.url,A);},evalScripts:function(){var B,A;
if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){A=this.response.text;}else{A=[];var C=/<script[^>]*>([\s\S]*?)<\/script>/gi;
while((B=C.exec(this.response.text))){A.push(B[1]);}A=A.join("\n");}if(A){(window.execScript)?window.execScript(A):window.setTimeout(A,0);}},getHeader:function(A){try{return this.transport.getResponseHeader(A);
}catch(B){}return null;}});Object.toQueryString=function(B){var C=[];for(var A in B){C.push(encodeURIComponent(A)+"="+encodeURIComponent(B[A]));}return C.join("&");
};Element.extend({send:function(A){return new Ajax(this.getProperty("action"),$merge({data:this.toQueryString()},A,{method:"post"})).request();}});var Cookie=new Abstract({options:{domain:false,path:false,duration:false,secure:false},set:function(C,D,B){B=$merge(this.options,B);
D=encodeURIComponent(D);if(B.domain){D+="; domain="+B.domain;}if(B.path){D+="; path="+B.path;}if(B.duration){var A=new Date();A.setTime(A.getTime()+B.duration*24*60*60*1000);
D+="; expires="+A.toGMTString();}if(B.secure){D+="; secure";}document.cookie=C+"="+D;return $extend(B,{key:C,value:D});},get:function(A){var B=document.cookie.match("(?:^|;)\\s*"+A.escapeRegExp()+"=([^;]*)");
return B?decodeURIComponent(B[1]):false;},remove:function(B,A){if($type(B)=="object"){this.set(B.key,"",$merge(B,{duration:-1}));}else{this.set(B,"",$merge(A,{duration:-1}));
}}});var Json={toString:function(C){switch($type(C)){case"string":return'"'+C.replace(/(["\\])/g,"\\$1")+'"';case"array":return"["+C.map(Json.toString).join(",")+"]";
case"object":var A=[];for(var B in C){A.push(Json.toString(B)+":"+Json.toString(C[B]));}return"{"+A.join(",")+"}";case"number":if(isFinite(C)){break;}case false:return"null";
}return String(C);},evaluate:function(str,secure){return(($type(str)!="string")||(secure&&!str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/)))?null:eval("("+str+")");
}};Json.Remote=XHR.extend({initialize:function(B,A){this.url=B;this.addEvent("onSuccess",this.onComplete);this.parent(A);this.setHeader("X-Request","JSON");
},send:function(A){return this.parent(this.url,"json="+Json.toString(A));},onComplete:function(){this.fireEvent("onComplete",[Json.evaluate(this.response.text,this.options.secure)]);
}});var Asset=new Abstract({javascript:function(C,B){B=$merge({onload:Class.empty},B);var A=new Element("script",{src:C}).addEvents({load:B.onload,readystatechange:function(){if(this.readyState=="complete"){this.fireEvent("load");
}}});delete B.onload;return A.setProperties(B).inject(document.head);},css:function(B,A){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:B},A)).inject(document.head);
},image:function(C,B){B=$merge({onload:Class.empty,onabort:Class.empty,onerror:Class.empty},B);var D=new Image();D.src=C;var A=new Element("img",{src:C});
["load","abort","error"].each(function(E){var F=B["on"+E];delete B["on"+E];A.addEvent(E,function(){this.removeEvent(E,arguments.callee);F.call(this);});
});if(D.width&&D.height){A.fireEvent("load",A,1);}return A.setProperties(B);},images:function(D,C){C=$merge({onComplete:Class.empty,onProgress:Class.empty},C);
if(!D.push){D=[D];}var A=[];var B=0;D.each(function(F){var E=new Asset.image(F,{onload:function(){C.onProgress.call(this,B);B++;if(B==D.length){C.onComplete();
}}});A.push(E);});return new Elements(A);}});var Tips=new Class({options:{onShow:function(A){A.setStyle("visibility","visible");},onHide:function(A){A.setStyle("visibility","hidden");
},maxTitleChars:30,showDelay:100,hideDelay:100,className:"tool",offsets:{x:16,y:16},fixed:false},initialize:function(B,A){this.setOptions(A);this.toolTip=new Element("div",{"class":this.options.className+"-tip",styles:{position:"absolute",top:"0",left:"0",visibility:"hidden"}}).inject(document.body);
this.wrapper=new Element("div").inject(this.toolTip);$$(B).each(this.build,this);if(this.options.initialize){this.options.initialize.call(this);}},build:function(B){B.$tmp.myTitle=(B.href&&B.getTag()=="a")?B.href.replace("http://",""):(B.rel||false);
if(B.title){var C=B.title.split("::");if(C.length>1){B.$tmp.myTitle=C[0].trim();B.$tmp.myText=C[1].trim();}else{B.$tmp.myText=B.title;}B.removeAttribute("title");
}else{B.$tmp.myText=false;}if(B.$tmp.myTitle&&B.$tmp.myTitle.length>this.options.maxTitleChars){B.$tmp.myTitle=B.$tmp.myTitle.substr(0,this.options.maxTitleChars-1)+"&hellip;";
}B.addEvent("mouseenter",function(D){this.start(B);if(!this.options.fixed){this.locate(D);}else{this.position(B);}}.bind(this));if(!this.options.fixed){B.addEvent("mousemove",this.locate.bindWithEvent(this));
}var A=this.end.bind(this);B.addEvent("mouseleave",A);B.addEvent("trash",A);},start:function(A){this.wrapper.empty();if(A.$tmp.myTitle){this.title=new Element("span").inject(new Element("div",{"class":this.options.className+"-title"}).inject(this.wrapper)).setHTML(A.$tmp.myTitle);
}if(A.$tmp.myText){this.text=new Element("span").inject(new Element("div",{"class":this.options.className+"-text"}).inject(this.wrapper)).setHTML(A.$tmp.myText);
}$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);},end:function(A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);
},position:function(A){var B=A.getPosition();this.toolTip.setStyles({left:B.x+this.options.offsets.x,top:B.y+this.options.offsets.y});},locate:function(B){var D={x:window.getWidth(),y:window.getHeight()};
var A={x:window.getScrollLeft(),y:window.getScrollTop()};var C={x:this.toolTip.offsetWidth,y:this.toolTip.offsetHeight};var G={x:"left",y:"top"};for(var E in G){var F=B.page[E]+this.options.offsets[E];
if((F+C[E]-A[E])>D[E]){F=B.page[E]-this.options.offsets[E]-C[E];}this.toolTip.setStyle(G[E],F);}},show:function(){if(this.options.timeout){this.timer=this.hide.delay(this.options.timeout,this);
}this.fireEvent("onShow",[this.toolTip]);},hide:function(){this.fireEvent("onHide",[this.toolTip]);}});Tips.implement(new Events,new Options);	
﻿Array.extend({
	mEach:function(fn,bind){
		for (var i in this) {
			if (this.hasOwnProperty(i)) {
				fn.call(bind, this[i], i, this);
			}
		}
	}
});
var mUtils={
	gatValidDate: function(mydate){
		try{
			var dayfield=mydate.split("/")[0]
			var monthfield=mydate.split("/")[1]
			var yearfield=mydate.split("/")[2]
			var dateobj = new Date(yearfield, monthfield-1, dayfield)
			if (dateobj.getMonth()+1==monthfield && dateobj.getDate()==dayfield && dateobj.getFullYear()==yearfield){
				return dateobj
			}
		}catch(e){}
		return false
	},
	getImgNaturalDimentions: function(img) {
        var result={width:0,height:0}
        if( img.naturalHeight ) {
            result.width=img.naturalWidth;
            result.height=img.naturalHeight;
        } else {
            lgi = new Image();
            lgi.src = img.src;
            result.width=lgi.width;
            result.height=lgi.height;
        }
        return result;
    },
		getCenteredPosition: function(element,elHeight,elWidth){
			var result={top:0,left:0}
			if(!element)
				return result;
			if(!elHeight){
				elHeight=element.offsetHeight;
			}
			if(!elWidth){
				elWidth=element.offsetWidth;
			}
			result.top = (document.body.clientHeight/2-elHeight/2)+((e=document.documentElement.scrollTop)?e:document.body.scrollTop); 
			result.left= document.body.clientWidth/2-elWidth/2;
			return result;
		},
		ajax: function(options){
			options = options || {};
			var url = options.url;
			var data="";
			if(options.data){
				data = Object.toQueryString(options.data);
			}else if(options.dataParams){
				data=options.dataParams;
			}
			
			var successCallback = options.successCallback;
			var failureCallback = options.failureCallback;
			var jsonRequest = new Ajax(options.url, {data:data,
		  		onComplete: function(resp){
    		      	var respE=Json.evaluate(resp);
    		        if(!respE.isError){
    		        	if (options.successCallback)
    		          	options.successCallback(respE);
    		      	}else{
    		        	if (options.failureCallback)
    		          	options.failureCallback(respE);
    		       	}
		     	},
		      onFailure: function(resp) {
		      	var respE = Json.evaluate(resp.responseText);
		        if (options.failureCallback)
		        	options.failureCallback(respE);
		     	}
		   	}
			).request();
			return jsonRequest;
		},

    generateLines: function(templateId, props) {
        var template = $(templateId) //document.getElementById(templateId)
        
        // store the request, if any
        var _request = props._request
        if (_request)
            templatesRequest[templateId] = _request
      
        // reset the template to the original state, if any
        var origTemplate = templatesOrig[ templateId ]
        if (origTemplate == undefined)
            templatesOrig[ templateId ] = template.innerHTML
        else
            template.innerHTML = origTemplate
      
        var c = 0
        var specials = {}
      
        var trs = template.getElements( "*[class^=repeatClass]" )

        for (var i = 0; i < trs.length; ++i){
            var tr = trs[i]
            var csp = tr.className.split(" ",2)
            var list = props[ csp[1] ]
            tr.className = tr.className.replace(/repeatClass\s+\S+(\s|$)(.*)/, "$2")

            if (list != null){
                for (var j=0; j < list.length; ++j){
                    specials["even"] = j%2==0 ? "even" : "odd"
                    specials["ord"] = j

                    ntr = tr.parentNode.insertBefore( tr.cloneNode(true), tr )

                    if (ntr.className)
                        ntr.className = mUtils.replace( ntr.className, props, list[j], specials )

                    var MOD_ATTR = { id:1, name:1, safeonclick:1, safestyle:1, value:1 }
                    for (var a in MOD_ATTR){
                        var v = ntr.getAttribute(a)
                        if (!v)
                            continue
                        v = mUtils.replace(v, props, list[j], specials)
                        if (a.substring(0,4)=="safe"){
                            ntr.setAttribute(a.substring(4), v)
                            continue
                        }
                        ntr.setAttribute(a, v)
                    }
                  
                    props["__"+c] = mUtils.replace(ntr.innerHTML, props, list[j], specials)
                    ntr.innerHTML = "%__"+ c++ +"%"
                }
            }

            tr.parentNode.removeChild( tr )
        }
        //alert(template.innerHTML);
        template.innerHTML = mUtils.replace(template.innerHTML, props, {}, {})
        //alert(template.innerHTML);
        template.getElements('img').each(function(img) {
            if (img.getAttribute("safesrc")){
                img.src = img.getAttribute("safesrc");
            }
        })
        template.style.display = ""

    },

    replace: function(s, globals, locals, specials) {
      var out = ""
      var inp = false
      var last = 0
      var i = s.indexOf('%')
      while (i >= 0){
          if ( ! inp ){
              out += s.substring(last, i)
          }
          else {
              var v = s.substring(last+1, i++)
              if ( v.length == 0 )
                  out += "%"
              else if ( v.charAt(0) == "#" && specials[v.substring(1, v.length)] != undefined )
                  out += specials[ v.substring(1, v.length) ]
              else if( v.charAt(0) == "." && locals[v.substring(1, v.length)] != undefined )
                  out += locals[ v.substring(1, v.length) ]
              else if( globals[v] != undefined )
                  out += globals[ v ]
          }

          inp = !inp
          last = i
          i = s.indexOf('%', last+1)
      }

      out += s.substring(last)

      return out
    },
  sendEmailInfo: function(options){
if(window.console) console.log("TAVEGGIA ROOT/javascript/marenauta.js "+options.checkin+" "+options.boatId+" "+options.durata+" "+options.from+" "+options.tel+" "+options.msg+" "+options.prezzo);

  	options=options||{};
  	var hoverDiv;
  	if(options.preStart){
  		options.preStart();
  	}else{
  		hoverDiv = new Element('div').setStyles({'position':'absolute','top':'0px','left':'0px','background-color':'#000000','z-index':1000}).injectInside(document.body);
  		hoverDiv.setOpacity(0.8);
  		hoverDiv.setStyles(getBodySize());
  		hoverDiv.id="asfsadgdsasfa";
  		var loadingText= new Element('div').setStyles({'width':'100%','text-align':'center','font-size':'30px','color':'#FFFFFF','position':'absolute','top':'670px','z-index':1001, 'left':'0px'}).injectAfter(hoverDiv);
  		loadingText.innerHTML="sending...";
  		loadingText.id="asfsadgdsasf";
  	}
  	mUtils.ajax({
        url: "/commands/sendEmailInfo.jsp",
        data: { "checkin": options.checkin, "boatId": options.boatId, "durata": options.durata, "from": options.from, "tel": options.tel, "msg": options.msg, "costruttore": options.costruttore, "modello": options.modello, "comune": options.comune, "prezzo": options.prezzo, "sconto": options.sconto, "prezzoScontato": options.prezzoScontato },
        successCallback: function(respE){
            if(options.callBack){
        		options.callBack(respE);
        	}else{
            	if (respE.result == "OK"){
	            	loadingText.setStyles({'font-size':'20px'});
	            	loadingText.innerHTML="Grazie per averci contattato. <br><br>Un nostro operatore ti contatterà il prima possibile.<br><br><a href=\"javascript:null\" onclick=\"$('"+hoverDiv.id+"').remove();$('"+loadingText.id+"').remove();\" ><img src='/images/prAvanti.png'/>";
	            }else{
	            	alert("Si sono verificati dei problemi durante l'invio del messaggio. Riprovare piu tardi.");
	            }
	       	}
        }
    })
	},

  sendEmail: function(options){
  	options=options||{};
  	var hoverDiv;
  	if(options.preStart){
  		options.preStart();
  	}else{
  		hoverDiv = new Element('div').setStyles({'position':'absolute','top':'0px','left':'0px','background-color':'#000000','z-index':1000}).injectInside(document.body);
  		hoverDiv.setOpacity(0.8);
  		hoverDiv.setStyles(getBodySize());
  		hoverDiv.id="asfsadgdsasfa";
  		var loadingText= new Element('div').setStyles({'width':'100%','text-align':'center','font-size':'30px','color':'#FFFFFF','position':'absolute','top':'670px','z-index':1001, 'left':'0px'}).injectAfter(hoverDiv);
  		loadingText.innerHTML="sending...";
  		loadingText.id="asfsadgdsasf";
  	}
  	mUtils.ajax({
        url: "/commands/sendEmail.jsp",
        data: { fromAddress: options.from, subject:options.subj, body:options.body ,subType:options.subType},
        successCallback: function(respE){
            if(options.callBack){
        		options.callBack(respE);
        	}else{
            	if (respE.result == "OK"){
	            	loadingText.setStyles({'font-size':'20px'});
	            	loadingText.innerHTML="Grazie per averci contattato. <br><br>Un nostro operatore ti contatterà il prima possibile.<br><br><a href=\"javascript:null\" onclick=\"$('"+hoverDiv.id+"').remove();$('"+loadingText.id+"').remove();\" ><img src='/images/prAvanti.png'/>";
	            }else{
	            	alert("Si sono verificati dei problemi durante l'invio del messaggio. Riprovare piu tardi.");
	            }
	       	}
        }
    })
  },
  pushFields: function(fields, cont, extCont){
      f = []; fExt = []
      for (i = 0; i < fields.length; ++i){
          if (fields[i][2]) var a = fExt
          else var a = f
          var fieldLabel=fields[i][0];
          if(fields[i][3])
          	fieldLabel=fields[i][3].fieldLabel;
          a.push('<div class="field"><span class="key">')
          a.push(fieldLabel)
          a.push('&nbsp;</span><span>')
          a.push(fields[i][1])
          a.push('</div></div>')
      }
      extCont.innerHTML = fExt.join("") + extCont.innerHTML
      cont.innerHTML = f.join("") + cont.innerHTML
  }
  ,
  round: function(num, dec, rm0){
      var e = Math.pow(10,dec)
      return Math.round(num*e)/e
      /*
      var ret = Math.round((num*e)/e)
      var d = Math.round((num*e)%e)
      if (d==0
      if (rm0) ret = ret.replace(/[0.]+$/,"")
      */
  },
  startsWith: function(str,key){
  	return (str.match("^"+key)==key)
  },
  showHide: function(ahref){
		var isOpen=ahref.getAttribute("status")=="opened";
		$(ahref.getAttribute("shElement")).style.display=isOpen?"none":"";
		ahref.innerHTML=isOpen?ahref.getAttribute("shMsgClosed"):ahref.getAttribute("shMsgOpened");
		ahref.setAttribute("status",isOpen?"closed":"opened");
	}
}
var mEffects={
  	init: function(){
		    mEffects.createRegioniSel();
		    mEffects.createBasiSel();
		    mEffects.createTipiSel();
  	},
  showShadow: function(element){
  	element.getElement("div.ico").style.left="2px";
  	var shCh=element.getElement("div.shadowChild");
  	if(shCh){
  		shCh.style.display="";
  		return;
  	}
  	var height=parseInt(element.getSize().size.y)+3;
	var width=parseInt(element.getSize().size.x)+6;
	var shadowDiv = new Element('div').setStyles({'position':'absolute','left':'3px','top':'3px','height':height,'width':width}).injectBefore(element.getChildren()[0]);
	
	shadowDiv.className="shadowChild";
	var rightTopShadow = new Element('img').setStyles({'position':'absolute','right':'0','top':'0'}).injectInside(shadowDiv).src="/images/shadow_top_right.png";
	var rightVerticalShadow = new Element('div').setStyles({'position':'absolute','right':'0','top':'12','background-image':'url(/images/shadow_right_vertical.png)','width':'12px','height':(height-24)}).injectInside(shadowDiv);
	var rightBottomShadow = new Element('img').setStyles({'position':'absolute','right':'0','bottom':'0'}).injectInside(shadowDiv).src="/images/shadow_bottom_right.png";
	var bottomHorizonalShadow = new Element('img').setStyles({'position':'absolute','right':'12','bottom':'0','width':(width-24),'height':'12px'}).injectInside(shadowDiv).src="/images/shadow_bottom_horizontal.png";
	var bottomLeftShadow = new Element('img').setStyles({'position':'absolute','left':'0','bottom':'0'}).injectInside(shadowDiv).src="/images/shadow_bottom_left.png";
  },
  hideShadow:function(element){
  	element.getElement("div.ico").style.left="0px";
  	element.getElement("div.shadowChild").style.display="none";
  },
  createShadows: function(container){
  	var container = container || document.documentElement;
  	container.getElementsByClassName("superShadow").each(function(element){
  		showShadow(element);
  	});
  },
	regioniChanged: function(){
		mEffects.createBasiSel();
	},
	typeChanged: function(){
		//mEffects.createRegioniSel({type:mEffects.getTypeFromSelect()});
		mEffects.createRegioniSel();
		mEffects.createBasiSel();
	},
	getTypeFromSelect: function(){
		var boatType="all"
		switch($('tipo').value){
			case "Barca a vela":
				boatType="sails";
			break;
			case "Motoscafo":
				boatType="motors";
			break;
			case "Yacht":
				boatType="yachts";
			break;
			case "Catamarano":
				boatType="catamarans";
            break;
			case "Gulet":
				boatType="gulets";
			break;
			case "Gommone":
				boatType="gommons";
			break;
		}
		return boatType;
	},
	createBasiSel:function(){
		var selb=$('base');
		var selValue=selb.value;
		var selr=$('regione');
		var boatType=mEffects.getTypeFromSelect();
		var isWe=$("durata").value=="2";
		selb.options.length = 1;
    while(selb.length>1){
          selb.remove(selb.length-1);
    }
    if(selr.value==ALLREGVALUE){
	    STATI[ALLREGVALUE].regioni.mEach(function(regione){
	    	regione.basi.mEach(function(base){
	    		var numbarche=0;
	    		if(boatType=="all"){
	    			if(isWe)
	    			    numbarche=base.sailsWE+base.motorsWE+base.catamaransWE+base.guletsWE+base.gommonsWE;
	    			else
	    			    numbarche=base.sails+base.motors+base.catamarans+base.gulets+base.gommons;
	    			
	    		}else{
						if(isWe)
						    numbarche=eval("base."+boatType+"WE");		    		
						else
						    numbarche=eval("base."+boatType);		    		
	    		}
	    		selb.options[selb.options.length] = new Option(base.nome+" ("+(numbarche)+")", base.nome);	    	 	
	    	});
	    });
		}else{
			var currRegion=selr.value;
			if(mUtils.startsWith(currRegion,STATE_ASSETS["ALL_LABEL"].value)){
				currRegion=currRegion.substring(STATE_ASSETS["ALL_LABEL"].value.length,currRegion.length);
			}
			if(STATI[currRegion]){
				STATI[currRegion].regioni.mEach(function(regione){
					regione.basi.each(function(base){
		    	 	if(boatType=="all"){
	    				if(isWe)
	    				    numbarche=base.sailsWE+base.motorsWE+base.catamaransWE+base.guletsWE+base.gommonsWE;
	    				else
	    				    numbarche=base.sails+base.motors+base.catamarans+base.gulets+base.gommons;
		    		}else{
							if(isWe)
							    numbarche=eval("base."+boatType+"WE");		    		
							else
							    numbarche=eval("base."+boatType);		    		
		    		}
		    	 	selb.options[selb.options.length] = new Option(base.nome+" ("+(numbarche)+")", base.nome);	    	 	
		    	});
				});
			}else{
				STATI.mEach(function(STATO){
					if(STATO.stato!=ALLREGVALUE){
						STATO.regioni.mEach(function(regione){
							if(regione.nome==currRegion){
								regione.basi.each(function(base){
					    	 	if(boatType=="all"){
				    				if(isWe)
				    				    numbarche=base.sailsWE+base.motorsWE+base.catamaransWE+base.guletsWE+base.gommonsWE;
				    				else
				    				    numbarche=base.sails+base.motors+base.catamarans+base.gulets+base.gommons;
					    		}else{
										if(isWe)
										    numbarche=eval("base."+boatType+"WE");		    		
										else
										    numbarche=eval("base."+boatType);		    		
					    		}
					    	 	selb.options[selb.options.length] = new Option(base.nome+" ("+(numbarche)+")", base.nome);	    	 	
					    	});
					    	return;
					    }
						});
					}
				});
			}
		}
		if(selValue)selb.value=selValue;
	},
	createRegioniSel: function(){
		//options=options||{};
		var boatType=mEffects.getTypeFromSelect();
		var isWe=$("durata").value=="2";
		var sel=$('regione');
		var selValue=sel.value;
        sel.options.length = 0;
        sel.innerHTML="";
        STATI.mEach(function(STATO){
        	if(STATO.stato==ALLREGVALUE){
        		var numBarcheAll=0;
        		STATI.mEach(function(STATOX){
        			if(STATOX.stato!=ALLREGVALUE){
    	    			STATOX.regioni.mEach(function(region){
    		    			if(boatType=="all"){
    		    				if(isWe)
    		    				    numBarcheAll+=region.sailsWE+region.motorsWE+region.yachtsWE+region.catamaransWE+region.guletsWE+region.gommonsWE;
    		    				else
    		    				    numBarcheAll+=region.sails+region.motors+region.yachts+region.catamarans+region.gulets+region.gommons;
    		    			}else{
    		    			    if(isWe)
    		    			        numBarcheAll+=eval("region."+boatType+"WE");
    		    			    else
    		    				    numBarcheAll+=eval("region."+boatType);
    		    			}
    		    		});
    		    	}
    	    	});
        		var opt = document.createElement("option");
    				opt.value = ALLREGVALUE;
    				opt.appendChild(document.createTextNode(eval("STATO.assets."+globalLang)+" ("+numBarcheAll+")"));
        		sel.appendChild(opt);
        	}else{
    	    	var numBarcheStato=0;
    	    	STATO.regioni.mEach(function(region){
    	    		if(boatType=="all"){
        				if(isWe)
	    				    numBarcheStato+=region.sailsWE+region.motorsWE+region.yachtsWE+region.catamaransWE+region.guletsWE+region.gommonsWE;
	    				else
	    				    numBarcheStato+=region.sails+region.motors+region.yachts+region.catamarans+region.gulets+region.gommons;
        			}else{
        				if(isWe)
        				    numBarcheStato+=eval("region."+boatType+"WE");
        				else
        				    numBarcheStato+=eval("region."+boatType);
        			}
    	    	});
    	    	var oGroup = document.createElement('optgroup');
    	    	oGroup.label=eval("STATO.assets."+globalLang);
    	    	var opt = document.createElement("option");
    				opt.value = STATE_ASSETS["ALL_LABEL"].value+STATO.stato;
    				opt.appendChild(document.createTextNode(eval('STATE_ASSETS["ALL_LABEL"].'+globalLang)+eval("STATO.assets."+globalLang)+" ("+numBarcheStato+")"));
    	    	oGroup.appendChild(opt);
    	    	STATO.regioni.mEach(function(region){
    		    	if(region.nome!=STATO.stato)
    			    {
    			    	var numBarcheR=0;
    				    if(boatType=="all"){
    	    			    if(isWe)	
    	    			        numBarcheR+=region.sailsWE+region.motorsWE+region.yachtsWE+region.catamaransWE+region.guletsWE+region.gommonsWE;
    	    				else    
    	    				    numBarcheR+=region.sails+region.motors+region.yachts+region.catamarans+region.gulets+region.gommons;
    	    			}else{
    	    				if(isWe)
    	    				    numBarcheR+=eval("region."+boatType+"WE");
    	    				else
    	    				    numBarcheR+=eval("region."+boatType);
    	    			}
    			    	var sellabel=region.nome;
    			    	if(region.assets && eval("region.assets."+globalLang))
    			    		sellabel=eval("region.assets."+globalLang);
    			    	var opt = document.createElement("option");
    						opt.value = region.nome;
    						opt.appendChild(document.createTextNode(sellabel+" ("+ (numBarcheR) + ")"));
    			    	oGroup.appendChild(opt);
    			    }
    		    });
    	    	sel.appendChild(oGroup);
    	    }
        });
        if(selValue)sel.value=selValue;
	},
	createTipiSel: function(){
		var selt=$('tipo');
    TIPI.each(function(tipo){
    	selt[selt.length] = new Option(eval("tipo.label_"+globalLang),tipo.tipo);
    });
	},

	setLoading: function(options){
	  	var styles=options.styles||{};
    
	    $("bodyt").getElements(".bodytModule").each( function(element){
	        try{
	            element.setStyles({'display':'none'});
	        }catch(e){;}
	    })
	  	while($('loadingDiv')){
	  		$('loadingDiv').remove();
	  	}
	  	
	  	var loadingDiv = new Element('div').setStyles(styles).setProperty('id', 'loadingDiv').injectInside($('bodytchild'));
	  	loadingDiv.innerHTML="<center><div id='loadinginside'><img src='/images/ajax-loader.gif'/></div>";	
	},

	setLoadingTav: function(options){
	  	var styles=options.styles||{};
    
	    $("bodyContainer").getElements("showBoat").each( function(element){
	        try{
	            element.setStyles({'display':'none'});
	        }catch(e){;}
	    })
	  	while($('loadingDiv')){
	  		$('loadingDiv').remove();
	  	}
	  	
	  	var loadingDiv = new Element('div').setStyles(styles).setProperty('id', 'loadingDiv').injectInside($('bodytchild'));
	  	loadingDiv.innerHTML="<center><div id='loadinginside'><img src='/images/ajax-loader.gif'/></div>";	
	},

	stopLoading: function(divE){
		$(divE).style.display="";
	  	(function(){try{$('loadingDiv').remove();}catch(e){}}).delay(10);
	},
	setStyles: function(options){
		options=options||{};
 		var styles  = options.styles;
 		var element = options.element;
 		options.element.style.zIndex=1000;
 		var startOpacity = options.startOpacity;
 		if(startOpacity)
 			element.setOpacity(startOpacity);
 		var fx = new Fx.Styles(element, {'duration':300, 'wait':false,'onComplete':function(){
 			var endOpacity = options.endOpacity;
 			if(endOpacity){
 				var fx2 = new Fx.Styles(element, {'duration':300, 'wait':false});
 				fx2.start({'opacity':endOpacity});
 			}
 		}});
 		fx.stop();
 		fx.start(styles);
 	},
  setLMHoverFx: function(element){
		var fx = new Fx.Styles(element, {duration:300, wait:false});
		element.addEvent('mouseenter', function(){
			fx.stop();
			fx.set({'color': '#5C9DDE'});
		});
		element.addEvent('mouseleave', function(){
			fx.start({'color':'#000000'});
		});
		element.addEvent('click', function(e){
			mPersistence.showBarca({evnt:e,data:{id:element.id.substring(3,element.id.length),checkin:element.getElements( '*[class^=hiddenData]' )[0].getAttribute('checkin'),durata:element.getElements( '*[class^=hiddenData]' )[0].getAttribute('durata')}});
		});
	}
}
var mPersistence={
	lastSearchOptions:null,
	init:function(){
		$('myForm').addEvent('submit', function(e) {
        new Event(e).stop();
        if($('date').value!="" && $('durata').value=="")
				$('durata').value=7;
        mPersistence.searchBoats({action:$('myForm').action,params:$('myForm').toQueryString()});
  	});
    mUtils.pushFields(FIELDS, $("descriptionLeft"), $("extFields"))
	},
	searchBoats:function(options){
		mPersistence.lastSearchOptions=options;
		options=options || {};
		options.action=options.action||$('myForm').action;
		options.params=options.params||"";
		$("dynamicStuff").style.display="";
		mEffects.setLoading({div:'boatResults'});
		//var safeParams=options.params.replace(/[&]+/g, "$");
		var safeParams=historyIFunctions.getSafeParams(options.params);

		dhtmlHistory.add('f:searchBoatsH,i:'+safeParams,{
			'funct':historyIFunctions.searchBoatsM, 
			'data':options
		});
		mUtils.ajax({
			url: options.action,
			dataParams:options.params,
            successCallback: mPersistence.searchCallback
        });
	},
	getLastMinutes:function(options){
		options=options||{};
		options.params=options.params||{};
		options.page=options.page||0;
		$('LMContainer').style.display="none";
		$('LMLoading').style.display="";
		var dataDiv=$('LMDiv').getElements( "*[class^=pageData]" )[0];
	    var page=dataDiv.getAttribute("page");		
	    if(page.indexOf("%")!=-1)
	    	page=0;
	    
	    options.params.page=parseInt(page)+parseInt(options.page);
		mUtils.ajax({
			url: '/commands/lastMinute.jsp',
			dataParams:options.params,
            successCallback: mPersistence.getLastMinutesCalback
        });
	},
	getLastMinutesCalback:function(respE){
		mUtils.generateLines( 'LMDiv', respE );
		$('LMContainer').style.display="";
		$('LMLoading').style.display="none";	
		var lmList = $('LMDiv').getElementsByClassName('LMRow');
		for(i=0;i<lmList.length;i++){
			mEffects.setLMHoverFx(lmList[i]);	
		}
		if(respE.page==0)
			$('LMPrec').style.display="none";
		if(respE.page==respE.lastPage)
			$('LMSucc').style.display="none";
	},
	searchBoatsX:function(options){
		options=options || {};
		options.action=options.action||$('myForm').action;
		options.params=options.params||"";
		$("dynamicStuff").style.display="";
		mEffects.setLoading({div:'boatResults'});
		mUtils.ajax({
			url: options.action,
			dataParams:options.params,
            successCallback: mPersistence.searchCallback
        });
	},
    unloadBarca: function(id){
        mPersistence.searchBoats(mPersistence.lastSearchOptions);
        /*if(!$(id)){
        	mPersistence.searchBoats();
        }else{
        	history.back();
        }
        */
        /*$("showBoat").style.display = "none"
        $("boatResults").style.display = ""
        if(!$(id)){
        	mPersistence.searchBoats();
        }
        */
    },

	showBarca: function(options){
      	var dataA=options.data;
	  		var dataParams="id="+dataA.id;
	  		if(dataA.checkin){
	      	dataParams+="&checkin="+dataA.checkin+"&durata="+dataA.durata;
	      }
	  		
	  		if(options.evnt && options.evnt.ctrlKey){
	  			var locLang = "";
		  		if(dataA.lang){
			  		if(dataA.lang != "it"){
							locLang = "/"+dataA.lang;
		      		dataParams+="&lang="+dataA.lang;
			  		}
		      }
	  			window.open(locLang+'/#f:showBarcaH,i:'+dataParams);
	  			return;
	  		}
		  	$("dynamicStuff").style.display="";
				mEffects.setLoading({/*div:'showBoat'*/});
        mUtils.ajax({
            url: "/commands/showBoat.jsp",
            data: dataA,
            successCallback: function(respE){
                var showBoatDiv = $("showBoat");
                mUtils.generateLines( showBoatDiv.id, respE );
                
                mEffects.stopLoading( showBoatDiv.id );
								boatindex=0;
                $('boatSmallImages').getElements('.sbImg').each(function(element) {
                    if(boatindex>11){
                    	element.getParent().getParent().getParent().style.display="none";
                    }else{
	                    element.style.zIndex=(11-boatindex);
	                    if(boatindex == 0){
	                    		popBox.pop({'element': element,'destination': $("mainImg"),'width': 303,'height': 240,'newSrc': element.src.replace(/small.jpg$/, "big.jpg")});
	                    }
	                    element.addEvent('mouseenter', function(){
	                        element.getParent().getParent().setStyles({'border-width': '1px','border-style': 'solid', 'border-color':'Gray'});
	                    });
	                    element.addEvent('mouseout', function(){
	                        element.getParent().getParent().setStyles({'border-width': '1px','border-style': 'solid', 'border-color':'#D3D3D3'});
	                    });
	                    element.addEvent('click', function(){
	                        popBox.pop({'element': element,'destination': $("mainImg"),'width': 303,'height': 240,'newSrc': element.src.replace(/small.jpg$/, "big.jpg")})
	                    });
                    }
                    boatindex++;
                });
                $("showBoatDurata").value=respE.durata||"7";
                
                if(respE.prezziwe.length==0){
                    $("prezziwediv").style.display="none";
                    if($("showBoatDurata").options[0].value==2)
                        $("showBoatDurata").options[0]=null;
                }else{
                    if($("showBoatDurata").options[0].value!=2)
                        $("showBoatDurata").add(new Option("week-end",2),0);
                    $("prezziwediv").style.display="";
                }
                    
                dhtmlHistory.add('f:showBarcaH,i:'+historyIFunctions.getSafeParams(dataParams),{
	        				'funct':historyIFunctions.showBarcaM,
	        				'data':dataA
	        			});
	        			pageTracker._trackPageview("/showBoat"); 
            }
        })
        
	},
	updateCartShowBarca: function(idbarca){
		var selectedDaysArray=new Array();
		var checkin=$("showBoatCheckin").value;
		var durata=$("showBoatDurata").value;
		
		var delIndex1=checkin.indexOf("/");
		var delIndex2=checkin.indexOf("/",delIndex1+1);
		var day=checkin.substring(0,delIndex1);
		var month=checkin.substring(delIndex1+1,delIndex2);
		var year=checkin.substring(delIndex2+1,checkin.length);			
    var currDate=new Date(year+"/"+month+"/"+day);
    for(var i=0;i<durata;i++){
    	selectedDaysArray.push(currDate.getFullYear()+"/"+(currDate.getMonth()+1)+"/"+currDate.getDate());
    	currDate.setDate(currDate.getDate()+1);
    }
    var data = {}
    data["idBarca"] = idbarca
    data["selectedDays"] = selectedDaysArray

    mUtils.ajax({
        url: "/commands/updateCart.jsp",
        data: data, //{ id: barca.id },
        successCallback: function(respE){
            var d = $("showBoat").getElementsByClassName("prezzoSelezione")[0]
            /*
            if (!obj.selectedDays.length){
                d.parentNode.style.display = "none"
                return
            }
            */

            var prezzo = respE.prezzo

            var values = d.getElementsByClassName("prezzoVal")
            values[0].innerHTML =  checkin + " " + durata
            if(!Math.round(respE.prezzo.full)){
            	values[1].innerHTML = "<span style='color:red;'>L'imbarcazione non è disponibile nel periodo scelto</span>" // %prezzo%
            	values[2].innerHTML = "N/A" // %sconto%
            	values[3].innerHTML = "N/A&nbsp;&nbsp;" // %prezzoScontato%
            }else{
	            values[1].innerHTML = Math.round(respE.prezzo.full) + " €" // %prezzo%
	
	      			var sconto = (100 - Math.round(100 * prezzo.discountedNotTotal / prezzo.full)) + "%"
	            if (prezzo.discounted != prezzo.discountedNotTotal)
	              sconto = sconto + " + " + Math.round(respE.sconto.TOTALE.percent) + "%"
	            if ((100 - Math.round(100 * prezzo.discountedNotTotal / prezzo.full))==0 )
	          	  sconto = Math.round(respE.sconto.TOTALE.percent) + "%"
	            values[2].innerHTML = sconto // %sconto%
	            values[3].innerHTML = Math.round(prezzo.discounted) + " €"+" &nbsp;&nbsp;" // %prezzoScontato%
	       		}
       		 	d.parentNode.className = ""
            d.parentNode.style.display = ""
        }
    });
	},
	showBarcaPrenota: function(boatId,options){
		var options=options||{};
		//mEffects.setLoading({/*div:'showBoat'*/});
		$('step1Div').style.display="none";
	  	$('stepsLoadingDiv').style.display="";
		(function(){
            var showBoatDiv = $("showBoat")
            
            var dataA={};
	        dataA.id=boatId;
	        try{
		        dataA.checkin=options.checkin;
		        dataA.durata=options.durata;
		  	}catch(e){}
            
            mUtils.ajax({
                url: "/commands/showBoat.jsp",
                data: dataA,
                successCallback: function(respE){
                    window.barca = respE

                    SCONTI = []
                    SCONTIMANYWEEKS = []
                    for (i=0; i<barca.sconti.length; ++i){
                        var sconto = barca.sconti[i]
                        if (sconto.tipo == "FIRSTMINUTE" || sconto.tipo == "LASTMINUTE")
                            SCONTI.push(new StartingDateDiscount(sconto.da,sconto.a,sconto.percento,sconto.tipo))
                        else if (sconto.tipo.match(/[0-9]+WEEKS/))
                            SCONTIMANYWEEKS.push(new ManyDaysDiscount(sconto.durata,-1,sconto.percento,sconto.tipo))
                        else if (sconto.tipo == "PROMOZIONE")
                            SCONTI.push(new PromotionDiscount(sconto.sDate,sconto.eDate,sconto.percento,sconto.tipo))
                    }
                    SCONTIMANYWEEKS.sort( function(a,b){return b.from - a.from} )
                    MAX_SCONTO = barca.maxSconto
                    mUtils.generateLines( "showBoat", respE )
                    //mEffects.stopLoading( boatId );
					boatindex=0;
                    $('boatSmallImages').getElements('.sbImg').each(function(element) {
	                    $('step1Div').style.display="";
                        if(boatindex == 0){
                        		setTimeout(function(){popBox.pop({'element': element,'destination': $("mainImg"),'width': 303,'height': 240,'newSrc': element.src.replace(/small.jpg$/, "big.jpg")});},2000);
                        		boatindex++;
                        }
                        element.addEvent('mouseenter', function(){
                            element.getParent().getParent().setStyles({'border-width': '1px','border-style': 'solid', 'border-color':'Black'});
                        });
                        element.addEvent('mouseout', function(){
                            element.getParent().getParent().setStyles({'border-width': '1px','border-style': 'solid', 'border-color':'#D3D3D3'});
                        });
                        element.addEvent('click', function(){
                            popBox.pop({'element': element,'destination': $("mainImg"),'width': 303,'height': 240,'newSrc': element.src.replace(/small.jpg$/, "big.jpg")})
                        });
                    });
                    $('stepsLoadingDiv').style.display="none";
	        	    mPrenota=new MPrenota();
	        	    mPrenota.selectedCalendar.updateCart();
                }
            })
            //mEffects.stopLoading('showBoat');
		})();
	},
	getBuilders: function(){
		mUtils.ajax({
	        url: "/commands/allBuilders.jsp",
	        data: {},
	        successCallback: function(resp){
	        	var modelli = [];
	        	resp.costruttori.each(function(modello,i){
	        		modelli.push([modello.costruttore,'']);
	        	});
						var completer1 = new Autocompleter.Local($('costruttore'), modelli, {
							delay: 1,
							filterTokens: function() {
								var regex = new RegExp('^' + this.queryValue.escapeRegExp(), 'i');
								return this.tokens.filter(function(token){
									return (regex.test(token[0]) || regex.test(token[1]));
								});
							},
							injectChoice: function(choice) {
								var el = new Element('li')
									.setHTML(this.markQueryValue(choice[0]))
									.adopt(new Element('span', {'class': 'example-info'}).setHTML(this.markQueryValue(choice[1])));
									el.inputValue = choice[0];
									this.addChoiceEvents(el).injectInside(this.choices);
							}
						});                	
	        },
	        failureCallback: function(respObject){}    
   		});
 	},
 	resetMyFormAndSubmit: function(inputx,valuex){
		mPersistence.resetMyForm();
		if(inputx)
			inputx.value=valuex;
		document.myForm.invia.click();
	},
	resetMyForm:function(){
		var f=document.myForm;
		f.tipo.value="all";
		f.regione.value=ALLREGVALUE;
		f.base.value="Tutte le basi";
		f.dataIn.value="";
		f.durata.value="7";
		f.cabine.value="";
		f.lunghezza.value="";
		f.costruttore.value="";
		f.prezzoDa.value="";
		f.prezzoA.value="";
	}
}
var mSlideShow = new Class({
	initialize: function(options){
		options        = options 						|| {};
		this.firstObj  = options.firstObj 	|| 0;
		this.objShown  = options.objShown 	|| 3;
		this.elements  = options.elements   || new Array();
		this.lastObj   = this.elements.length;
		this.container = options.container 	|| document.body
		this.id        = options.id         || "ss";
		this.transitionEffect = options.transitionEffect || Fx.Transitions.Quad.easeOut;
		this.transitionTime = options.transitionTime || 600;
		this.clickOnElementHandler = options.clickOnElementHandler || function(){};
		var localThis=this;
		
		this.prev = new Element('div').setStyles({'width':'43px','padding-top':'59px'}).injectInside(this.container);      
		this.prev.innerHTML='<img src="/images/arrow_left.png"/>';
		this.prev.addEvent('click', function(e) {
			localThis.prevSlide();
		});
		var boxWidth=(parseInt(this.objShown)*150-8)+"px";
		this.boxe = new Element('div').setStyles({'width':boxWidth,'height':'152px','overflow':'hidden'}).injectInside(this.container);
		this.box = new Element('div').setStyles({'width':(parseInt(boxWidth)+100),'height':'152px','overflow':'hidden'}).injectInside(this.boxe);
		
		this.elements.each(function(element,i){
			var style={'width':'150px','overflow':'hidden'};
			var iStyle={'width':'140px','height':'150px','border-width':'1px','border-style':'solid','border-color': '#D3D3D3','cursor':'pointer'};
			if(i >= localThis.objShown){
				style.width='0px';
				iStyle.marginRight='-150px';
			}
			line = new Element('div').setStyles(style).setProperty('id', (localThis.id+'_'+i)).injectInside(localThis.box);
			innerLine = new Element('div').setProperty('id', (localThis.id + "Element" + element.id)).setStyles(iStyle).injectInside(line);
			var innerHtmlX = element.innerHtmlX;
			var id = element.id;
			innerLine.innerHTML=innerHtmlX;
			innerLine.addEvent('click', function(e) {
				localThis.clickOnElementHandler(id);
			});
			innerLine.addEvent('mouseover', function(e) {
				this.setStyles({'border-width':'1px','border-style':'solid','border-color': '#FFA500'});
			});
			innerLine.addEvent('mouseout', function(e) {
				this.setStyles({'border-width':'1px','border-style':'solid','border-color': '#D3D3D3'});
			});
		});
		
		this.next = new Element('div').setStyles({'width':'43px','padding-top':'59px','margin-left':'10px'}).injectInside(this.container);      
		this.next.innerHTML='<img src="/images/arrow_right.png"/>';
		this.next.addEvent('click', function(e) {
			localThis.nextSlide();
		});
		
		this.showHideButtons();
	},
	nextSlide: function(){
		if(this.firstObj+this.objShown>=this.lastObj)
			return;
		var firstDiv=$(this.id+'_'+this.firstObj);
		var fx1 = new Fx.Styles(firstDiv, {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		var fx1Child = new Fx.Styles(firstDiv.getElement('div'), {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		
		var lastDiv=$(this.id + '_' + (parseInt(this.firstObj) + parseInt(this.objShown)));
		var fx2 = new Fx.Styles(lastDiv, {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		var fx2Child = new Fx.Styles(lastDiv.getElement('div'), {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		
		fx1.start({'width':'0px'});
		fx1Child.start({'margin-left':'-150px'});
		
		fx2Child.start({'margin-left':'0px'});
		fx2.start({'width':'150px'});
		
		this.firstObj++;
		this.showHideButtons();
	},
	prevSlide: function(){
		if(this.firstObj==0)
			return;
		this.firstObj--;
		
		var firstDiv=$(this.id + '_' +(parseInt(this.firstObj) + parseInt(this.objShown)))
		var fx1 = new Fx.Styles(firstDiv, {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		var fx1Child = new Fx.Styles(firstDiv.getElement('div'), {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		
		var lastDiv=$(this.id + '_' + this.firstObj);
		var fx2 = new Fx.Styles(lastDiv, {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		var fx2Child = new Fx.Styles(lastDiv.getElement('div'), {duration:this.transitionTime, wait:false, transition: this.transitionEffect});
		
		fx1.start({'width':'0px'});
		fx1Child.start({'margin-right':'-150px'});
		fx2Child.start({'margin-left':'0px'});
		fx2.start({'width':'150px'});
		this.showHideButtons();
	},
	showHideButtons: function(){
		this.prev.setOpacity('1');
		this.next.setOpacity('1');
		if(this.firstObj==0){
			this.prev.setOpacity('0.3');
		}
		if(this.firstObj+this.objShown>=this.lastObj){
			this.next.setOpacity('0.3');
		}
	}
});
function resizeDisableAll(){
 	if(disableAllGl)
 		disableAllGl.setStyles(getBodySize());
}
function getBodySize(){
  var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	if (test1 > test2) // all but Explorer Mac
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else // Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
  return {"height": y, "width": x};
}
var disableAllGl=null;
function disableBackground(){
		disableAllGl=new Element('div').setStyles({'position':'absolute','top':'0px','left':'0px','z-index':999,'background-color':'#000000'}).injectInside(document.body);
		disableAllGl.setStyles(getBodySize());
		disableAllGl.setOpacity('0.35');
		if(window.ie6){
			$$('select').each(function(select){
				select.style.visibility="hidden";
			});
		}
}
function hideDisableAll(){
	try{
		if(window.ie6){
			$$('select').each(function(select){
				select.style.visibility="visible";
			});
		}
	}catch(e){}
	try{
		disableAllGl.remove();
	}catch(e){}
}

var popBox={
	lastClikked:null,
	lastSuperPopped:null,
	zindex:100,
 	pop: function(options){
 		options         = options || {};
 		var element     = options.element;
 		var destination = options.destination;
 		var top         = options.top;
 		var left        = options.left;
 		var width       = options.width;
 		var height      = options.height;
 		var newSrc      = options.newSrc || element.src;
 		if(popBox.lastClikked==element){
	    	var naturalDim=mUtils.getImgNaturalDimentions(element);
	    	if(naturalDim.width<=303 && naturalDim.height<=240)
	    		return;
	    	popBox.lastSuperPopped=new Element('img').injectInside(document.body);
	    	popBox.lastSuperPopped.setStyles({'position':'absolute','visibility':'hidden'});
	    	popBox.lastSuperPopped.src=element.src;
	    	popBox.lastSuperPopped.setStyles({left:element.getPosition().x+1,top:element.getPosition().y+1, height:element.style.height, width: element.style.width});
	    	popBox.lastSuperPopped.setStyles({'visibility':'visible','z-index':1000});
	    	var originalPosition=element.getPosition();
	    	var fx = new Fx.Styles(popBox.lastSuperPopped, {duration:300, wait:false,onComplete:function(){
	    		popBox.lastSuperPopped.addEvent('click', function(e) {
						if(popBox.lastSuperPopped.disabled)
							return;
						popBox.lastSuperPopped.disabled=true;
						var fx = new Fx.Styles(popBox.lastSuperPopped, {duration:300, wait:false,onComplete:function(){
							popBox.lastSuperPopped.remove()
							popBox.lastSuperPopped=null;
						}});
						fx.start({'left' : originalPosition.x+1,'top': originalPosition.y+1,'width': 303,'height': 240});
						hideDisableAll();
					});
					disableBackground();
					disableAllGl.addEvent('click', function(e){
						if(popBox.lastSuperPopped.disabled)
							return;
						popBox.lastSuperPopped.disabled=true;
						var fx = new Fx.Styles(popBox.lastSuperPopped, {duration:300, wait:false,onComplete:function(){
							popBox.lastSuperPopped.remove()
							popBox.lastSuperPopped=null;
						}});
						fx.start({'left' : originalPosition.x+1,'top': originalPosition.y+1,'width': 303,'height': 240});
						hideDisableAll();
					});	
	    	}});
	    	var wwidth=naturalDim.width;
	    	var hheight=naturalDim.height;
	    	var centeredPosition=mUtils.getCenteredPosition(popBox.lastSuperPopped,hheight,wwidth);
	    	var lleft=centeredPosition.left;
	    	var ttop=centeredPosition.top;
	    	fx.start({'left' : lleft,'top': ttop,'width': wwidth,'height': hheight});
			return;
	 	}
	 	try{popBox.lastClikked.lenteImg.remove()}catch(e){}
	 	if(popBox.lastClikked){
	    	popBox.zindex--;
	    	popBox.lastClikked.style.zIndex=popBox.zindex;
	    	var fxll = new Fx.Styles(popBox.lastClikked, {duration:300, wait:false});
	    	var wwidth=element.style.width;
	    	var hheight=element.style.height;
	    	if(wwidth=="303px"){
		  		wwidth="80px";
		  		hheight="60px"
		  	}
	    	fxll.start({'left' : 0,'top': 0,'width': wwidth,'height': hheight});
	    	if(element==popBox.lastClikked){
	    		popBox.lastClikked=null;
	    		return;
	    	}
	    }
	                            
	    var fxDD = new Fx.Styles(element, {duration:300, wait:false,onComplete:function(){
	    	var naturalDimX=mUtils.getImgNaturalDimentions(this.element);
	    	var localElement=this.element;
	    	var lenteImg=new Element('img').setStyles({visibility:'hidden','position':'absolute','top':(parseInt(this.element.style.top)+188)+'px','left':(parseInt(this.element.style.left)+251)+'px','z-index':1000}).injectAfter(this.element);
	    	if(window.ie6){
	    		lenteImg.src="/images/noimage.gif"
	    		lenteImg.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled="true", src="/images/icon_lente_small.png", sizingMethod="scale")';
	    	}else{
	    		lenteImg.src="/images/icon_lente_small.png"
	    	}
	    	lenteImg.setOpacity(0.85);
	    	lenteImg.addEvent('click',function(){
	    		localElement.fireEvent("click");
	    	})
	    	this.element.addEvent('mouseenter',function(){
	    		lenteImg.setOpacity(1);
	    	})
	    	this.element.addEvent('mouseout',function(){
	    		lenteImg.setOpacity(0.85);
	    	})
	    	popBox.lastClikked.lenteImg=lenteImg;
	    	this.element.onload = function(){
	    		try{popBox.lastClikked.lenteImg.style.visibility="visible";}catch(e){}
	    	}
	    	/*
	    	this.element.onload = function(){
		    	var lenteImg=new Element('img').setStyles({'position':'absolute','top':(parseInt(this.style.top)+188)+'px','left':(parseInt(this.style.left)+271)+'px','z-index':1000}).injectAfter(this);
		    	if(window.ie6){
		    		lenteImg.src="/images/noimage.gif"
		    		lenteImg.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled="true", src="/images/icon_lente_small.png", sizingMethod="scale")';
		    	}else{
		    		lenteImg.src="/images/icon_lente_small.png"
		    	}
		    	lenteImg.setOpacity(0.85);
		    	element.addEvent('mouseenter',function(){
		    		lenteImg.setOpacity(1);
		    	})
		    	element.addEvent('mouseout',function(){
		    		lenteImg.setOpacity(0.85);
		    	})
		    	popBox.lastClikked.lenteImg=lenteImg;
	    	};
	    	*/
	    }});
	    element.src=newSrc;
	    popBox.zindex++;
	    element.style.zIndex=popBox.zindex;
	    
	    var xx;
	 	var yy;
	 	if(destination){
	 		var elx=element.getPosition().x;
			var ely=element.getPosition().y;
			xx=parseInt(destination.getPosition().x)-parseInt(elx);
	    	yy=parseInt(destination.getPosition().y)-parseInt(ely);                            	
	    }else{
	    	xx=top;
	    	yy=left;
	    }
	    fxDD.start({'top': yy,'left' : xx,'width': width,'height': height});
		popBox.lastClikked=element;
		//element.style.display="none";
	 },
	 expand:function(options){
	 	mEffects.setStyles(options);
	 }
}
var dblcliked=false;
function updateBase(baseName){
	var selr=$('regione');
	if(selr.selectedIndex==0){
		STATI.mEach(function(STATO){
			if(STATO.stato!=ALLREGVALUE){
				STATO.regioni.mEach(function(region){
					region.basi.each(function(base){
						if(base.nome==baseName){
							if(STATI[region.nome]){
								selr.value=STATE_ASSETS["ALL_LABEL"].value+region.nome;
							}else{
								selr.value=region.nome;
							}
						}
					});
				});
			}
		});
	}
	mEffects.regioniChanged();
	$('base').value=baseName;
}
function selectBase(baseName){
	var selr=$('regione');
	selr.selectedIndex=0;
	updateBase(baseName);
}
function selectRegione(regionName){
	var selr=$('regione');
	selr.value=regionName;
	mEffects.regioniChanged();
	$("base").selectedIndex=0;
}
function shakeObj(obj,numTimes,shakeDistance){
	if(!window.objOrigMargin){
		objOrigMargin=parseInt(obj.style.marginLeft);
	}
	(function(){
		shakeDistance=shakeDistance*(-1);
		numTimes--;
		if(numTimes==0){
			obj.style.marginLeft=objOrigMargin+"px";
			return;
		}else{
			obj.style.marginLeft=(objOrigMargin+shakeDistance)+"px";
			shakeObj(obj,numTimes,shakeDistance);
		}
	}).delay(50);
}
var historyListener = function(newLocation, historyData) {
	try{
		historyIFunctions.hidePoppedElements();
		if(newLocation=="" && historyData==null){
			$('dynamicStuff').style.display="none";
			$('staticStuff').style.display="";
			$('staticStuff').getElements(".bodytModule").each(function(element){
				element.style.display="";
			});
			return;	
		}
		historyData.funct(historyData.data);
	}catch(e){
		initialLocation = dhtmlHistory.getCurrentLocation();
		if(initialLocation!=null){
			try{
				initialLocation=initialLocation.substring(2,initialLocation.length);
				var f=initialLocation.substring(0,initialLocation.indexOf(','));
				initialLocation=initialLocation.substring(f.length+3);
				var i=initialLocation.replace(/[$]+/g, "&");
				i=i.replace(/\^/g, "%20");
				if(f=="searchBoatsH"){
					historyIFunctions.searchBoatsH(i);
				}
				if(f=="showBarcaH"){
					historyIFunctions.showBarcaH(i);
				}
			}catch(e){}
		}
	}
}
var historyListenerPrenota = function(newLocation, historyData) {
	if( window.webkit || window.webkit419 || window.webkit420)
		return;
	if(newLocation=="" && historyData==null){
		try{historyIFunctions.goToStep1M();}catch(e){}
		return;
	}
	historyData.funct(historyData.data);
}
var historyIFunctions={
	searchBoatsH: function(params){
		var action=$('myForm').action;
		mPersistence.searchBoats({action:action,params:params});
		historyIFunctions.populateForm({formName:'myForm',url:params});
	},
	searchBoatsM: function(options){
		mPersistence.searchBoats(options);
		historyIFunctions.populateForm({formName:'myForm',url:options.params});
	},
	showBarcaH: function(params){
		var dataA={};
		var paramsStringsArray=params.split("&");
		for(i=0;i<paramsStringsArray.length;i++){
			try{
				paramString=paramsStringsArray[i];
				paramArray=paramString.split("=");
				if(paramArray.length>1){
					eval("dataA."+paramArray[0]+"='"+paramArray[1]+"'");
				}
			}catch(e){}
			if(!dataA.id){
				dataA.id=params;
			}
		}
		mPersistence.showBarca({data:dataA});
	},
	showBarcaM: function(options){
		mPersistence.showBarca(options);
	},
	goToStep1M: function(){
		mPrenota.goToStep1();
	},
	goToStep2M: function(){
		mPrenota.goToStep2();
	},
	goToStep3M: function(){
		mPrenota.goToStep3();
	},
	hidePoppedElements: function(){
		try{
			closePopxxx();
			hideDisableAll();
			if(popBox.lastSuperPopped){
				popBox.lastSuperPopped.remove();
				popBox.lastSuperPopped=null;
			}
		}catch(e){/*if(console)console.log(e)*/}
	},
	populateForm: function(options){
		options=options||{};
		if(!options.formName || !options.url )
			return;
		var myForm=$('options.formName');
		var postUrl=options.url;
		var paramValueArray=postUrl.split('&');
		paramValueArray.each(function(paramValue){
			var inputName=paramValue.split('=')[0];
			var inputValue=unescape(paramValue.split('=')[1]);
			eval("document.myForm."+inputName).value=inputValue;
			/*if(inputName=="regione")
				mEffects.regioniChanged();
			*/
		});
		if($("tipo").value!="all")
			mEffects.typeChanged();
		if($("regione").value!=ALLREGVALUE)
			mEffects.regioniChanged();
	},
	getSafeParams: function(params){
		var safeParams="";
		params=unescape(params);
		params=params.replace(/ /g,"^")
		var paramValueArray=params.split('&');
		paramValueArray.each(function(paramValue){
			var inputName=paramValue.split('=')[0];
			var inputValue=unescape(paramValue.split('=')[1]);
			if(inputValue.length>0){
				safeParams+=inputName+"="+inputValue+"$";
			}
		});
		safeParams=safeParams.substring(0,safeParams.length-1);
		return safeParams;
	}
}
function openthis(elmnt){
	disableBackground();
	disableAllGl.addEvent('click', closePopxxx);
	var w=elmnt.getAttribute("popWidth");
	var h=elmnt.getAttribute("popHeight");
	
	popBoxxxxContainer = new Element('div').injectInside(document.body);
	popBoxxxxContainer.id="popBoxxxx";
	if(w!="")popBoxxxxContainer.style.width=parseInt(w)+80+'px';
	if(h!="")popBoxxxxContainer.style.height=parseInt(h)+80+'px';
	popBoxxxxContainer.style.zIndex="1002";
	popBoxxxxContainer.style.position="absolute"; 
	popBoxxxxContainer.style.left="50%";
	popBoxxxxContainer.style.marginLeft=-(parseInt(w)+80)/2;
	popBoxxxxContainer.style.top=((topx=(document.body.clientHeight/2-popBoxxxxContainer.offsetHeight/2)+((e=document.documentElement.scrollTop)?e:document.body.scrollTop))>0?topx:0)+'px'
	
	var chiudiHTML = "chiudi";
	if(globalLang == "en"){
		chiudiHTML = "close";
	}else if(globalLang == "de"){
		chiudiHTML = "schließen";
	}
	var titleHTML  ="<div style='padding:5px;'><div>"+elmnt.getAttribute("popText")+"</div></div><div style='float:right;padding:5px;'><a href='javascript:closePopxxx();'>"+chiudiHTML+"</a></div></div>"
	var poppedElmntHTML="<iframe id='poppedElmntHtmlIFrame' width=\""+w+"\" height=\""+(parseInt(h)-25)+"\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\""+elmnt.getAttribute("popUrl")+"\"></iframe>";
	
	var shadowsArray=[];
	shadowsArray[0]=[];
	shadowsArray[1]=[];
	shadowsArray[2]=[];
	shadowsArray[0][0]=window.ie6?'<td><img src="/images/noimage.gif" style="width:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow00.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow00.png" style="width:40px;"/></td>'
	shadowsArray[0][1]=window.ie6?'<td><img src="/images/noimage.gif" style="width:100%;height:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow01.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow01.png" style="width:100%;height:40px;"/></td>'
	shadowsArray[0][2]=window.ie6?'<td><img src="/images/noimage.gif" style="width:40px;height:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow02.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow02.png" style="width:40px;height:40px;"/></td>'
	shadowsArray[1][0]=window.ie6?'<td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow10.png\', sizingMethod=\'scale\');"></td>':'<td style="background-image: url(/images/bigshadow10.png); background-repeat: repeat-y;"></td>'
	shadowsArray[1][2]=window.ie6?'<td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow12.png\', sizingMethod=\'scale\');"></td>':'<td style="background-image: url(/images/bigshadow12.png); background-repeat: repeat-y;"></td>'
	shadowsArray[2][0]=window.ie6?'<td><img src="/images/noimage.gif" style="width:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow20.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow20.png" style="width:40px;"/></td>'
	shadowsArray[2][1]=window.ie6?'<td><img src="/images/noimage.gif" style="width:100%;height:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow21.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow21.png" style="width:100%;height:40px;"/></td>'
	shadowsArray[2][2]=window.ie6?'<td><img src="/images/noimage.gif" style="width:100%;height:40px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/images/bigshadow22.png\', sizingMethod=\'scale\');"</td>':'<td><img src="/images/bigshadow22.png" style="width:100%;height:40px;"/></td>'
	
	/*
	shadowsArray[0][0]=window.ie6?'<td style="height:40px;width:40px;"></td>':'<td><img src="/images/bigshadow00.png" style="width:40px;"/></td>'
	shadowsArray[0][1]=window.ie6?'<td></td>':'<td><img src="/images/bigshadow01.png" style="width:100%;height:40px;"/></td>'
	shadowsArray[0][2]=window.ie6?'<td></td>':'<td><img src="/images/bigshadow02.png" style="width:40px;height:40px;"/></td>'
	shadowsArray[1][0]=window.ie6?'<td></td>':'<td style="background-image: url(/images/bigshadow10.png); background-repeat: repeat-y;"></td>'
	shadowsArray[1][2]=window.ie6?'<td></td>':'<td style="background-image: url(/images/bigshadow12.png); background-repeat: repeat-y;"></td>'
	shadowsArray[2][0]=window.ie6?'<td></td>':'<td><img src="/images/bigshadow20.png" style="width:40px;"/></td>'
	shadowsArray[2][1]=window.ie6?'<td></td>':'<td><img src="/images/bigshadow21.png" style="width:100%;height:40px;"/></td>'
	shadowsArray[2][2]=window.ie6?'<td></td>':'<td><img src="/images/bigshadow22.png" style="width:100%;height:40px;"/></td>'
	*/
	
	
	var shadowTableHTML='<table cellspacing="0" cellpadding="0"><tr>'+shadowsArray[0][0]+shadowsArray[0][1]+shadowsArray[0][2]+'</tr>';
	shadowTableHTML+='<tr>'+shadowsArray[1][0]+'<td style="text-align:left;background-color:#FFFFFF;">'+titleHTML+'</td>'+shadowsArray[1][2]+'</tr>';
	shadowTableHTML+='<tr>'+shadowsArray[1][0]+'<td style="text-align:left;background-color:#FFFFFF;">'+poppedElmntHTML+'</td>'+shadowsArray[1][2]+'</tr>';
	shadowTableHTML+='<tr>'+shadowsArray[2][0]+shadowsArray[2][1]+shadowsArray[2][2]+'</tr>';
	
	popBoxxxxContainer.innerHTML=shadowTableHTML;
	//if(window.ie6)$("poppedElmntHtmlIFrame").src=elmnt.getAttribute("popUrl");
}
function closePopxxx(){
	hideDisableAll();
	try{
		popBoxxxxContainer.remove();
	}catch(e){}
}
function nothing(){	
}
var validator={
	validateEmail: function (v) {
		if(v == null || v.length == 0)
			return false;
		return /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v);
	},
	validateNumber:function(v) {
		if(v == null || v.length == 0)
			return false;
		return (!isNaN(v) && !/^\s+$/.test(v));
	}
}
function openCalChooser(el,isWe){
	var iDate=mUtils.gatValidDate(el.value)
	if(!iDate){
		iDate=new Date();
		var daysInDate= 32 - new Date(iDate.getFullYear(), iDate.getMonth(), 32).getDate();
		var missingDaysToEndMonth=daysInDate-iDate.getDate();
		if(missingDaysToEndMonth<7)
			iDate.setDate(iDate.getDate()+missingDaysToEndMonth+1);
	}
	new calendarSingle({el:el,date:iDate,we:isWe})
}
function fixCheckInDate(el,durata){
    if(el.value=="")
        return;
    var checkInDate=mUtils.gatValidDate(el.value)
    var checkInDay=checkInDate.getDay();
    if(durata==2 && checkInDay!=5){
        checkInDate.setDate(checkInDate.getDate()-checkInDay+12)
    }
    if(durata>2 && checkInDay!=6){
        checkInDate.setDate(checkInDate.getDate()-checkInDay-1)
    }
    el.value=checkInDate.getDate()+"/"+(checkInDate.getMonth()+1)+"/"+checkInDate.getFullYear();
}
/*
function isWeekEndClickHandler(el){
    var isWe=el.value=="true";
    
    var currDate=mUtils.gatValidDate(document.myForm.dataIn.value)
    if(!currDate)
        return
    var correctStartingDay=isWe?5:6;
    if(currDate.getDay()!=correctStartingDay){
        var message=isWe?"I weekends partono di Venerdì, impostare la data di partenza!":"I periodi settimanali partono di Sabato, impostare la data di partenza!";
        alert(message);            
        document.myForm.dataIn.value="";
        document.myForm.dataIn.onclick();
    }
}
*/
﻿
var mCalendar = new Class({
    initialize: function(options) {
        var options = options || {};
        this.localMCalendars=options.localMCalendars;
        var lng = new Object();
        this.input=options.el;
        options.date=options.date || new Date();
        this.isFirst=options.isFirst;
        this.isLast=options.isLast;
        this.readOnly=options.readOnly || false;
        this.single=options.single || false;
        this.clickHandler=options.clickHandler || this.selectThisWeek;
        this.we=options.we||false;
        if(this.single){
            this.clickHandler=function(idx){
                idx=idx.substring("single".length,idx.length);
                myDate=new Date(idx);
                if(myDate.getDay()!=this.config.Lng.first)//go back to first day of week
                    myDate.setDate(myDate.getDate()-myDate.getDay()-7+this.config.Lng.first);
                if(this.we){
                    myDate.setDate(myDate.getDate()+6);//go to next friday
                }
                outDateString=myDate.getDate()+"/"+(myDate.getMonth()+1)+"/"+myDate.getFullYear();
                this.input.value=outDateString;
                try{
                    if($('durata').value=="")
                        $('durata').value=7;
                }catch(e){}
                this.div.remove();
                try{this.iframe.remove();}catch(e){}
            }
        }
        // Firefox? IE ?
        try {  
            var nav = navigator.language.substr(0,2); }
        catch (e)    { var nav = navigator.userLanguage;}
        var thiso=this;
        lng['en'] = {
            month : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
            day : ['S','S','M','T','W','T','F'],
            first: 6 // First day of week => Saturday
        };
        lng['it'] = {
            month : ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
            day : ['S','D','L','M','M','G','V'],
            first: 6 // First day of week => Sabato
        };
        lng['es'] = {
            month : ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
            day : ['S','D','L','M','M','J','V'],
            first: 6 // First day of week => Saturday
        };
        lng['de'] = {
            month : ['Januar', 'Februar', 'M&auml;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
            day : ['S','D','L','M','M','G','V'],
            first: 6 // First day of week => Sabato
        };

        //lng = (!lng[nav])? lng['it'] : lng =  lng[nav] ;
        lng = lng[globalLang];
        
        /* configuration */
        if (!options.Config)
            this.config = {
                Lng: lng,
                imgNext: '/images/calendar/next.gif',
                imgPrev: '/images/calendar/prev.gif',
                imgCancel: '/images/calendar/cancel.gif'
            };

        this.month_name = this.config.Lng.month;
        this.day_name =  this.config.Lng.day;
      
        this.container=$(options.idContainer) || document.body;
          
        this.create_calendar(options);
    },
    create_calendar: function(options) {
        var options = options || {};
        var idX   = options.id || "mdiv";
        var dateX   = options.date || new Date();
        // content divs  //
        if(this.single){
            var styleTop=(this.input.getPosition().y+20)+'px';
            var styleLeft=(this.input.getPosition().x)+'px';
            this.div = new Element('div').setStyles({'top':styleTop, 'left':styleLeft}).setProperty('id', idX).injectInside(document.body);
            if(window.ie6)
                this.iframe = new Element('iframe').setStyles({position:'absolute','z-index':'2000',top:styleTop, left:styleLeft, width:'159px', height:'148px', border:'0px'}).injectInside(document.body);
        }else{
            this.div = new Element('div').setStyles({position:'relative'}).setProperty('id', idX);
        }
        //this.div.setOpacity(0);
        this.div.injectInside(this.container);      
        this.div.className = options.className || "mcalendar";
        if(this.single){
            thiso=this;
            this.div.makeDraggable({onDrag:function(divo){
                if(window.ie6)
                    thiso.iframe.setStyles({left:divo.style.left,top:divo.style.top});
            }});
        }
        this.nav(this.div);
          
        this.setdate(dateX);
        this.effect(this.div,'show');
    } ,
    nav: function (div) {
        // nav
        this.calendardiv = new Element('div').injectInside(div);
        this.calendardiv.id="titlediv";
        this.title = new Element('div').injectInside(this.calendardiv);
        this.title.id="title";
        var localThis=this;
        if(this.single){
            this.next = new Element('img').setProperty('src', this.config.imgNext).injectAfter(this.title);
            this.before = new Element('img').setProperty('src', this.config.imgPrev).injectBefore(this.title);
            this.close = new Element('img').setProperty('src', this.config.imgCancel).injectAfter(this.next);
            this.close.addClass('calImgClose');
            
            this.next.addEvent('click', function(e) {
                localThis.goToNextDate();
            });
            this.before.addEvent('click', function(e) {
                localThis.goToPrevDate();
            });
            this.close.addEvent('click', function(e) {
                localThis.div.remove();
                if(localThis.single)
                try{localThis.iframe.remove();}catch(e){}
            });
        }
        this.center = new Element('center').injectInside(div);
        this.table = new Element('table').injectInside(this.center);
        var thead = new Element('thead').injectInside(this.table);
        var tr = new Element('tr').injectInside(thead);

        this.day_name.each(function (day) {
            var td = new Element('th').appendText(day).injectInside(tr);
        });
    },
    goToNextDate:function(){
        var localThis = this;
        var date = localThis.today;
        date.setMonth(localThis.next_m,1);
        localThis.tbody.remove();
        localThis.setdate(date);
    },
    goToPrevDate:function(){
        var localThis = this;
        var date = localThis.today;
        date.setMonth(localThis.next_m-2,12);
        localThis.tbody.remove();
        localThis.setdate(date);
    },
    setdate : function(date) {
        // reset event nav
        this.today = date;

        this.next_m = this.today.getMonth()+1;

        try { 
            this.title.innerHTML = this.month_name[this.today.getMonth()]+' ' + this.today.getFullYear(); 
        } catch (e) { this.title.innerText = this.month_name[this.today.getMonth()]+' ' + this.today.getFullYear(); }
        var localThis = this;
                      
        this.tbody = new Element('tbody');
        //this.tbody.setOpacity(0);
        this.tbody.injectInside(this.table);
        
        var first_day = new Date(this.today.getFullYear(),this.today.getMonth(),this.today.getDate(),0,0,0);
        var last_day = this.today;
        this.month = this.today.getMonth();
        var tr = new Element('tr').injectInside(this.tbody);

        /* first day week */
        first_day.setDate(1);
        
        var LastMonth = new Date(this.today.getFullYear(),this.next_m-2,1,0,0,0);
        LastMonth.setMonth(LastMonth.getMonth()+1);
        LastMonth.setDate(LastMonth.getDate()-1);
        
        if(LastMonth.getDay()!=this.config.Lng.first-1){
            while(LastMonth.getDay()!=this.config.Lng.first){
                LastMonth.setDate(LastMonth.getDate()-1);
            }
            while(LastMonth<first_day){
                var cssClass='noday';
                if(localThis.isFirst){
                    cssClass="visibleNoday";
                }
                this.create_td(tr,LastMonth.getDate(),LastMonth,cssClass);
                LastMonth.setDate(LastMonth.getDate()+1);
            }
        }
        
        brea_k=this.config.Lng.first;
        
        
        /* everydays */
        var date_s = this.today;
        var class_Css;
        var daycounter = 0;
        for (var i = 1; i <= 31; i++) {
            date_s.setDate(i);
            if (date_s.getMonth() == this.month) {
                daycounter++;
                if (date_s.getDay() == brea_k) {
                    var tr = new Element('tr').injectInside(this.tbody);
                }
                class_Css = (!date_s.getDay())? 'sunday' : '';
                this.create_td(tr,i,date_s,class_Css);
            }
        }
        this.today.setMonth(this.month);
        this.today.setMonth(this.month);

        this.today.setDate(daycounter);
           
        // finish month
        if(this.today.getDay()!=this.config.Lng.first-1){
            var NextMonth = new Date(this.today);
            NextMonth.setDate(NextMonth.getDate()+1);
            while(NextMonth.getDay()!=this.config.Lng.first){
                var cssClass='noday';
                if(localThis.isLast){
                    cssClass="visibleNoday";
                }
                this.create_td(tr,NextMonth.getDate(),NextMonth,cssClass);
                NextMonth.setDate(NextMonth.getDate()+1);    
            }
        }
        this.effect(this.tbody,'show');
    },
    create_td: function(tr,i,date,class_Css) {
        var localThis = this;
        var td = new Element('td');
        if (date) {
            var today = new Date();
            var dia = date.getDate();
            var mes = (date.getMonth()+1);
            var stringDay=date.getFullYear() + '/'+ mes +'/'+ dia;
            idx=stringDay;
            var todayStartWeek= new Date();
            todayStartWeek.setDate(todayStartWeek.getDate()-todayStartWeek.getDay()+this.config.Lng.first-1);
            if(this.localMCalendars.reservedDays[stringDay]){
                class_Css+=" reserved";
            }
            if(date < todayStartWeek){
                class_Css+= " beforeToday";
            }
            if(this.single){
                td.setProperty('id', "single"+idx);
            }else{
                if(class_Css=="noday"){
                    td.setProperty('id', "n"+idx);
                }else{
                    td.setProperty('id', idx);
                    if(this.localMCalendars.selectedArray[idx])
                        td.addClass('dayselected');
                }
            }
        }
        if (class_Css) td.addClass(class_Css);
        // Today ??
        var today = new Date();
        today = today.getDate() + "/" + (today.getMonth()+1) + "/" + today.getFullYear();
        if (date) var date_td = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear();
        if (today == date_td) td.addClass('isToday');

        td.appendText(i);
        td.injectInside(tr);
        if(class_Css.indexOf("beforeToday")==-1 && !localThis.readOnly){
            td.addEvent('click', function(e) {
                 localThis.clickHandler(td.id);
            });
            td.addEvent('mouseover', function(e) {
                 localThis.addClassThisWeek(td.id,'dayhover');
            });
            td.addEvent('mouseout', function(e) {
                 localThis.addClassThisWeek(td.id,'dayhover',true);
            });
        }
    },
    effect: function(div,op) {
      div.style.display='';
      /*
          var ef = new Fx.Style(div, 'opacity', {
                duration: 50,
                transition: Fx.Transitions.quartInOut
            });
            ef.start(1);
        */
    },
    validate_date: function (date) {
          var regex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
          return date.test(regex);
    },
    selectThisWeek: function(idx){
        var myDate=new Date(idx);
        if(myDate.getDay()!=this.config.Lng.first)
            myDate.setDate(myDate.getDate()-myDate.getDay()-7+this.config.Lng.first);
        if(this.we){
            myDate.setDate(myDate.getDate()+6);//go to next friday
        }
        if(!this.localMCalendars.weekOnlyMonths[myDate.getMonth()+1]){
            this.selectDay(idx);
        }else{
             if(this.localMCalendars.selectedArray.length>0){
                 var firstSelectedDate=new Date(this.localMCalendars.selectedArray[0]);
                 var lastSelectedDate=new Date(this.localMCalendars.selectedArray[this.localMCalendars.selectedArray.length-1]);
                 var lastMyDate=new Date(myDate);
                 lastMyDate.setDate(lastMyDate.getDate()+7);
                 lastSelectedDate.setDate(lastSelectedDate.getDate()+1);
                 if($(idx).hasClass('dayselected')){
                     if(!(lastSelectedDate.getTime()==lastMyDate.getTime() || firstSelectedDate.getTime()==myDate.getTime()))
                         return;
                 }else{
                     if(!(lastSelectedDate.getTime()==myDate.getTime() || firstSelectedDate.getTime()==lastMyDate.getTime()))
                         return;
                 }
             }
             /*
             var endDate=new Date(myDate);
             endDate.setDate(endDate.getDate()+7);
             endDateIdx=endDate.getFullYear() + '/'+ (endDate.getMonth()+1) +'/'+ endDate.getDate();
             if()*/
             for(j=0;j<7;j++){
                var xId=myDate.getFullYear() + '/'+ (myDate.getMonth()+1) +'/'+ myDate.getDate();
                   if(!this.localMCalendars.reservedDays[xId]){
                       this.selectDay(xId);
                   }
                   myDate.setDate(myDate.getDate()+1);
             }
             this.localMCalendars.selectedArray.sort(function(a,b){
                 var dateA=new Date(a);
                 var dateB=new Date(b);
                 return dateA.getTime()-dateB.getTime();
             });
        this.localMCalendars.updateCart();
         }
    },
    selectDay:function(idx){
        if($(idx).hasClass('dayselected')){
             this.localMCalendars.selectedArray.remove(idx);
             this.localMCalendars.selectedArray[idx]=null;
             $(idx).removeClass('dayselected');
        }else{
               $(idx).addClass('dayselected');
               this.localMCalendars.selectedArray.push(idx);
               this.localMCalendars.selectedArray[idx]=idx;
        }
        //this.localMCalendars.updateCart();
    },
    /*updateCart:function(){
        mPrenota.cart.updateCart({'selectedDays':this.localMCalendars.selectedArray});
    },*/
    addClassThisWeek: function(idx,className,remove){
        var idxDate=idx;
        if(this.single){
            idxDate=idx.substring("single".length,idx.length);
        }
        try{
            var myDate=new Date(idxDate);
            
            if(myDate.getDay()!=this.config.Lng.first){//go back to first day of week
                myDate.setDate(myDate.getDate()-myDate.getDay()-7+this.config.Lng.first);
            }
            if(this.we){
                myDate.setDate(myDate.getDate()+6);//go to next friday
            }
            var numerOfDaysToSelect=this.we?3:7;
            
            if(!this.localMCalendars.weekOnlyMonths[myDate.getMonth()+1]){
                if(!this.localMCalendars.reservedDays[idxDate]){
                    if(remove)
                           $(idx).removeClass(className);
                   else
                       $(idx).addClass(className);
                   }
            }else{
                 if(this.localMCalendars.selectedArray.length>0){
                     var firstSelectedDate=new Date(this.localMCalendars.selectedArray[0]);
                     var lastSelectedDate=new Date(this.localMCalendars.selectedArray[this.localMCalendars.selectedArray.length-1]);
                     var lastMyDate=new Date(myDate);
                     lastMyDate.setDate(lastMyDate.getDate()+7);
                     lastSelectedDate.setDate(lastSelectedDate.getDate()+1);
                     if($(idx).hasClass('dayselected')){
                         if(!(lastSelectedDate.getTime()==lastMyDate.getTime() || firstSelectedDate.getTime()==myDate.getTime()))
                             return;
                     }else{
                         if(!(lastSelectedDate.getTime()==myDate.getTime() || firstSelectedDate.getTime()==lastMyDate.getTime()))
                             return;
                     }
                 }
                 for(i=0;i<numerOfDaysToSelect;i++){
                    var xId="";
                    if(this.single){
                        xId+="single";
                    }
                    xId+=myDate.getFullYear() + '/'+ (myDate.getMonth()+1) +'/'+ myDate.getDate();
                       if(!this.localMCalendars.reservedDays[xId]){
                           if(remove){
                               if($(xId).hasClass("dayselected")){
                                   $(xId).style.color="#000000";
                               }else{
                                   $(xId).style.color="#FFFFFF";
                               }
                               $(xId).removeClass(className);
                               if(this.single && i==0){
                                   $(xId).removeClass("dayselected");
                                   $(xId).style.color="#FFFFFF";
                               }
                           }else{
                               if($(xId).hasClass("dayselected")){
                                $(xId).style.color="#D3D3D3";
                               }else{
                                   $(xId).style.color="#000000";
                               }
                               var xclass=className;
                               if(this.single){
                                   $(xId).style.color="#FFFFFF";
                                   if(i==0){
                                       xclass="dayselected";
                                       $(xId).style.color="#000000";
                                   }
                               }
                               $(xId).addClass(xclass);
                           }
                       }
                       myDate.setDate(myDate.getDate()+1);
                 }
             }
         }catch(e){}
     },
     reset:function(){
         var localThis=this;
         this.tbody.getElements('td').each(function(element){
             if(element.hasClass("dayselected"))
                 element.style.color="#FFFFFF";
             element.removeClass('dayselected');
         });
         this.localMCalendars.updateCart();
     }
});

//var localMCalendars;
var mCalendars = new Class({
    selectedArray :new Array(),
    initialize: function(options) {
        var localThis=this;
          this.readOnly = options.readOnly || false;
          this.container=$(options.idContainer) || document.body;
          this.reservedDays = options.reservedDays || new Array();
          this.weekOnlyMonths = options.weekOnlyMonths || new Array();
          this.selectedArray = options.preSelectedArray || new Array();
           var today=options.date || new Date();
          var single=options.single || false;
          this.singleCal=null;
          if(single){
                this.singleCal=new mCalendar({localMCalendars:this,single:true,isFirst:true,isLast:true,el:options.el,className:'mcalendarSingle',date:today,readOnly:false,we:options.we});
              return;
          }
          
          var todayTemp = new Date(today.getTime());
          var nextMonth =new Date(todayTemp.setMonth(today.getMonth()+1,1));
          var todayTemp = new Date(today.getTime());
          var nextNextMonth =new Date(todayTemp.setMonth(today.getMonth()+2,1));
          //console.log(nextNextMonth);
      
          this.prev = new Element('div').setStyles({'width':'49px','padding-top':'50px','text-align':'center'}).setProperty('id', 'arrowLeft').injectInside(this.container);      
          this.prev.innerHTML='<img src="/images/arrow_left.gif"/>';
          this.prev.setOpacity(0.3);
          this.prev.addEvent('click', function(e) {
              localThis.goPrev();
          });
      
          var options1={localMCalendars:this,idContainer:options.idContainer,date:today,isFirst:true,readOnly:this.readOnly};
        this.cal1=new mCalendar(options1);
          
        var options2={localMCalendars:this,idContainer:options.idContainer,date:nextMonth,readOnly:this.readOnly};
        this.cal2=new mCalendar(options2);
        
        var options3={localMCalendars:this,idContainer:options.idContainer,date:nextNextMonth,isLast:true,readOnly:this.readOnly};
        this.cal3=new mCalendar(options3);
        
        this.next = new Element('div').setStyles({width:'49px','padding-top':'50px','text-align':'center'}).setProperty('id', 'arrowLeft').injectInside(this.container);
        this.next.innerHTML='<img src="/images/arrow_right.gif"/>';
        this.next.addEvent('click', function(){
            localThis.goNext();
        });
        this.next = new Element('div').setProperty('id', 'mCalLegenda').injectInside(this.container);
        var assetLegend={
            'it':{legenda:"Legenda",disp:"disponibile",sel:"selezionato",occ:"occupato"},
            'si':{legenda:"Legenda",disp:"disponibile",sel:"selezionato",occ:"occupato"},
            'en':{legenda:"Legend",disp:"available",sel:"selected",occ:"busy"},
            'de':{legenda:"Legende",disp:"vorhanden",sel:"ausgew&auml;hlt",occ:"besetzt"}
        }
        if(this.readOnly){
            this.next.innerHTML='<span>' +eval("assetLegend."+globalLang+".legenda")+ ':&nbsp;&nbsp;&nbsp;</span><span><img src="/images/mcallegavailable2.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".disp")+ '&nbsp;&nbsp;&nbsp;</span><span><img src="/images/mcallegbusy2.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".occ")+ '&nbsp;&nbsp;&nbsp;</span>';
            if(this.selectedArray.length>0){
                this.next.innerHTML+='<span><img src="/images/mcallegselected.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".sel")+ '</span>';
            }
        }else{
            this.next.innerHTML='<span>' +eval("assetLegend."+globalLang+".legenda")+ ':&nbsp;&nbsp;&nbsp;</span><span><img src="/images/mcallegavailable.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".disp")+ '&nbsp;&nbsp;&nbsp;</span><span><img src="/images/mcallegbusy.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".occ")+ '&nbsp;&nbsp;&nbsp;</span><span><img src="/images/mcallegselected.png"></span><span>&nbsp;- ' +eval("assetLegend."+globalLang+".sel")+ '</span>';
        }
      },
      goNext: function(){
        var date = new Date(this.cal1.today.getFullYear(),this.cal1.today.getMonth(),1,0,0,0);
        var today=new Date((new Date()).getFullYear(),(new Date()).getMonth(),1,0,0,0);
          if(date>=today)
              this.prev.setOpacity(1);
          this.cal1.goToNextDate();
        this.cal2.goToNextDate();
        this.cal3.goToNextDate();
      },
      goPrev: function(){
          
          var date = new Date(this.cal1.today.getFullYear(),this.cal1.today.getMonth(),1,0,0,0);
        var today=new Date((new Date()).getFullYear(),(new Date()).getMonth(),1,0,0,0);
          
          if(date <= today){
              this.prev.setOpacity(0.3);
              return;
          }          
          this.prev.setOpacity(1);
          this.cal1.goToPrevDate();
        this.cal2.goToPrevDate();
        this.cal3.goToPrevDate();
      },
      reset: function(){
          this.cal1.reset();
        this.cal2.reset();
        this.cal3.reset();
        this.selectedArray=null;
        this.selectedArray=new Array();
        this.updateCart();
      },
      updateCart: function(){
          mPrenota.cart.updateCart({'selectedDays':this.selectedArray}); 
      }
});
var currCalendarSingle=null;
var calendarSingle = new Class({
    initialize: function(options) {
        var options=options||{};
        var weekOnlyMonths=new Array();
        weekOnlyMonths[1]=1;
        weekOnlyMonths[2]=2;
        weekOnlyMonths[3]=3;
        weekOnlyMonths[4]=4;
        weekOnlyMonths[5]=5;
        weekOnlyMonths[6]=6;
        weekOnlyMonths[7]=7;
        weekOnlyMonths[8]=8;
        weekOnlyMonths[9]=9;
        weekOnlyMonths[10]=10;
        weekOnlyMonths[11]=11;
        weekOnlyMonths[12]=12;
        if(currCalendarSingle){
        try{
            currCalendarSingle.singleCal.div.remove();
            currCalendarSingle.singleCal.iframe.remove();
        }catch(e){}
    }
        currCalendarSingle=new mCalendars({single:true,el:$(options.el.id),weekOnlyMonths:weekOnlyMonths,date:options.date,we:options.we})
    }
});
﻿
// key:   template object id
// value: the original template object innerHTML
templatesOrig = {}

// key:   template object id
// value: the request object which concurred to the last
//        template expansion
templatesRequest = {}

mPersistence.currPage=0;
mPersistence.currSortField=null;
mPersistence.currSortOrd=null;

mPersistence.barcheNextPage=function(){ mPersistence.barcheToPage("+1") }

mPersistence.barchePrevPage=function(){ mPersistence.barcheToPage("-1") }

mPersistence.barcheToPage=function(s){
	var page=s;
	var c = s.charAt(0)
  if (c == "+" || c == "-"){
  	page = parseInt( mPersistence.currPage ) + parseInt( s )
  }
	var params=$('myForm').toQueryString();
	params+='&page='+page;
	
	if(mPersistence.currSortField){
    params+='&sb='+mPersistence.currSortField;
		params+='&so='+mPersistence.currSortOrd;
  }
  var options={"action":$('myForm').action,"params":params};
  mPersistence.searchBoats(options);
}
mPersistence.sortBarcheOrders = {
    modello: "a",
    citta: "a",
    anno: "d",
    localita: "a",
    postiLetto: "d",
    lunghezza: "d",
    portataOmologataPersone: "d",
    prezzo: "a",
    sconto: "d"
}

mPersistence.sortBarche = function(field){
    var ord = mPersistence.sortBarcheOrders[field];
    if(mPersistence.currSortField==field){
    	ord=(mPersistence.currSortOrd=="a")?"d":"a";
    }
    if (!ord)
        return;
		var params=$('myForm').toQueryString();
		params+='&sb='+field;
		params+='&so='+ord;
  	var options={"action":$('myForm').action,"params":params};
  	mPersistence.searchBoats(options);
}
mPersistence.searchCallback = function(resp){
    var page = parseInt( resp.page )
    mPersistence.currPage=page-1;
    mPersistence.currSortField=resp._request.sb;
		mPersistence.currSortOrd=resp._request.so;
    
    var maxPage = parseInt( resp.maxPage )

    // append pages
    var MAX_PAGES = 9
    var ELLIPSIS = 2
    
    var putEllipsis = false
    var max_half = Math.floor( MAX_PAGES / 2 )
    var start = Math.max(1, page-max_half)
    var end = Math.min(maxPage, start + MAX_PAGES-1)
    start = Math.max(1, end - (MAX_PAGES-1))
    if (end != maxPage){
        putEllipsis = true
        end = end - (ELLIPSIS+1)
    }
    resp.pages = []
    for (var i = start; i <= end; ++i){
        if (i == page)
            resp.pages.push( {page:i, style:"color:white;background-color:#F15928;"} )
        else
            resp.pages.push( {page:i, style:"cursor: pointer;", onclick:"mPersistence.barcheToPage('" + (i-1) + "')"} )
    }
    if (putEllipsis){
        resp.pages.push( {page:"..."} )
        for (var i=maxPage-ELLIPSIS+1; i<=maxPage; ++i)
            resp.pages.push( {page:i, style:"cursor: pointer;", onclick:"mPersistence.barcheToPage('" + (i-1) + "')"} )
    }

    /*
    var start = Math.max(1, page-2)
    var end = Math.min(maxPage, start + 4)
    start = Math.max(1, end-4)
    resp.pages = []
    for (var i = start; i <= end; ++i){
        var p = {}
        p.page = i
        if (i == page){
            p.style = "font-weight:bold;"
        }
        else {
            p.style = "cursor: pointer;"
            p.onclick = "barcheToPage('" + (i-1) + "')"
        }
        resp.pages.push( p )
    }
    */
	mUtils.generateLines("boatResults", resp);
	if(resp.barche==0){
    	var div = new Element('div').setStyles({'font-weight':'normal','padding-top':'40px','padding-bottom':'606px',width:'99%',color:'red'}).injectInside($('boatHeader'));
    	div.innerHTML="<center>Nessun risultato. Prova a cambiare i parametri di ricerca.</center>";
    	//$('boatHeader').insertAfter("aaa");
	}

    // enable page counters
    var paddingLeft="111px";
    if ( !(resp.page == resp.maxPage && resp.page == "1") )
        $("pageCounter").style.visibility = "visible";
        
    if(resp.page > "1")
        $("prevPageA").style.display = "";
    
    if(resp.page != resp.maxPage)
        $("nextPageA").style.display = ""
    
    if(resp.page == "1" || resp.page == resp.maxPage)
		paddingLeft="169px";
	$("boatPages").style.paddingLeft=paddingLeft;
	
    // highlight search field
    if (resp._request.sb){
        var d = $("boatHeader").getElements("."+resp._request.sb)[0]
        var a = d.getElements("a")[0]
        //a.style.color = "orange"
        d.getElementsByTagName("img")[0].src="/images/" + (resp._request.so == "a" ? "asc.gif" : "desc.gif");
        //d.innerHTML = d.innerHTML + "<img class='sortIcon' src='/images/" + (resp._request.so == "a" ? "asc.gif" : "desc.gif") + "'/>"
        
        //if (resp._request.so = "a")
            
    }
    try{
        if(resp._request.dataIn){
            if(resp._request.durata<7){
                $("prezzoalable").innerHTML="Prezzo per week-end";
            }else{
                if(resp._request.durata==7)
                    $("prezzoalable").innerHTML="Prezzo a settimana";
                else
                    $("prezzoalable").innerHTML="Prezzo per "+resp._request.durata/7+" settimane";
            }
        }
    }catch(e){}

    mEffects.stopLoading('boatResults');

    $('boatResults').getElements('.bodytrow').each(function(element) {
        var fx = new Fx.Styles(element, {duration:300, wait:false});
        var shadowEl = element.getElementsByClassName("superShadow")[0];
        element.addEvent('mouseenter', function(){
            if (!window.ie)mEffects.showShadow(shadowEl);
            fx.stop();
            fx.set({'color': '#5C9DDE'});
        });
        element.addEvent('mouseleave', function(){
            if (!window.ie)mEffects.hideShadow(shadowEl);
            fx.start({'color' : '#000000'});
		});
    });
    var zoomIconsArr=$('boatResults').getElementsByClassName("zoomIcons");
    for(i=0;i<zoomIconsArr.length;i++){
    	zoomIconsArr[i].setOpacity(0);
    }
    pageTracker._trackPageview("/searchBoats"); 

    /*
    // TODO fattorizzare sta cosa ripetuta
    mUtils.generateLines( "boatResults", respE )

    mEffects.stopLoading('boatResults');

    $('boatResults').getElements('.bodytrow').each(function(element) {

        var fx = new Fx.Styles(element, {duration:300, wait:false});
        element.addEvent('mouseenter', function(){
            fx.stop();
            element.setStyles({'background-color': '#FEB63E','color':'#FFFFFF'});
        });
        element.addEvent('mouseleave', function(){
            var bckColor=element.className.indexOf('odd')!=-1?'#D3D3D3':'#EEEEEE';
            var frColor=element.className.indexOf('odd')!=-1?'#808080':'#808080';

            fx.start({
                'background-color' : bckColor,
                'color' : frColor
            });
        });
    });
    // add tooltips
    var myTips = new Tips($$('.ico'), {showDelay:"500",fixed:false})
    */
}


function loginForm(){
    $('loginForm').addEvent('submit', function(e) {
        new Event(e).stop();
        //mEffects.setLoading({div:'boatResults'});
        this.send({
            evalScripts: true,
            onComplete: function(resp) {
                //mEffects.stopLoading('boatResults');
                var res = Json.evaluate(resp);
                //mUtils.generateLines("boatResults", respo);

                if (!res.isError){
                    mPersistence.mUser = res
                    mPersistence.onLogin()
                }
                else {
                    $("loginError").innerHTML = res.message
                }
            }
        })
    })
}

oldInit = mPersistence.init
mPersistence.init = function(){
    oldInit()
    try{loginForm()}catch(e){}
}

mPersistence.toggleLogin = function(){
    var d = $("loginDiv")
    var dis = d.style.display
    if( dis == "" ){
        d.style.display = "none"
    }
    else {
        d.style.display = ""
    }
}

mPersistence.logout = function(){

    if ( confirm("Vuoi veramente uscire?") )
        mUtils.ajax({
            url: "commands/logout.jsp",
            //data: req,
            successCallback: function(respE){
                //alert("Alla prossima " + mPersistence.mUser.nome + " !!" )
                $("loginA").style.display = ""
                $("logoutA").style.display = "none"
                $("helloSpan").style.display = "none"
                //$("loginDiv").style.display = ""
                mPersistence.mUser = null
            }
        })
}

mPersistence.onLogin = function(){
    var user = mPersistence.mUser
    //alert("Benvenuto " + user.nome + " " + user.cognome + " !")
    //mPersistence.mUser = user
    $("loginDiv").style.display = "none"
    $("loginA").style.display = "none"
    $("logoutA").style.display = ""
    $("helloSpan").style.display = ""
    $("profileA").innerHTML = user.nome
}

mPersistence.toggleProfile = function(user){
    if ($("profileDiv").style.display == "none"){
        mUtils.generateLines("profileDiv", mPersistence.mUser)
        //$("bodyt").style.display = "none"
        //$("leftDiv").style.display = "none"
        $("profileDiv").style.display = ""
    }
    else {
        $("profileDiv").style.display = "none"
    }
}

// override setAttribute for setting style in IE
if (window.ie){
    Element.prototype.setAttribute = function (attribute, value) {
        if (attribute == "style")
            this.style.cssText = value;
        else
            this[attribute] = value;
    }
}


// mootools PATCHES
if (window.ie) $$.unique = function(array){
	var elements = [];
	for (var i = 0, l = array.length; i < l; i++){
		if (array[i].$included) continue;
		var element = $(array[i]);
		if (element && !element.$included){
			element.$included = true;
			elements.push(element);
		}
	}
	for (var n = 0, d = elements.length; n < d; n++) elements[n].removeAttribute('$included');
	return new Elements(elements);
}
if (window.ie) Element.extend({
    setStyle: function(property, value){
        switch(property){
            case 'opacity': return this.setOpacity(parseFloat(value));
            case 'float': property = (window.ie) ? 'styleFloat' : 'cssFloat';
        }
        property = property.camelCase();
        switch($type(value)){
            case 'number': if (!['zIndex', 'zoom'].contains(property)) value += 'px'; break;
            case 'array': value = 'rgb(' + value.join(',') + ')';
        }
        try { this.style[property] = value; } catch(e){} // ML 
        return this;
    }
})




        /*function generateLines(templateId, props) {
            var template = $(templateId) //document.getElementById(templateId)
            var c = 0
            
            var trs = template.getElements( "*[class^=repeat:]" )

            for (var i = 0; i < trs.length; ++i){
                var tr = trs[i]
                var list = props[ tr.className.split(":")[1] ]

                if (list != null){
                    for (var j=0; j < list.length; ++j){

                        if (tr.nextSibling != null)
                            ntr = tr.parentNode.insertBefore( tr.cloneNode(true), tr.nextSibling )
                        else
                            ntr = tr.parentNode.appendChild( tr.cloneNode(true) )


                        for (var k = 0; k < ntr.attributes.length; ++k){
                            ntr.attributes[k].value = replace(ntr.attributes[k].value, props, list[j])
                        }
                        
                        props["__"+c] = replace(ntr.innerHTML, props, list[j])
                        ntr.innerHTML = "%__"+ c++ +"%"
                    }
                }

                tr.parentNode.removeChild( tr )
            }
           
            template.innerHTML = replace(template.innerHTML, props, {})
            template.style.display = ""
        }

        function replace(s, globals, locals) {
            var out = ""
            var inp = false
            var last = 0
            var i = s.indexOf('%')
            while (i >= 0){
                if ( ! inp ){
                    out += s.substring(last, i)
                }
                else {
                    var v = s.substring(last+1, i++)

                    if( v.charAt(0) == "." && locals[ v.substring(1, v.length) ] != undefined )
                        out += locals[ v.substring(1, v.length) ]
                    else if( globals[v] != undefined )
                        out += globals[ v ]
                }

                inp = !inp
                last = i
                i = s.indexOf('%', last+1)
            }

            out += s.substring(last)

            return out
        }*/


﻿/**
 * Autocompleter
 *
 * @version		1.0rc4
 *
 * @license		MIT-style license
 * @author		Harald Kirschner <mail [at] digitarald.de>
 * @copyright	Author
 */
var Autocompleter = {};

Autocompleter.Base = new Class({

	options: {
		minLength: 1,
		useSelection: true,
		markQuery: true,
		inheritWidth: true,
		maxChoices: 10,
		injectChoice: null,
		onSelect: Class.empty,
		onShow: Class.empty,
		onHide: Class.empty,
		customTarget: null,
		className: 'autocompleter-choices',
		zIndex: 42,
		observerOptions: {},
		fxOptions: {},
		overflown: []
	},

	initialize: function(el, options) {
		this.setOptions(options);
		this.element = $(el);
		this.build();
		this.observer = new Observer(this.element, this.prefetch.bind(this), $merge({
			delay: 1
		}, this.options.observerOptions));
		this.value = this.observer.value;
		this.queryValue = null;
	},

	/**
	 * build - Initialize DOM
	 *
	 * Builds the html structure for choices and appends the events to the element.
	 * Override this function to modify the html generation.
	 */
	build: function() {
		if ($(this.options.customTarget)) this.choices = this.options.customTarget;
		else {
			this.choices = new Element('ul', {
				'class': this.options.className,
				styles: {zIndex: this.options.zIndex, display: 'none'}
			}).injectInside(document.body);
			this.fix = new OverlayFix(this.choices);
		}
		this.fx = this.choices.effect('opacity', $merge({
			wait: false,
			duration: 200
		}, this.options.fxOptions))
			.addEvent('onStart', function() {
				if (this.fx.now) return;
				this.choices.setStyle('display', '');
				this.fix.show();
			}.bind(this))
			.addEvent('onComplete', function() {
				if (this.fx.now) return;
				this.choices.setStyle('display', 'none');
				this.fix.hide();
			}.bind(this)).set(0);
		this.element.setProperty('autocomplete', 'off')
			.addEvent(window.ie ? 'keydown' : 'keypress', this.onCommand.bindWithEvent(this))
			.addEvent('mousedown', this.onCommand.bindWithEvent(this, [true]))
			.addEvent('focus', this.toggleFocus.bind(this, [true]))
			.addEvent('blur', this.toggleFocus.bind(this, [false]))
			.addEvent('trash', this.destroy.bind(this));
	},

	destroy: function() {
		this.choices.remove();
	},

	toggleFocus: function(state) {
		this.focussed = state;
		if (!state) this.hideChoices();
	},

	onCommand: function(e, mouse) {
		if (mouse && this.focussed) this.prefetch();
		if (e.key && !e.shift) switch (e.key) {
			case 'enter':
				if (this.selected && this.visible) {
					this.choiceSelect(this.selected);
					e.stop();
				} return;
			case 'up': case 'down':
				if (this.observer.value != (this.value || this.queryValue)) this.prefetch();
				else if (this.queryValue === null) break;
				else if (!this.visible) this.showChoices();
				else {
					this.choiceOver((e.key == 'up')
						? this.selected.getPrevious() || this.choices.getLast()
						: this.selected.getNext() || this.choices.getFirst() );
					this.setSelection();
				}
				e.stop(); return;
			case 'esc': this.hideChoices(); return;
		}
		this.value = false;
	},

	setSelection: function() {
		if (!this.options.useSelection) return;
		var startLength = this.queryValue.length;
		if (this.element.value.indexOf(this.queryValue) != 0) return;
		var insert = this.selected.inputValue.substr(startLength);
		if (document.getSelection) {
			this.element.value = this.queryValue + insert;
			this.element.selectionStart = startLength;
			this.element.selectionEnd = this.element.value.length;
		} else if (document.selection) {
			var sel = document.selection.createRange();
			sel.text = insert;
			sel.move("character", - insert.length);
			sel.findText(insert);
			sel.select();
		}
		this.value = this.observer.value = this.element.value;
	},

	hideChoices: function() {
		if (!this.visible) return;
		this.visible = this.value = false;
		this.observer.clear();
		this.fx.start(0);
		this.fireEvent('onHide', [this.element, this.choices]);
	},

	showChoices: function() {
		if (this.visible || !this.choices.getFirst()) return;
		this.visible = true;
		var pos = this.element.getCoordinates(this.options.overflown);
		this.choices.setStyles({
			left: pos.left,
			top: pos.bottom
		});
		if (this.options.inheritWidth) this.choices.setStyle('width', pos.width);
		this.fx.start(1);
		this.choiceOver(this.choices.getFirst());
		this.fireEvent('onShow', [this.element, this.choices]);
	},

	prefetch: function() {
		if (this.element.value.length < this.options.minLength) this.hideChoices();
		else if (this.element.value == this.queryValue) this.showChoices();
		else this.query();
	},

	updateChoices: function(choices) {
		this.choices.empty();
		this.selected = null;
		if (!choices || !choices.length) return;
		if (this.options.maxChoices < choices.length) choices.length = this.options.maxChoices;
		choices.each(this.options.injectChoice || function(choice, i){
			var el = new Element('li').setHTML(this.markQueryValue(choice));
			el.inputValue = choice;
			this.addChoiceEvents(el).injectInside(this.choices);
		}, this);
		this.showChoices();
	},

	choiceOver: function(el) {
		if (this.selected) this.selected.removeClass('autocompleter-selected');
		this.selected = el.addClass('autocompleter-selected');
	},

	choiceSelect: function(el) {
		this.observer.value = this.element.value = el.inputValue;
		this.hideChoices();
		this.fireEvent('onSelect', [this.element], 20);
	},

	/**
	 * markQueryValue
	 *
	 * Marks the queried word in the given string with <span class="autocompleter-queried">*</span>
	 * Call this i.e. from your custom parseChoices, same for addChoiceEvents
	 *
	 * @param		{String} Text
	 * @return		{String} Text
	 */
	markQueryValue: function(txt) {
		return (this.options.markQuery && this.queryValue) ? txt.replace(new RegExp('^(' + this.queryValue.escapeRegExp() + ')', 'i'), '<span class="autocompleter-queried">$1</span>') : txt;
	},

	/**
	 * addChoiceEvents
	 *
	 * Appends the needed event handlers for a choice-entry to the given element.
	 *
	 * @param		{Element} Choice entry
	 * @return		{Element} Choice entry
	 */
	addChoiceEvents: function(el) {
		return el.addEvents({
			mouseover: this.choiceOver.bind(this, [el]),
			mousedown: this.choiceSelect.bind(this, [el])
		});
	}
});

Autocompleter.Base.implement(new Events);
Autocompleter.Base.implement(new Options);

Autocompleter.Local = Autocompleter.Base.extend({

	options: {
		minLength: 0,
		filterTokens : null
	},

	initialize: function(el, tokens, options) {
		this.parent(el, options);
		this.tokens = tokens;
		if (this.options.filterTokens) this.filterTokens = this.options.filterTokens.bind(this);
	},

	query: function() {
		this.hideChoices();
		this.queryValue = this.element.value;
		this.updateChoices(this.filterTokens());
	},

	filterTokens: function(token) {
		var regex = new RegExp('^' + this.queryValue.escapeRegExp(), 'i');
		return this.tokens.filter(function(token) {
			return regex.test(token);
		});
	}

});

Autocompleter.Ajax = {};

Autocompleter.Ajax.Base = Autocompleter.Base.extend({

	options: {
		postVar: 'value',
		postData: {},
		ajaxOptions: {},
		onRequest: Class.empty,
		onComplete: Class.empty
	},

	initialize: function(el, url, options) {
		this.parent(el, options);
		this.ajax = new Ajax(url, $merge({
			autoCancel: true
		}, this.options.ajaxOptions));
		this.ajax.addEvent('onComplete', this.queryResponse.bind(this));
		this.ajax.addEvent('onFailure', this.queryResponse.bind(this, [false]));
	},

	query: function(){
		var data = $extend({}, this.options.postData);
		data[this.options.postVar] = this.element.value;
		this.fireEvent('onRequest', [this.element, this.ajax]);
		this.ajax.request(data);
	},

	/**
	 * queryResponse - abstract
	 *
	 * Inherated classes have to extend this function and use this.parent(resp)
	 *
	 * @param		{String} Response
	 */
	queryResponse: function(resp) {
		this.value = this.queryValue = this.element.value;
		this.selected = false;
		this.hideChoices();
		this.fireEvent(resp ? 'onComplete' : 'onFailure', [this.element, this.ajax], 20);
	}

});

Autocompleter.Ajax.Json = Autocompleter.Ajax.Base.extend({

	queryResponse: function(resp) {
		this.parent(resp);
		var choices = Json.evaluate(resp || false);
		if (!choices || !choices.length) return;
		this.updateChoices(choices);
	}

});

Autocompleter.Ajax.Xhtml = Autocompleter.Ajax.Base.extend({

	options: {
		parseChoices: null
	},

	queryResponse: function(resp) {
		this.parent(resp);
		if (!resp) return;
		this.choices.setHTML(resp).getChildren().each(this.options.parseChoices || this.parseChoices, this);
		this.showChoices();
	},

	parseChoices: function(el) {
		var value = el.innerHTML;
		el.inputValue = value;
		el.setHTML(this.markQueryValue(value));
	}

});


var OverlayFix = new Class({

	initialize: function(el) {
		this.element = $(el);
		if (window.ie){
			this.element.addEvent('trash', this.destroy.bind(this));
			this.fix = new Element('iframe', {
				properties: {
					frameborder: '0',
					scrolling: 'no',
					src: 'javascript:false;'
				},
				styles: {
					position: 'absolute',
					border: 'none',
					display: 'none',
					filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'
				}
			}).injectAfter(this.element);
		}
	},

	show: function() {
		if (this.fix) this.fix.setStyles($extend(
			this.element.getCoordinates(), {
				display: '',
				zIndex: (this.element.getStyle('zIndex') || 1) - 1
			}));
		return this;
	},

	hide: function() {
		if (this.fix) this.fix.setStyle('display', 'none');
		return this;
	},

	destroy: function() {
		this.fix.remove();
	}

});
﻿/**
 * Observer - Observe formelements for changes
 *
 * @version		1.0rc1
 *
 * @license		MIT-style license
 * @author		Harald Kirschner <mail [at] digitarald.de>
 * @copyright	Author
 */
var Observer = new Class({

	options: {
		periodical: false,
		delay: 1000
	},

	initialize: function(el, onFired, options){
		this.setOptions(options);
		this.addEvent('onFired', onFired);
		this.element = $(el);
		this.listener = this.fired.bind(this);
		this.value = this.element.getValue();
		if (this.options.periodical) this.timer = this.listener.periodical(this.options.periodical);
		else this.element.addEvent('keyup', this.listener);
	},

	fired: function() {
		var value = this.element.getValue();
		if (this.value == value) return;
		this.clear();
		this.value = value;
		this.timeout = this.fireEvent.delay(this.options.delay, this, ['onFired', [value]]);
	},

	clear: function() {
		$clear(this.timeout);
		return this;
	}
});

Observer.implement(new Options);
Observer.implement(new Events);
﻿/*
Copyright (c) 2007 Brian Dillard and Brad Neuberg:
Brian Dillard | Project Lead | bdillard@pathf.com | http://blogs.pathf.com/agileajax/
Brad Neuberg | Original Project Creator | http://codinginparadise.org
   
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/*
	dhtmlHistory: An object that provides history, history data, and bookmarking for DHTML and Ajax applications.
	
	dependencies:
		* the historyStorage object included in this file.

*/
try{
window.dhtmlHistory = {
	
	/*Public: User-agent booleans*/
	isIE: false,
	isOpera: false,
	isSafari: false,
	isKonquerer: false,
	isGecko: false,
	isSupported: false,
	
	/*Public: Create the DHTML history infrastructure*/
	create: function(options) {
		
		/*
			options - object to store initialization parameters
			options.debugMode - boolean that causes hidden form fields to be shown for development purposes.
			options.toJSON - function to override default JSON stringifier
			options.fromJSON - function to override default JSON parser
		*/

		var that = this;

		/*set user-agent flags*/
		var UA = navigator.userAgent.toLowerCase();
		var platform = navigator.platform.toLowerCase();
		var vendor = navigator.vendor || "";
		if (vendor === "KDE") {
			this.isKonqueror = true;
			this.isSupported = false;
		} else if (typeof window.opera !== "undefined") {
			this.isOpera = true;
			this.isSupported = true;
		} else if (typeof document.all !== "undefined") {
			this.isIE = true;
			this.isSupported = true;
		} else if (vendor.indexOf("Apple Computer, Inc.") > -1) {
			this.isSafari = true;
			this.isSupported = (platform.indexOf("mac") > -1);
		} else if (UA.indexOf("gecko") != -1) {
			this.isGecko = true;
			this.isSupported = true;
		} else if (UA.indexOf("chrome") > -1) {
	    this.isGecko = true;
	    this.isSupported = true;
  	}

		/*Set up the historyStorage object; pass in init parameters*/
		window.historyStorage.setup(options);

		/*Execute browser-specific setup methods*/
		if (this.isSafari) {
			this.createSafari();
		} else if (this.isOpera) {
			this.createOpera();
		}
		
		/*Get our initial location*/
		var initialHash = this.getCurrentLocation();

		/*Save it as our current location*/
		this.currentLocation = initialHash;

		/*Now that we have a hash, create IE-specific code*/
		if (this.isIE) {
			this.createIE(initialHash);
		}

		/*Add an unload listener for the page; this is needed for FF 1.5+ because this browser caches all dynamic updates to the
		page, which can break some of our logic related to testing whether this is the first instance a page has loaded or whether
		it is being pulled from the cache*/

		var unloadHandler = function() {
			that.firstLoad = null;
		};
		
		this.addEventListener(window,'unload',unloadHandler);		

		/*Determine if this is our first page load; for IE, we do this in this.iframeLoaded(), which is fired on pageload. We do it
		there because we have no historyStorage at this point, which only exists after the page is finished loading in IE*/
		if (this.isIE) {
			/*The iframe will get loaded on page load, and we want to ignore this fact*/
			this.ignoreLocationChange = true;
		} else {
			if (!historyStorage.hasKey(this.PAGELOADEDSTRING)) {
				/*This is our first page load, so ignore the location change and add our special history entry*/
				this.ignoreLocationChange = true;
				this.firstLoad = true;
				historyStorage.put(this.PAGELOADEDSTRING, true);
			} else {
				/*This isn't our first page load, so indicate that we want to pay attention to this location change*/
				this.ignoreLocationChange = false;
				/*For browsers other than IE, fire a history change event; on IE, the event will be thrown automatically when its
				hidden iframe reloads on page load. Unfortunately, we don't have any listeners yet; indicate that we want to fire
				an event when a listener is added.*/
				this.fireOnNewListener = true;
			}
		}

		/*Other browsers can use a location handler that checks at regular intervals as their primary mechanism; we use it for IE as
		well to handle an important edge case; see checkLocation() for details*/
		var locationHandler = function() {
			that.checkLocation();
		};
		setInterval(locationHandler, 100);
	},	
	
	/*Public: Initialize our DHTML history. You must call this after the page is finished loading.*/
	initialize: function() {
		/*IE needs to be explicitly initialized. IE doesn't autofill form data until the page is finished loading, so we have to wait*/
		if (this.isIE) {
			/*If this is the first time this page has loaded*/
			if (!historyStorage.hasKey(this.PAGELOADEDSTRING)) {
				/*For IE, we do this in initialize(); for other browsers, we do it in create()*/
				this.fireOnNewListener = false;
				this.firstLoad = true;
				historyStorage.put(this.PAGELOADEDSTRING, true);
			}
			/*Else if this is a fake onload event*/
			else {
				this.fireOnNewListener = true;
				this.firstLoad = false;   
			}
		}
	},

	/*Public: Adds a history change listener. Note that only one listener is supported at this time.*/
	addListener: function(listener) {
		this.listener = listener;
		/*If the page was just loaded and we should not ignore it, fire an event to our new listener now*/
		if (this.fireOnNewListener) {
			this.fireHistoryEvent(this.currentLocation);
			this.fireOnNewListener = false;
		}
	},
	
	/*Public: Generic utility function for attaching events*/
	addEventListener: function(o,e,l) {
		if (o.addEventListener) {
			o.addEventListener(e,l,false);
		} else if (o.attachEvent) {
			o.attachEvent('on'+e,function() {
				l(window.event);
			});
		}
	},
	
	/*Public: Add a history point.*/
	add: function(newLocation, historyData) {
		
		if (this.isSafari) {
			
			/*Remove any leading hash symbols on newLocation*/
			newLocation = this.removeHash(newLocation);

			/*Store the history data into history storage*/
			historyStorage.put(newLocation, historyData);

			/*Save this as our current location*/
			this.currentLocation = newLocation;
	
			/*Change the browser location*/
			window.location.hash = newLocation;
		
			/*Save this to the Safari form field*/
			this.putSafariState(newLocation);

		} else {
			
			/*Most browsers require that we wait a certain amount of time before changing the location, such
			as 200 MS; rather than forcing external callers to use window.setTimeout to account for this,
			we internally handle it by putting requests in a queue.*/
			var that = this;
			var addImpl = function() {

				/*Indicate that the current wait time is now less*/
				if (that.currentWaitTime > 0) {
					that.currentWaitTime = that.currentWaitTime - that.waitTime;
				}
			
				/*Remove any leading hash symbols on newLocation*/
				newLocation = that.removeHash(newLocation);

				/*IE has a strange bug; if the newLocation is the same as _any_ preexisting id in the
				document, then the history action gets recorded twice; throw a programmer exception if
				there is an element with this ID*/
				if (document.getElementById(newLocation) && that.debugMode) {
					var e = "Exception: History locations can not have the same value as _any_ IDs that might be in the document,"
					+ " due to a bug in IE; please ask the developer to choose a history location that does not match any HTML"
					+ " IDs in this document. The following ID is already taken and cannot be a location: " + newLocation;
					throw new Error(e); 
				}

				/*Store the history data into history storage*/
				historyStorage.put(newLocation, historyData);

				/*Indicate to the browser to ignore this upcomming location change since we're making it programmatically*/
				that.ignoreLocationChange = true;

				/*Indicate to IE that this is an atomic location change block*/
				that.ieAtomicLocationChange = true;

				/*Save this as our current location*/
				that.currentLocation = newLocation;
		
				/*Change the browser location*/
				window.location.hash = newLocation;

				/*Change the hidden iframe's location if on IE*/
				if (that.isIE) {
					that.iframe.src = "blank.html?" + newLocation;
				}

				/*End of atomic location change block for IE*/
				that.ieAtomicLocationChange = false;
			};

			/*Now queue up this add request*/
			window.setTimeout(addImpl, this.currentWaitTime);

			/*Indicate that the next request will have to wait for awhile*/
			this.currentWaitTime = this.currentWaitTime + this.waitTime;
		}
	},

	/*Public*/
	isFirstLoad: function() {
		return this.firstLoad;
	},

	/*Public*/
	getVersion: function() {
		return "0.6";
	},

	/*Get browser's current hash location; for Safari, read value from a hidden form field*/

	/*Public*/
	getCurrentLocation: function() {
		var r = (false /*this.isSafari*/
			? this.getSafariState()
			: this.getCurrentHash()
		);
		return r;
	},
	
	/*Public: Manually parse the current url for a hash; tip of the hat to YUI*/
    getCurrentHash: function() {
		var r = window.location.href;
		var i = r.indexOf("#");
		return (i >= 0
			? r.substr(i+1)
			: ""
		);
    },
	
	/*- - - - - - - - - - - -*/
	
	/*Private: Constant for our own internal history event called when the page is loaded*/
	PAGELOADEDSTRING: "DhtmlHistory_pageLoaded",
	
	/*Private: Our history change listener.*/
	listener: null,

	/*Private: MS to wait between add requests - will be reset for certain browsers*/
	waitTime: 200,
	
	/*Private: MS before an add request can execute*/
	currentWaitTime: 0,

	/*Private: Our current hash location, without the "#" symbol.*/
	currentLocation: null,

	/*Private: Hidden iframe used to IE to detect history changes*/
	iframe: null,

	/*Private: Flags and DOM references used only by Safari*/
	safariHistoryStartPoint: null,
	safariStack: null,
	safariLength: null,

	/*Private: Flag used to keep checkLocation() from doing anything when it discovers location changes we've made ourselves
	programmatically with the add() method. Basically, add() sets this to true. When checkLocation() discovers it's true,
	it refrains from firing our listener, then resets the flag to false for next cycle. That way, our listener only gets fired on
	history change events triggered by the user via back/forward buttons and manual hash changes. This flag also helps us set up
	IE's special iframe-based method of handling history changes.*/
	ignoreLocationChange: null,

	/*Private: A flag that indicates that we should fire a history change event when we are ready, i.e. after we are initialized and
	we have a history change listener. This is needed due to an edge case in browsers other than IE; if you leave a page entirely
	then return, we must fire this as a history change event. Unfortunately, we have lost all references to listeners from earlier,
	because JavaScript clears out.*/
	fireOnNewListener: null,

	/*Private: A variable that indicates whether this is the first time this page has been loaded. If you go to a web page, leave it
	for another one, and then return, the page's onload listener fires again. We need a way to differentiate between the first page
	load and subsequent ones. This variable works hand in hand with the pageLoaded variable we store into historyStorage.*/
	firstLoad: null,

	/*Private: A variable to handle an important edge case in IE. In IE, if a user manually types an address into their browser's
	location bar, we must intercept this by calling checkLocation() at regular intervals. However, if we are programmatically
	changing the location bar ourselves using the add() method, we need to ignore these changes in checkLocation(). Unfortunately,
	these changes take several lines of code to complete, so for the duration of those lines of code, we set this variable to true.
	That signals to checkLocation() to ignore the change-in-progress. Once we're done with our chunk of location-change code in
	add(), we set this back to false. We'll do the same thing when capturing user-entered address changes in checkLocation itself.*/
	ieAtomicLocationChange: null,
	
	/*Private: Create IE-specific DOM nodes and overrides*/
	createIE: function(initialHash) {
		/*write out a hidden iframe for IE and set the amount of time to wait between add() requests*/
		this.waitTime = 400;/*IE needs longer between history updates*/
		var styles = (historyStorage.debugMode
			? 'width: 800px;height:80px;border:1px solid black;'
			: historyStorage.hideStyles
		);
		var iframeID = "rshHistoryFrame";
		var iframeHTML = '<iframe frameborder="0" id="' + iframeID + '" style="' + styles + '" src="blank.html?' + initialHash + '"></iframe>';
		document.write(iframeHTML);
		this.iframe = document.getElementById(iframeID);
	},
	
	/*Private: Create Opera-specific DOM nodes and overrides*/
	createOpera: function() {
		this.waitTime = 400;/*Opera needs longer between history updates*/
		var imgHTML = '<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="' + historyStorage.hideStyles + '" />';
		document.write(imgHTML);
	},
	
	/*Private: Create Safari-specific DOM nodes and overrides*/
	createSafari: function() {
		var formID = "rshSafariForm";
		var stackID = "rshSafariStack";
		var lengthID = "rshSafariLength";
		var formStyles = historyStorage.debugMode ? historyStorage.showStyles : historyStorage.hideStyles;
		var inputStyles = (historyStorage.debugMode
			? 'width:800px;height:20px;border:1px solid black;margin:0;padding:0;'
			: historyStorage.hideStyles
		);
		var safariHTML = '<form id="' + formID + '" style="' + formStyles + '">'
			+ '<input type="text" style="' + inputStyles + '" id="' + stackID + '" value="[]"/>'
			+ '<input type="text" style="' + inputStyles + '" id="' + lengthID + '" value=""/>'
		+ '</form>';
		document.write(safariHTML);
		this.safariStack = document.getElementById(stackID);
		this.safariLength = document.getElementById(lengthID);
		if (!historyStorage.hasKey(this.PAGELOADEDSTRING)) {
			this.safariHistoryStartPoint = history.length;
			this.safariLength.value = this.safariHistoryStartPoint;
		} else {
			this.safariHistoryStartPoint = this.safariLength.value;
		}
	},
	
	/*Private: Safari method to read the history stack from a hidden form field*/
	getSafariStack: function() {
		var r = this.safariStack.value;
		return historyStorage.fromJSON(r);
	},

	/*Private: Safari method to read from the history stack*/
	getSafariState: function() {
		var stack = this.getSafariStack();
		var state = stack[history.length - this.safariHistoryStartPoint - 1];
		return state;
	},			
	/*Private: Safari method to write the history stack to a hidden form field*/
	putSafariState: function(newLocation) {
	    var stack = this.getSafariStack();
	    stack[history.length - this.safariHistoryStartPoint] = newLocation;
	    this.safariStack.value = historyStorage.toJSON(stack);
	},

	/*Private: Notify the listener of new history changes.*/
	fireHistoryEvent: function(newHash) {
		/*extract the value from our history storage for this hash*/
		var historyData = historyStorage.get(newHash);
		/*call our listener*/
		this.listener.call(null, newHash, historyData);
	},
	
	/*Private: See if the browser has changed location. This is the primary history mechanism for Firefox. For IE, we use this to
	handle an important edge case: if a user manually types in a new hash value into their IE location bar and press enter, we want to
	to intercept this and notify any history listener.*/
	checkLocation: function() {
		
		/*Ignore any location changes that we made ourselves for browsers other than IE*/
		if (!this.isIE && this.ignoreLocationChange) {
			this.ignoreLocationChange = false;
			return;
		}

		/*If we are dealing with IE and we are in the middle of making a location change from an iframe, ignore it*/
		if (!this.isIE && this.ieAtomicLocationChange) {
			return;
		}
		
		/*Get hash location*/
		var hash = this.getCurrentLocation();

		/*Do nothing if there's been no change*/
		if (hash == this.currentLocation) {
			return;
		}

		/*In IE, users manually entering locations into the browser; we do this by comparing the browser's location against the
		iframe's location; if they differ, we are dealing with a manual event and need to place it inside our history, otherwise
		we can return*/
		this.ieAtomicLocationChange = true;

		if (this.isIE && this.getIframeHash() != hash) {
			this.iframe.src = "blank.html?" + hash;
		}
		else if (this.isIE) {
			/*the iframe is unchanged*/
			return;
		}

		/*Save this new location*/
		this.currentLocation = hash;

		this.ieAtomicLocationChange = false;

		/*Notify listeners of the change*/
		this.fireHistoryEvent(hash);
	},

	/*Private: Get the current location of IE's hidden iframe.*/
	getIframeHash: function() {
		var doc = this.iframe.contentWindow.document;
		var hash = String(doc.location.search);
		if (hash.length == 1 && hash.charAt(0) == "?") {
			hash = "";
		}
		else if (hash.length >= 2 && hash.charAt(0) == "?") {
			hash = hash.substring(1);
		}
		return hash;
	},

	/*Private: Remove any leading hash that might be on a location.*/
	removeHash: function(hashValue) {
		var r;
		if (hashValue === null || hashValue === undefined) {
			r = null;
		}
		else if (hashValue === "") {
			r = "";
		}
		else if (hashValue.length == 1 && hashValue.charAt(0) == "#") {
			r = "";
		}
		else if (hashValue.length > 1 && hashValue.charAt(0) == "#") {
			r = hashValue.substring(1);
		}
		else {
			r = hashValue;
		}
		return r;
	},

	/*Private: For IE, tell when the hidden iframe has finished loading.*/
	iframeLoaded: function(newLocation) {
		/*ignore any location changes that we made ourselves*/
		if (this.ignoreLocationChange) {
			this.ignoreLocationChange = false;
			return;
		}

		/*Get the new location*/
		var hash = String(newLocation.search);
		if (hash.length == 1 && hash.charAt(0) == "?") {
			hash = "";
		}
		else if (hash.length >= 2 && hash.charAt(0) == "?") {
			hash = hash.substring(1);
		}
		/*Keep the browser location bar in sync with the iframe hash*/
		window.location.hash = hash;

		/*Notify listeners of the change*/
		this.fireHistoryEvent(hash);
	}

};

/*
	historyStorage: An object that uses a hidden form to store history state across page loads. The mechanism for doing so relies on
	the fact that browsers save the text in form data for the life of the browser session, which means the text is still there when
	the user navigates back to the page. This object can be used independently of the dhtmlHistory object for caching of Ajax
	session information.
	
	dependencies: 
		* json2007.js (included in a separate file) or alternate JSON methods passed in through an options bundle.
*/
window.historyStorage = {
	
	/*Public: Set up our historyStorage object for use by dhtmlHistory or other objects*/
	setup: function(options) {
		
		/*
			options - object to store initialization parameters - passed in from dhtmlHistory or directly into historyStorage
			options.debugMode - boolean that causes hidden form fields to be shown for development purposes.
			options.toJSON - function to override default JSON stringifier
			options.fromJSON - function to override default JSON parser
		*/
		
		/*process init parameters*/
		if (typeof options !== "undefined") {
			if (options.debugMode) {
				this.debugMode = options.debugMode;
			}
			if (options.toJSON) {
				this.toJSON = options.toJSON;
			}
			if (options.fromJSON) {
				this.fromJSON = options.fromJSON;
			}
		}		
		
		/*write a hidden form and textarea into the page; we'll stow our history stack here*/
		var formID = "rshStorageForm";
		var textareaID = "rshStorageField";
		var formStyles = this.debugMode ? historyStorage.showStyles : historyStorage.hideStyles;
		var textareaStyles = (historyStorage.debugMode
			? 'width: 800px;height:80px;border:1px solid black;'
			: historyStorage.hideStyles
		);
		var textareaHTML = '<form id="' + formID + '" style="' + formStyles + '">'
			+ '<textarea id="' + textareaID + '" style="' + textareaStyles + '"></textarea>'
		+ '</form>';
		document.write(textareaHTML);
		this.storageField = document.getElementById(textareaID);
		if (typeof window.opera !== "undefined") {
			this.storageField.focus();/*Opera needs to focus this element before persisting values in it*/
		}
	},
	
	/*Public*/
	put: function(key, value) {
		this.assertValidKey(key);
		/*if we already have a value for this, remove the value before adding the new one*/
		if (this.hasKey(key)) {
			this.remove(key);
		}
		/*store this new key*/
		this.storageHash[key] = value;
		/*save and serialize the hashtable into the form*/
		this.saveHashTable();
	},

	/*Public*/
	get: function(key) {
		this.assertValidKey(key);
		/*make sure the hash table has been loaded from the form*/
		this.loadHashTable();
		var value = this.storageHash[key];
		if (value === undefined) {
			value = null;
		}
		return value;
	},

	/*Public*/
	remove: function(key) {
		this.assertValidKey(key);
		/*make sure the hash table has been loaded from the form*/
		this.loadHashTable();
		/*delete the value*/
		delete this.storageHash[key];
		/*serialize and save the hash table into the form*/
		this.saveHashTable();
	},

	/*Public: Clears out all saved data.*/
	reset: function() {
		this.storageField.value = "";
		this.storageHash = {};
	},

	/*Public*/
	hasKey: function(key) {
		this.assertValidKey(key);
		/*make sure the hash table has been loaded from the form*/
		this.loadHashTable();
		return (typeof this.storageHash[key] !== "undefined");
	},

	/*Public*/
	isValidKey: function(key) {
		return (typeof key === "string");
	},
	
	/*Public - CSS strings utilized by both objects to hide or show behind-the-scenes DOM elements*/
	showStyles: 'border:0;margin:0;padding:0;',
	hideStyles: 'left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;',
	
	/*Public - debug mode flag*/
	debugMode: false,
	
	/*- - - - - - - - - - - -*/

	/*Private: Our hash of key name/values.*/
	storageHash: {},

	/*Private: If true, we have loaded our hash table out of the storage form.*/
	hashLoaded: false, 

	/*Private: DOM reference to our history field*/
	storageField: null,

	/*Private: Assert that a key is valid; throw an exception if it not.*/
	assertValidKey: function(key) {
		var isValid = this.isValidKey(key);
		if (!isValid && this.debugMode) {
			throw new Error("Please provide a valid key for window.historyStorage. Invalid key = " + key + ".");
		}
	},

	/*Private: Load the hash table up from the form.*/
	loadHashTable: function() {
		if (!this.hashLoaded) {	
			var serializedHashTable = this.storageField.value;
			if (serializedHashTable !== "" && serializedHashTable !== null) {
				this.storageHash = this.fromJSON(serializedHashTable);
				this.hashLoaded = true;
			}
		}
	},
	/*Private: Save the hash table into the form.*/
	saveHashTable: function() {
		this.loadHashTable();
		var serializedHashTable = this.toJSON(this.storageHash);
		this.storageField.value = serializedHashTable;
	},
	/*Private: Bridges for our JSON implementations - both rely on 2007 JSON.org library - can be overridden by options bundle*/
	toJSON: function(o) {
		return o.toJSONString();
	},
	fromJSON: function(s) {
		return s.parseJSON();
	}
};
}catch(E){}




















FIELDS = [
    ["Citta"                ,"%comune%",null,{"fieldLabel":"Stadt"}],
    	["Bagni"                ,"%nBagni%", null,{"fieldLabel":"Bad"}],
    ["Regione"                ,"%nome%",null,{"fieldLabel":"Region"}],
    	["Docce"                ,"%nDocce%", null,{"fieldLabel":"Schauer"}],
		["Anno"                 ,"%anno%",null,{"fieldLabel":"Jahr"}],
			["Motori"               ,"%nMotori%", null,{"fieldLabel":"Motors"}],
    ["Cabine"               ,"%nCabine%",null,{"fieldLabel":"H&uuml;tten"}],
    	["Tipo motore"          ,"%tipoMotore%", null,{"fieldLabel":"Motor-Typ"}],
    ["Persone"              ,"%portataOmologataPersone%",null,{"fieldLabel":"Passagiere"}],
    	["Marca motore"         ,"%marca%", null,{"fieldLabel":"Motorenhersteller"}],
    ["Posti letto"          ,"%postiLetto%",null,{"fieldLabel":"Betten"}],
    	["Potenza motore"       ,"%potenzaMaxMotoreHp%", null,{"fieldLabel":"Motorleistung"}],
    ["Lunghezza"            ,"%lunghezza%",null,{"fieldLabel":"L&auml;nge"}],
    	["Serbatoio carb." 		,"%serbatoioCarburante%", null,{"fieldLabel":"Kraftstoffbeh&auml;lter"}],
    ["Larghezza"            ,"%larghezza%",null,{"fieldLabel":"Breite"}],
    	["Serbatoio acqua"      ,"%serbatoioAcqua%", null,{"fieldLabel":"Wassertank"}],   
    ["Immersione"           ,"%immersione%",null,{"fieldLabel":"Entwurf"}],
    	["Peso"                 ,"%dislocamento%", null,{"fieldLabel":"Gewicht"}]
    
			
    
 			
    
    	
]	
REGIONI=[{sailsWE:0,stato:"Croazia",motorsWE:0,gommonsWE:0,gommons:2,sails:160,catamaransWE:0,yachts:11,yachtsWE:0,catamarans:7,assets:{de:"Nord-Kroatien",it:"Croazia del Nord",en:"Northern Croatia",si:"NO ASSET FOUND"},motors:46,coords:"43,126,51,176,67,211,85,205,99,168,96,162,98,143,91,135,91,128,91,128,91,135,98,143,96,162,99,168,105,239,124,235,120,200,144,218,140,174,151,174,155,171,175,137,124,111,140,174,144,218,127,205,142,234,149,230,169,244,178,240,199,253,207,254,210,250,209,238,218,232,223,232,226,237,229,237,231,235,235,236,240,231,203,181,157,168,152,174",gulets:0,nome:"Croazia del Nord",basi:[{marine:[{name:"Marina Mali Losinj"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:17,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.5308,14.47076",gulets:0,nome:"Mali Losinj",guletsWE:0},{marine:[{name:"Tehnomont Marina Veruda"},{name:"Marina Veruda "},{name:"Marina Bunarina"},{name:"Marina Veruda"},{name:"Marina Veruda"},{name:"Marina Boljun"},{name:"Marina Bunarina"},{name:"Veruda"},{name:"Pula"},{name:"Pula"},{name:"Pula"},{name:"Marina Veruda"},{name:"Marina Veruda Pula"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:75,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:2,motors:9,coords:"44.86965,13.84115",gulets:0,nome:"Pula",guletsWE:0},{marine:[{name:"Marina Punat"},{name:"Marina Punat"},{name:"Marina Punat"},{name:"Marina Punat"},{name:"Marina Punat"},{name:"Marina Punat"},{name:"Punat"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:31,catamaransWE:0,yachts:7,yachtsWE:0,catamarans:2,motors:22,coords:"45.01885,14.6293",gulets:0,nome:"Punat",guletsWE:0},{marine:[{name:"Marina Funtana"},{name:"Funtana"},{name:"Funtana"}],sailsWE:0,motorsWE:0,gommons:2,gommonsWE:0,sails:10,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:7,coords:"45.17286,13.60578",gulets:0,nome:"Funtana",guletsWE:0},{marine:[{name:"Aci Marina Pomer"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:13,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"44.82429,13.8965",gulets:0,nome:"Pomer",guletsWE:0},{marine:[{name:"ACI Marina Rovinj"},{name:"Rovinj"},{name:"Rovinj"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:13,catamaransWE:0,yachts:3,yachtsWE:0,catamarans:1,motors:1,coords:"45.08084,13.63835",gulets:0,nome:"Rovinj",guletsWE:0},{marine:[],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.95766,14.40919",gulets:0,nome:"Cres",guletsWE:0},{marine:[{name:"Marina di Vrsar"},{name:"Vrsar"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:7,coords:"45.15041,13.60686",gulets:0,nome:"Vrsar",guletsWE:0},{marine:[{name:"Opatija"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.33676,14.31027",gulets:0,nome:"Opatija",guletsWE:0},{marine:[{name:"Novigrad"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.31958,13.56001",gulets:0,nome:"Novigrad",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Croazia",motorsWE:0,gommonsWE:0,gommons:2,sails:1266,catamaransWE:0,yachts:87,yachtsWE:0,catamarans:79,assets:{de:"Nord-Dalmatien",it:"Dalmazia Settentrionale",en:"North Dalmatia",si:"NO ASSET FOUND"},motors:87,coords:"114,243,142,234,149,230,169,244,178,240,199,253,207,254,210,250,209,238,218,232,223,232,226,237,229,237,231,235,244,239,244,260,236,260,232,265,232,268,226,269,219,264,210,281,207,290,202,295,198,294,194,291,184,299,190,313,183,316,127,269,190,313,184,299,194,291,198,294,202,295,207,290,210,281,219,264,226,269,232,268,232,265,236,260,244,260,267,284,256,286,249,291,249,294,255,300,247,308,247,311,245,313,236,313,227,322,227,329,222,333,196,325",gulets:1,nome:"Dalmazia Settentrionale",basi:[{marine:[{name:"Aci Marina Jezera "},{name:"ACI marina Jezera"},{name:"ACI Marina Jezera"},{name:"Marina Krvavica"},{name:"ACI marina Jezera "},{name:"Marina Betina"},{name:"Marina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:49,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"43.78582,15.6436",gulets:0,nome:"Jezera",guletsWE:0},{marine:[{name:"Marina Dalmacija"},{name:"Marina Dalmacija "},{name:"Sukosan"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacija"},{name:"Marina Dalmacjia"},{name:"Sukosan"},{name:"Sukosan"},{name:"Marina Dalmacija"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:416,catamaransWE:0,yachts:17,yachtsWE:0,catamarans:39,motors:36,coords:"44.04492,15.31075",gulets:0,nome:"Sukosan",guletsWE:0},{marine:[{name:"Marina Sangulin"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Biograd"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Marina Kornati"},{name:"Biograd"},{name:"Marina Kornati"},{name:"Biograd"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:292,catamaransWE:0,yachts:9,yachtsWE:0,catamarans:12,motors:26,coords:"43.93783,15.44442",gulets:0,nome:"Biograd",guletsWE:0},{marine:[{name:"Marina Hramina"},{name:"Murter"},{name:"Marina Hramina"},{name:"Marina Hramina"},{name:"Marina Hramina"},{name:"Marina Hramina"},{name:"Marina Betina"},{name:"Marina Hramina"},{name:"Marina Betina Murter"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:98,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:8,motors:7,coords:"43.80836,15.6002",gulets:0,nome:"Murter",guletsWE:0},{marine:[{name:"Sibenik"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Marina Mandalina"},{name:"Sibenik"},{name:"Sibenik"},{name:"Marina Mandalina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:171,catamaransWE:0,yachts:34,yachtsWE:0,catamarans:12,motors:3,coords:"43.73399,15.89507",gulets:1,nome:"Sibenik",guletsWE:0},{marine:[{name:"Primosten"},{name:"Marina Kremik"},{name:"Marina Kremik"},{name:"Marina Kremit"},{name:"Marina Kremit"},{name:"Marina Kremit"},{name:"Marina KremiK"},{name:"Marina KremiK"},{name:"Primosten"},{name:"Marina KremiK"}],sailsWE:0,motorsWE:0,gommons:2,gommonsWE:0,sails:79,catamaransWE:0,yachts:25,yachtsWE:0,catamarans:5,motors:2,coords:"43.5882,15.9245",gulets:0,nome:"Primosten",guletsWE:0},{marine:[{name:"Olive Island Marina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:35,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.09557,15.1744",gulets:0,nome:"Sutomiscica",guletsWE:0},{marine:[{name:"Marina Tankerkomerc"},{name:"Marina Zadar"},{name:"Marina Zadar"},{name:"Marina Zadar Tankerkomerc"},{name:"MARINA ZADAR"},{name:"Marina Zadar"},{name:"Marina Zadar"},{name:"Marina Zadar"},{name:"Zadar"},{name:"Zadar"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:55,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:0,motors:13,coords:"44.11488,15.22895",gulets:0,nome:"Zadar",guletsWE:0},{marine:[{name:"Vodice"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:19,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.75735,15.77406",gulets:0,nome:"Vodice",guletsWE:0},{marine:[{name:"Marina Frapa"},{name:"Marina Frapa"},{name:"Rogoznica"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:21,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.52626,15.96915",gulets:0,nome:"Rogoznica",guletsWE:0},{marine:[{name:"Marina Preko"},{name:"Zadar"},{name:"Marina Preko"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:31,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"44.13104,15.1026",gulets:0,nome:"Ugljan",guletsWE:0},{marine:[{name:"Aci Marina Skradin"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.81666,15.92166",gulets:0,nome:"Skradin",guletsWE:0}],guletsWE:0},{sailsWE:14,stato:"Croazia",motorsWE:0,gommonsWE:0,gommons:1,sails:564,catamaransWE:0,yachts:47,yachtsWE:0,catamarans:35,assets:{de:"Süddalmatien",it:"Dalmazia Meridionale",en:"Southern Dalmatia",si:"NO ASSET FOUND"},motors:28,coords:"267,284,256,286,249,291,249,294,255,300,247,308,247,311,245,313,236,313,227,322,227,329,214,339,173,370,202,395,253,386,321,373,326,370,325,367,328,365,334,365,321,332,326,370,325,367,328,365,339,365,362,384,421,434,415,454,365,419,268,418,264,384,321,373",gulets:32,nome:"Dalmazia Meridionale",basi:[{marine:[{name:"Marina Kastela "},{name:"Marina Kastela "},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Marina Kastela"},{name:"Kastel gomilica"}],sailsWE:14,motorsWE:0,gommons:0,gommonsWE:0,sails:230,catamaransWE:0,yachts:9,yachtsWE:0,catamarans:5,motors:1,coords:"43.55032,16.39999",gulets:1,nome:"Kastel Gomilica",guletsWE:0},{marine:[{name:"Marina Tucepi"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.26278,17.06049",gulets:0,nome:"Tucepi",guletsWE:0},{marine:[{name:"Dubrovnik"},{name:"Aci Marina Dubrovnik"},{name:"Aci Marina Dubrovnik"},{name:"Aci Marina Dubrovnik"},{name:"Aci Marina Dubrovnik"},{name:"Dubrovnik"},{name:"Dubrovnik"},{name:"Dubrovnik"},{name:"Dubrovnik"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:22,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.64183,18.10645",gulets:4,nome:"Dubrovnik",guletsWE:0},{marine:[{name:"Aci Marina Split"},{name:"Aci Marina Split "},{name:"Split"},{name:"Aci Marina Split "},{name:"Aci Marina Split "},{name:"Aci Marina Split"},{name:"Aci Marina Split"},{name:"Marina Spinut"},{name:"Aci Marina Split"},{name:"Nava Marina Split"},{name:"Aci Marina Split"},{name:"Split"},{name:"Split"},{name:"Split"},{name:"Marina Aci Split"},{name:"Split"},{name:"Split"},{name:"Split"},{name:"Split"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:128,catamaransWE:0,yachts:22,yachtsWE:0,catamarans:13,motors:15,coords:"43.50691,16.44245",gulets:27,nome:"Split",guletsWE:0},{marine:[{name:"Marina Agana"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.51408,16.10819",gulets:0,nome:"Marina",guletsWE:0},{marine:[{name:"ACI Marina Trogir"},{name:"Marina Agana"},{name:"ACI Marina Trogir"},{name:"Trogir"},{name:"ACI Marina Trogir"},{name:"Marina Agana"},{name:"ACI MARINA Trogir"},{name:"ACI MARINA Trogir"},{name:"Marina Trogir"},{name:"Trogir"},{name:"Trogir"},{name:"Marina Trogir"},{name:"Trogir"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:128,catamaransWE:0,yachts:15,yachtsWE:0,catamarans:12,motors:9,coords:"43.51773,16.25066",gulets:0,nome:"Trogir",guletsWE:0},{marine:[{name:"Rogac"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:11,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.3953,16.29855",gulets:0,nome:"Rogac",guletsWE:0},{marine:[{name:"Krvavica"},{name:"Marina Baska Voda"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:24,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:0,motors:0,coords:"43.35845,16.94768",gulets:0,nome:"Baska Voda",guletsWE:0},{marine:[{name:"Marina Mirna Vala"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.48933,16.11274",gulets:0,nome:"Vinisce",guletsWE:0},{marine:[{name:"Hvar"}],sailsWE:0,motorsWE:0,gommons:1,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:3,coords:"43.17259,16.44323",gulets:0,nome:"Hvar",guletsWE:0},{marine:[{name:"Krvavica Makarska"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:10,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"43.29111,17.01657",gulets:0,nome:"Makarska",guletsWE:0},{marine:[{name:"Marina Ramova Krvavica"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:5,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:4,motors:0,coords:"43.32399,16.98237",gulets:0,nome:"Krvavica",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Grecia",motorsWE:0,gommonsWE:0,gommons:0,sails:350,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:71,assets:{de:"Dodekanes",it:"Dodecanneso",en:"Dodecanese",si:"NO ASSET FOUND"},motors:19,gulets:0,nome:"Dodecanneso",basi:[{marine:[{name:"Kos"},{name:"Kos"},{name:"Kos Marina"},{name:"Kos"},{name:"Kos"},{name:"Kos"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:160,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:34,motors:9,coords:"36.89597,27.28794",gulets:0,nome:"Kos",guletsWE:0},{marine:[{name:"Rhodos"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"36.44324,28.22701",gulets:0,nome:"Rhodos",guletsWE:0},{marine:[{name:"Samos"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:77,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:14,motors:2,coords:"37.75154,26.97153",gulets:0,nome:"Samos",guletsWE:0},{marine:[{name:"Rodi"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:112,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:23,motors:8,coords:"36.45044,28.23259",gulets:0,nome:"Rodi",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Grecia",motorsWE:0,gommonsWE:0,gommons:0,sails:400,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:67,assets:{de:"Ionisches Meer",it:"Mar Ionio",en:"Ionian Sea",si:"NO ASSET FOUND"},motors:17,gulets:0,nome:"Mar Ionio",basi:[{marine:[{name:"Gouvia Marina"},{name:"Corfu"},{name:"Korfu"},{name:"Corfu"},{name:"Corfu"},{name:"Corfu"},{name:"Corfu"},{name:"Corfu"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:147,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:27,motors:8,coords:"39.6193,19.91959",gulets:0,nome:"Corfu",guletsWE:0},{marine:[{name:"Preveza"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:30,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"38.95791,20.75412",gulets:0,nome:"Preveza",guletsWE:0},{marine:[{name:"Marina Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"},{name:"Lefkas"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:197,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:37,motors:9,coords:"38.83123,20.71174",gulets:0,nome:"Lefkas",guletsWE:0},{marine:[{name:"Palairos"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:26,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"38.78148,20.8779",gulets:0,nome:"Palairos",guletsWE:0},{marine:[{name:"Patras"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"38.25462,21.6985",gulets:0,nome:"Patras",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Grecia",motorsWE:0,gommonsWE:0,gommons:0,sails:731,catamaransWE:0,yachts:2,yachtsWE:0,catamarans:142,assets:{de:"NO ASSET FOUND",it:"Cicladi",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:25,gulets:0,nome:"Cicladi",basi:[{marine:[{name:"Marina Alimos"},{name:"Athens"},{name:"Athens"},{name:"Athen - Kalamaki"},{name:"Athens"},{name:"Athens"},{name:"Athens"},{name:"Athens"},{name:"Alimos Marina"},{name:"Atene"},{name:"Marina Alimos"},{name:"Alimos Marina"},{name:"Athens"},{name:"Atene"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:429,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:82,motors:9,coords:"37.94159,23.63399",gulets:0,nome:"Athens",guletsWE:0},{marine:[{name:"Syros"},{name:"Syros"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:48,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:10,motors:0,coords:"37.44743,24.89883",gulets:0,nome:"Syros",guletsWE:0},{marine:[{name:"Lavrio"},{name:"Lavrio"},{name:"Lavrion"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:118,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:23,motors:8,coords:"37.7104,24.0593",gulets:0,nome:"Lavrio",guletsWE:0},{marine:[{name:"Vlychada Marina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:16,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:4,motors:0,coords:"36.33618,25.43499",gulets:0,nome:"Santorini",guletsWE:0},{marine:[{name:"Poros"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"37.50303,23.45107",gulets:0,nome:"Poros",guletsWE:0},{marine:[{name:"Paros"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:112,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:23,motors:8,coords:"37.13278,25.24694",gulets:0,nome:"Paros",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Grecia",motorsWE:0,gommonsWE:0,gommons:0,sails:123,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:24,assets:{de:"NO ASSET FOUND",it:"Sporadi",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:8,gulets:0,nome:"Sporadi",basi:[{marine:[{name:"Skiathos"},{name:"Skiathos"},{name:"Skiathos"},{name:"Skiathos"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:123,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:24,motors:8,coords:"39.16165,23.48984",gulets:0,nome:"Skiathos",guletsWE:0}],guletsWE:0},{sailsWE:260,stato:"Italia",motorsWE:1,gommonsWE:0,gommons:0,sails:297,catamaransWE:20,yachts:11,yachtsWE:0,catamarans:29,assets:{de:"NO ASSET FOUND",it:"Sardegna e Maddalena",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:8,gulets:3,nome:"Sardegna",basi:[{marine:[{name:"Marina Cannigione"},{name:"Cannigione"},{name:"Porto di Cannigione"},{name:"Cannigione"},{name:"Cannigione"},{name:"Cannigione"},{name:"Isuledda a"},{name:"Isuledda "},{name:"Cannigione"},{name:"Cannigione"},{name:"Cannigione"}],sailsWE:52,motorsWE:0,gommons:0,gommonsWE:0,sails:67,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:3,coords:"41.10624,9.43743",gulets:0,nome:"Cannigione",guletsWE:0},{marine:[{name:"Carloforte"},{name:"Carloforte"}],sailsWE:17,motorsWE:0,gommons:0,gommonsWE:0,sails:18,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:1,coords:"39.14071,8.276",gulets:0,nome:"Isola di San Pietro",guletsWE:0},{marine:[{name:"Portisco"},{name:"Portisco"},{name:"Portisco"},{name:"Portisco"}],sailsWE:66,motorsWE:0,gommons:0,gommonsWE:0,sails:66,catamaransWE:5,yachts:0,yachtsWE:0,catamarans:5,motors:0,coords:"41.04141,9.52126",gulets:0,nome:"Portisco",guletsWE:0},{marine:[{name:"Porto di Poltu Quatu "},{name:"Poltu Quatu"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:3,yachtsWE:0,catamarans:0,motors:0,coords:"41.13657,9.49622",gulets:0,nome:"Poltu Quatu",guletsWE:0},{marine:[{name:"Nuovo Porto turistico di Santa Teresa di Gallura"}],sailsWE:8,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"41.23711,9.19468",gulets:0,nome:"Santa Teresa di Gallura",guletsWE:0},{marine:[{name:"Porto di Alghero"},{name:"Porto di Alghero"},{name:"Alghero"},{name:"Porto di Aghero"},{name:"Alghero"},{name:"Baratti"}],sailsWE:52,motorsWE:0,gommons:0,gommonsWE:0,sails:52,catamaransWE:6,yachts:0,yachtsWE:0,catamarans:6,motors:0,coords:"40.56339,8.31237",gulets:0,nome:"Alghero",guletsWE:0},{marine:[{name:"La Maddalena"},{name:"La Maddalena"},{name:"La Maddalena"}],sailsWE:1,motorsWE:0,gommons:0,gommonsWE:0,sails:3,catamaransWE:4,yachts:0,yachtsWE:0,catamarans:5,motors:0,coords:"41.21444,9.40759",gulets:0,nome:"La Maddalena",guletsWE:0},{marine:[{name:"Olbia"},{name:"Olbia"},{name:"Olbia"}],sailsWE:1,motorsWE:0,gommons:0,gommonsWE:0,sails:7,catamaransWE:0,yachts:2,yachtsWE:0,catamarans:2,motors:0,coords:"40.92237,9.51107",gulets:0,nome:"Olbia",guletsWE:0},{marine:[{name:"Cagliari"},{name:"Cagliari"},{name:"Cagliari"},{name:"Capo Rizzuto"},{name:"Cagliari"},{name:"Cagliari"}],sailsWE:44,motorsWE:0,gommons:0,gommonsWE:0,sails:52,catamaransWE:2,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"39.2149,9.1095",gulets:1,nome:"Cagliari",guletsWE:0},{marine:[{name:"Cormorano Marina"},{name:"Porto Torres"}],sailsWE:7,motorsWE:0,gommons:0,gommonsWE:0,sails:7,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.84169,8.39841",gulets:0,nome:"Porto Torres",guletsWE:0},{marine:[{name:"Stintino"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.9383,8.23049",gulets:0,nome:"Stintino",guletsWE:0},{marine:[{name:"Capitana"}],sailsWE:4,motorsWE:1,gommons:0,gommonsWE:0,sails:4,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:1,coords:"39.20621,9.30324",gulets:0,nome:"Capitana",guletsWE:0},{marine:[{name:"Porto Cervo"},{name:"Porto Cervo"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:3,catamaransWE:0,yachts:5,yachtsWE:0,catamarans:4,motors:3,coords:"41.13491,9.53048",gulets:1,nome:"Porto Cervo",guletsWE:0},{marine:[{name:"Porto Rotondo"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:0,motors:0,coords:"41.02942,9.54322",gulets:1,nome:"Porto Rotondo",guletsWE:0},{marine:[{name:"Porto Corallo"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"39.43946,9.64094",gulets:0,nome:"Villaputzu",guletsWE:0},{marine:[{name:"Porto Pollo"}],sailsWE:4,motorsWE:0,gommons:0,gommonsWE:0,sails:4,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.18736,9.32987",gulets:0,nome:"Porto Pollo",guletsWE:0},{marine:[{name:"Palau"}],sailsWE:4,motorsWE:0,gommons:0,gommonsWE:0,sails:4,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.18133,9.38877",gulets:0,nome:"Palau",guletsWE:0},{marine:[{name:"Porto Telatzu"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"38.9129,8.70758",gulets:0,nome:"Capo Teulada",guletsWE:0}],guletsWE:0},{sailsWE:171,stato:"Italia",motorsWE:2,gommonsWE:0,gommons:0,sails:245,catamaransWE:4,yachts:4,yachtsWE:4,catamarans:7,assets:{de:"NO ASSET FOUND",it:"Toscana e Elba",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:2,gulets:0,nome:"Toscana",basi:[{marine:[{name:"Etrusca Marina"},{name:"Scarlino"},{name:"Marina di Scarlino"},{name:"Marina di Scarlino"},{name:"Etrusca Marina"},{name:"Etrusca Marina"}],sailsWE:36,motorsWE:1,gommons:0,gommonsWE:0,sails:40,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:1,coords:"42.88527,10.78308",gulets:0,nome:"Scarlino",guletsWE:0},{marine:[{name:"Punta Ala Porto"},{name:"Punta Ala"},{name:"Punta Ala"},{name:"Punta Ala"},{name:"Punta Ala"},{name:"Punta Ala"},{name:"Punta Ala"}],sailsWE:38,motorsWE:0,gommons:0,gommonsWE:0,sails:48,catamaransWE:0,yachts:2,yachtsWE:2,catamarans:0,motors:0,coords:"42.80308,10.75383",gulets:0,nome:"Punta Ala",guletsWE:0},{marine:[{name:"Marina Cala Galera - Argentario"},{name:"Cala Galera"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.403,11.20261",gulets:0,nome:"Cala Galera",guletsWE:0},{marine:[{name:"Porto di Rio Marina"}],sailsWE:5,motorsWE:0,gommons:0,gommonsWE:0,sails:5,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.8154,10.42944",gulets:0,nome:"Rio Marina",guletsWE:0},{marine:[{name:"Marina Cala de Medici"},{name:"Marina Cala de Medici"},{name:"Castiglioncello"},{name:"Castiglioncello"},{name:"Castiglioncello"}],sailsWE:19,motorsWE:0,gommons:0,gommonsWE:0,sails:23,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.39383,10.42538",gulets:0,nome:"Castiglioncello",guletsWE:0},{marine:[{name:"Marina di Salivoli"},{name:"Marina di Salivoli"}],sailsWE:11,motorsWE:1,gommons:0,gommonsWE:0,sails:16,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:1,coords:"42.92585,10.52543",gulets:0,nome:"Piombino",guletsWE:0},{marine:[{name:"Viareggio"},{name:"Vieste"},{name:"Viareggio"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:23,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"43.86003,10.24107",gulets:0,nome:"Viareggio",guletsWE:0},{marine:[{name:"Portoferraio"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:17,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.81251,10.31562",gulets:0,nome:"Portoferraio",guletsWE:0},{marine:[{name:"Livorno"},{name:"Livorno"}],sailsWE:5,motorsWE:0,gommons:0,gommonsWE:0,sails:5,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.55,10.3",gulets:0,nome:"Livorno",guletsWE:0},{marine:[{name:"Salivoli"},{name:"Salivoli"},{name:"Salivoli"},{name:"Marina di Salivoli"}],sailsWE:24,motorsWE:0,gommons:0,gommonsWE:0,sails:24,catamaransWE:3,yachts:2,yachtsWE:2,catamarans:3,motors:0,coords:"42.93116,10.50717",gulets:0,nome:"Salivoli",guletsWE:0},{marine:[{name:"Rosignano"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.39338,10.42386",gulets:0,nome:"Rosignano",guletsWE:0},{marine:[{name:"Marina di Marciana"}],sailsWE:8,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.80765,10.19869",gulets:0,nome:"Marciana Marina",guletsWE:0},{marine:[{name:"Marina di San Vincenzo"},{name:"S. Vincenzo"},{name:"Marina di San Vincenzo"}],sailsWE:15,motorsWE:0,gommons:0,gommonsWE:0,sails:15,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.10058,10.53657",gulets:0,nome:"San Vincenzo",guletsWE:0},{marine:[{name:"Baratti"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.99242,10.50224",gulets:0,nome:"Baratti",guletsWE:0},{marine:[{name:"Porto Ercole"},{name:"Porto Ercole"}],sailsWE:3,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.39373,11.20975",gulets:0,nome:"Porto Ercole",guletsWE:0},{marine:[{name:"Talamone"}],sailsWE:7,motorsWE:0,gommons:0,gommonsWE:0,sails:7,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.55483,11.1355",gulets:0,nome:"Talamone",guletsWE:0}],guletsWE:0},{sailsWE:123,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:173,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:3,assets:{de:"Liguria",it:"Liguria",en:"Liguria",si:"NO ASSET FOUND"},motors:0,gulets:0,nome:"Liguria",basi:[{marine:[{name:"Marina degli Aregai"},{name:"Marina degli Aregai"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:3,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.36065,8.57518",gulets:0,nome:"Varazze",guletsWE:0},{marine:[{name:"Porto di Lavagna"},{name:"Lavagna"},{name:"Lavagna"},{name:"Lavagna"}],sailsWE:13,motorsWE:0,gommons:0,gommonsWE:0,sails:13,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.30891,9.3433",gulets:0,nome:"Lavagna",guletsWE:0},{marine:[{name:"Porto Venere"},{name:"Porto Venere"},{name:"Marina del Fezzano"},{name:"Portovenere"},{name:"Fezzano"},{name:"Porto Venere"}],sailsWE:27,motorsWE:0,gommons:0,gommonsWE:0,sails:27,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.05194,9.83531",gulets:0,nome:"Porto Venere",guletsWE:0},{marine:[{name:"Marina degli Aregai "},{name:"Marina degli Aregai"}],sailsWE:16,motorsWE:0,gommons:0,gommonsWE:0,sails:16,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.83796,7.91178",gulets:0,nome:"Santo Stefano al Mare",guletsWE:0},{marine:[{name:"Marina Porto Antico"},{name:"Genova"},{name:"Genova"},{name:"Genova"},{name:"Marina Genova Aeroporto"}],sailsWE:15,motorsWE:0,gommons:0,gommonsWE:0,sails:36,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:0,motors:0,coords:"44.41149,8.92598",gulets:0,nome:"Genova",guletsWE:0},{marine:[{name:"Portosole"},{name:"San Remo"}],sailsWE:6,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.81896,7.78909",gulets:0,nome:"Sanremo",guletsWE:0},{marine:[{name:"Porto di Capo S.Donato"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.16999,8.34516",gulets:0,nome:"Finale Ligure",guletsWE:0},{marine:[{name:"Ameglia"},{name:"Ameglia"},{name:"Ameglia"},{name:"Bocca di Magra"},{name:"Bocca di Magra"},{name:"Ameglia"},{name:"Bocca di Magra"}],sailsWE:26,motorsWE:0,gommons:0,gommonsWE:0,sails:50,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"44.06274,9.97053",gulets:0,nome:"Ameglia",guletsWE:0},{marine:[{name:"La Spezia"},{name:"La Spezia"},{name:"Fezzano"},{name:"La Spezia"},{name:"La Spezia"}],sailsWE:10,motorsWE:0,gommons:0,gommonsWE:0,sails:11,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"44.09773,9.85579",gulets:0,nome:"La Spezia",guletsWE:0},{marine:[{name:"Loano"}],sailsWE:4,motorsWE:0,gommons:0,gommonsWE:0,sails:4,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.13377,8.26739",gulets:0,nome:"Loano",guletsWE:0},{marine:[{name:"Marina di Andora"}],sailsWE:5,motorsWE:0,gommons:0,gommonsWE:0,sails:5,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"43.9506,8.15676",gulets:0,nome:"Andora",guletsWE:0},{marine:[{name:"Chiavari"}],sailsWE:1,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.31212,9.32082",gulets:0,nome:"Chiavari",guletsWE:0}],guletsWE:0},{sailsWE:69,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:78,catamaransWE:2,yachts:8,yachtsWE:0,catamarans:2,assets:{de:"NO ASSET FOUND",it:"Lazio",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:0,gulets:3,nome:"Lazio",basi:[{marine:[{name:"Porto turistico di Roma"},{name:"Roma"},{name:"Roma"},{name:"Riva di Traiano"},{name:"Porto di Roma"}],sailsWE:22,motorsWE:0,gommons:0,gommonsWE:0,sails:28,catamaransWE:0,yachts:8,yachtsWE:0,catamarans:0,motors:0,coords:"41.73741,12.25206",gulets:2,nome:"Roma",guletsWE:0},{marine:[{name:"Formia"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.25635,13.60591",gulets:1,nome:"Formia",guletsWE:0},{marine:[{name:"Gaeta"},{name:"Gaeta"}],sailsWE:2,motorsWE:0,gommons:0,gommonsWE:0,sails:2,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.21407,13.571",gulets:0,nome:"Gaeta",guletsWE:0},{marine:[{name:"Fiumicino"},{name:"Fiumicino"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.76996,12.22576",gulets:0,nome:"Fiumicino",guletsWE:0},{marine:[{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"},{name:"Nettuno"}],sailsWE:30,motorsWE:0,gommons:0,gommonsWE:0,sails:32,catamaransWE:2,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"41.45759,12.66108",gulets:0,nome:"Nettuno",guletsWE:0},{marine:[{name:"Marina del Circeo"},{name:"San Felice Circeo"}],sailsWE:7,motorsWE:0,gommons:0,gommonsWE:0,sails:7,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"41.23197,13.09897",gulets:0,nome:"San Felice Circeo",guletsWE:0},{marine:[{name:"Riva di Traiano"}],sailsWE:8,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.06806,11.8097",gulets:0,nome:"Civitavecchia",guletsWE:0}],guletsWE:0},{sailsWE:166,stato:"Italia",motorsWE:1,gommonsWE:0,gommons:1,sails:371,catamaransWE:39,yachts:49,yachtsWE:8,catamarans:88,assets:{de:"NO ASSET FOUND",it:"Sicilia e Eolie",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:7,gulets:20,nome:"Sicilia",basi:[{marine:[{name:"Porto Turistico di Marsala"},{name:"Marsala"},{name:"Marsala"},{name:"Marsala"},{name:"Marsala"},{name:"Marsala"},{name:"Marsala"},{name:"Marsala"}],sailsWE:32,motorsWE:0,gommons:0,gommonsWE:0,sails:52,catamaransWE:4,yachts:1,yachtsWE:1,catamarans:4,motors:0,coords:"37.79839,12.43761",gulets:0,nome:"Marsala",guletsWE:0},{marine:[{name:"MARINA VILLA IGEA"},{name:"Palermo"},{name:"Marina di Cala dei Normanni"},{name:"Marina Villa Igieia"},{name:"Palermo"},{name:"Marina di Villa Igiea"},{name:"Marina di Villa Igiea"},{name:"Palermo"},{name:"MARINA VILLA IGEA"},{name:"San Nicola"},{name:"Villa Igea "},{name:"Palermo"},{name:"Palermo"},{name:"Palermo"},{name:"Marina Villa Igea"},{name:"Palermo"},{name:"Palermo"}],sailsWE:34,motorsWE:1,gommons:1,gommonsWE:0,sails:108,catamaransWE:6,yachts:8,yachtsWE:2,catamarans:11,motors:4,coords:"38.11562,13.36138",gulets:3,nome:"Palermo",guletsWE:0},{marine:[{name:"Siracusa"},{name:"Marina del Porto Grande di Siracusa"},{name:"Siracusa"},{name:"Siracusa"}],sailsWE:1,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:5,motors:0,coords:"37.06648,15.28444",gulets:0,nome:"Siracusa",guletsWE:0},{marine:[{name:"Marina di Portorosa"},{name:"Marina di Portorosa"},{name:"Portorosa"},{name:"Marina di Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Marina di Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"Portorosa"},{name:"marina di Portorosa"},{name:"marina di Portorosa"}],sailsWE:60,motorsWE:0,gommons:0,gommonsWE:0,sails:122,catamaransWE:17,yachts:10,yachtsWE:4,catamarans:38,motors:1,coords:"38.12699,15.11095",gulets:0,nome:"Portorosa",guletsWE:0},{marine:[{name:"Porto di Catania"},{name:"Marina di Riposto"},{name:"Marina di Riposto"},{name:"Marina di Riposto"},{name:"Catania"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:13,yachtsWE:0,catamarans:2,motors:0,coords:"37.50281,15.08831",gulets:0,nome:"Catania",guletsWE:0},{marine:[{name:"Trapani"},{name:"Trapani"},{name:"Trapani"},{name:"Marina Arturo Stabile"},{name:"Trapani"}],sailsWE:8,motorsWE:0,gommons:0,gommonsWE:0,sails:26,catamaransWE:0,yachts:2,yachtsWE:0,catamarans:2,motors:0,coords:"38.0114,12.51376",gulets:0,nome:"Trapani",guletsWE:0},{marine:[{name:"Santa Agata di Militello"},{name:"Sant Agata"}],sailsWE:9,motorsWE:0,gommons:0,gommonsWE:0,sails:9,catamaransWE:2,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"38.06874,14.63462",gulets:0,nome:"Santa Agata di Militello",guletsWE:0},{marine:[{name:"Milazzo"},{name:"Milazzo"},{name:"Milazzo"},{name:"Milazzo"},{name:"Milazzo"},{name:"Milazzo Approdo Poseidon"},{name:"Milazzo"},{name:"Milazzo"}],sailsWE:14,motorsWE:0,gommons:0,gommonsWE:0,sails:22,catamaransWE:4,yachts:9,yachtsWE:1,catamarans:11,motors:0,coords:"38.2193,15.24048",gulets:5,nome:"Milazzo",guletsWE:0},{marine:[{name:"Lipari"},{name:"Lipari"},{name:"Lipari"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:9,catamaransWE:0,yachts:3,yachtsWE:0,catamarans:2,motors:1,coords:"38.46738,14.95402",gulets:10,nome:"Lipari",guletsWE:0},{marine:[{name:"Taormina"},{name:"Taormina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:2,motors:0,coords:"37.85307,15.28792",gulets:0,nome:"Taormina",guletsWE:0},{marine:[{name:"Porto dell Etna"},{name:"Riposto"},{name:"Riposto"}],sailsWE:6,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:3,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"37.72907,15.20931",gulets:0,nome:"Riposto",guletsWE:0},{marine:[{name:"Messina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:2,yachtsWE:0,catamarans:3,motors:1,coords:"38.19153,15.56111",gulets:2,nome:"Messina",guletsWE:0},{marine:[{name:"Salina"},{name:"Salina"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"38.55771,14.87283",gulets:0,nome:"Salina",guletsWE:0},{marine:[{name:"CefalÃ¹"},{name:"Cefalu"},{name:"Cefalu"}],sailsWE:2,motorsWE:0,gommons:0,gommonsWE:0,sails:4,catamaransWE:3,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"38.03902,14.03274",gulets:0,nome:"Cefalu",guletsWE:0}],guletsWE:0},{sailsWE:59,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:74,catamaransWE:9,yachts:0,yachtsWE:0,catamarans:10,assets:{de:"NO ASSET FOUND",it:"Calabria",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:0,gulets:0,nome:"Calabria",basi:[{marine:[{name:"Vibo Valentia"},{name:"Vibo Valentia"},{name:"Vibo Valentia"},{name:"Vibo Valentia"},{name:"Vibo Valentia"},{name:"Tropea"}],sailsWE:34,motorsWE:0,gommons:0,gommonsWE:0,sails:37,catamaransWE:5,yachts:0,yachtsWE:0,catamarans:6,motors:0,coords:"38.71577,16.12384",gulets:0,nome:"Vibo Valentia",guletsWE:0},{marine:[{name:"Marina Reggio Calabria"},{name:"Reggio Calabria"},{name:"Reggio Calabria"}],sailsWE:12,motorsWE:0,gommons:0,gommonsWE:0,sails:13,catamaransWE:3,yachts:0,yachtsWE:0,catamarans:3,motors:0,coords:"38.12436,15.65052",gulets:0,nome:"Reggio Calabria",guletsWE:0},{marine:[{name:"Tropea"},{name:"Tropea"},{name:"Tropea"},{name:"Tropea"}],sailsWE:13,motorsWE:0,gommons:0,gommonsWE:0,sails:24,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"38.68062,15.90361",gulets:0,nome:"Tropea",guletsWE:0},{marine:[{name:"Capo Rizzuto"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"38.90519,17.10354",gulets:0,nome:"Capo Rizzuto",guletsWE:0}],guletsWE:0},{sailsWE:8,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:14,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,assets:{de:"NO ASSET FOUND",it:"Emilia Romagna",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:0,gulets:0,nome:"Emilia Romagna",basi:[{marine:[{name:"Marina di Rimini"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:3,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.07663,12.57218",gulets:0,nome:"Rimini",guletsWE:0},{marine:[{name:"Cervia"},{name:"CefalÃ¹"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:3,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:1,motors:0,coords:"44.26008,12.35139",gulets:0,nome:"Cervia",guletsWE:0},{marine:[{name:"Porto Turistico Marina degli Estensi"}],sailsWE:8,motorsWE:0,gommons:0,gommonsWE:0,sails:8,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"44.66875,12.25227",gulets:0,nome:"Lido degli Estensi",guletsWE:0}],guletsWE:0},{sailsWE:6,stato:"Italia",motorsWE:1,gommonsWE:0,gommons:0,sails:11,catamaransWE:2,yachts:1,yachtsWE:1,catamarans:2,assets:{de:"NO ASSET FOUND",it:"Puglia",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:4,gulets:0,nome:"Puglia",basi:[{marine:[{name:"Brindisi"},{name:"Marina di Brindisi"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:5,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.64231,17.9357",gulets:0,nome:"Brindisi",guletsWE:0},{marine:[{name:"Gallipoli"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:3,coords:"40.05625,17.97884",gulets:0,nome:"Gallipoli",guletsWE:0},{marine:[{name:"Vieste"},{name:"Vieste"},{name:"Vieste"}],sailsWE:6,motorsWE:1,gommons:0,gommonsWE:0,sails:6,catamaransWE:2,yachts:1,yachtsWE:1,catamarans:2,motors:1,coords:"41.88633,16.18479",gulets:0,nome:"Vieste",guletsWE:0},{marine:[{name:"Taranto"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.43427,17.18795",gulets:0,nome:"Taranto",guletsWE:0}],guletsWE:0},{sailsWE:147,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:192,catamaransWE:10,yachts:1,yachtsWE:0,catamarans:16,assets:{de:"NO ASSET FOUND",it:"Campania",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:1,gulets:1,nome:"Campania",basi:[{marine:[{name:"Napoli"},{name:"Napoli"},{name:"Darsena Acton"},{name:"Napoli"},{name:"Darsena Acton"},{name:"Napoli"},{name:"Napoli"},{name:"Darsena Acton"},{name:"Napoli"},{name:"Napoli"},{name:"Napoli"},{name:"Napoli"},{name:"Pozzuoli"},{name:"Novigrad"},{name:"Napoli"}],sailsWE:77,motorsWE:0,gommons:0,gommonsWE:0,sails:93,catamaransWE:3,yachts:1,yachtsWE:0,catamarans:6,motors:0,coords:"40.84,14.25287",gulets:0,nome:"Napoli",guletsWE:0},{marine:[{name:"Procida"},{name:"Marina di Chiaiolella"},{name:"Procida"},{name:"Procida"},{name:"Procida"},{name:"Procida"},{name:"Procida"},{name:"Procida"},{name:"Marina di Procida"}],sailsWE:39,motorsWE:0,gommons:0,gommonsWE:0,sails:53,catamaransWE:6,yachts:0,yachtsWE:0,catamarans:6,motors:0,coords:"40.76175,14.02341",gulets:0,nome:"Procida",guletsWE:0},{marine:[{name:"Salerno"},{name:"Salerno"},{name:"Salerno"},{name:"Salerno"},{name:"Salerno"}],sailsWE:25,motorsWE:0,gommons:0,gommonsWE:0,sails:32,catamaransWE:1,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"40.67796,14.76591",gulets:1,nome:"Salerno",guletsWE:0},{marine:[{name:"Sorrento"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.62632,14.37574",gulets:0,nome:"Sorrento",guletsWE:0},{marine:[{name:"Amalfi"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.63294,14.60249",gulets:0,nome:"Amalfi",guletsWE:0},{marine:[{name:"Castellammare di Stabia"},{name:"Castellammare di Stabia"},{name:"Castellamare"}],sailsWE:4,motorsWE:0,gommons:0,gommonsWE:0,sails:4,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:1,coords:"40.69376,14.47386",gulets:0,nome:"Castellammare di Stabia",guletsWE:0},{marine:[{name:"Ventotene"}],sailsWE:2,motorsWE:0,gommons:0,gommonsWE:0,sails:2,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"40.80304,13.43253",gulets:0,nome:"Ventotene",guletsWE:0},{marine:[{name:"Ischia"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:7,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:2,motors:0,coords:"40.74013,13.96016",gulets:0,nome:"Ischia",guletsWE:0}],guletsWE:0},{sailsWE:12,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:22,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,assets:{de:"NO ASSET FOUND",it:"Veneto",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:0,gulets:0,nome:"Veneto",basi:[{marine:[{name:"Chioggia"},{name:"Marina di Chioggia"}],sailsWE:5,motorsWE:0,gommons:0,gommonsWE:0,sails:10,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.22593,12.28046",gulets:0,nome:"Chioggia",guletsWE:0},{marine:[{name:"Caorle"},{name:"Caorle"}],sailsWE:6,motorsWE:0,gommons:0,gommonsWE:0,sails:11,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.59485,12.8708",gulets:0,nome:"Caorle",guletsWE:0},{marine:[{name:"Venezia"},{name:"Venezia"}],sailsWE:1,motorsWE:0,gommons:0,gommonsWE:0,sails:1,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.42362,12.35187",gulets:0,nome:"Venezia",guletsWE:0}],guletsWE:0},{sailsWE:6,stato:"Italia",motorsWE:0,gommonsWE:0,gommons:0,sails:15,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,assets:{de:"NO ASSET FOUND",it:"Friuli",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:0,gulets:0,nome:"Friuli",basi:[{marine:[{name:"Porto di San Rocco"},{name:"Porto San Rocco"}],sailsWE:6,motorsWE:0,gommons:0,gommonsWE:0,sails:13,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.68016,13.70192",gulets:0,nome:"Golfo di Trieste",guletsWE:0},{marine:[{name:"Grado"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:2,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"45.6743,13.39289",gulets:0,nome:"Grado",guletsWE:0}],guletsWE:0},{sailsWE:16,stato:"Italia",motorsWE:1,gommonsWE:0,gommons:0,sails:19,catamaransWE:0,yachts:11,yachtsWE:7,catamarans:0,assets:{de:"NO ASSET FOUND",it:"Abruzzo",en:"NO ASSET FOUND",si:"NO ASSET FOUND"},motors:1,gulets:0,nome:"Abruzzo",basi:[{marine:[{name:"Marina di Pescara"},{name:"Pescara"},{name:"Pescara"},{name:"Marina di Pescara"}],sailsWE:16,motorsWE:1,gommons:0,gommonsWE:0,sails:19,catamaransWE:0,yachts:11,yachtsWE:7,catamarans:0,motors:1,coords:"42.46483,14.21409",gulets:0,nome:"Pescara",guletsWE:0}],guletsWE:0},{sailsWE:0,stato:"Montenegro",motorsWE:0,gommonsWE:0,gommons:0,sails:18,catamaransWE:0,yachts:6,yachtsWE:0,catamarans:2,assets:{de:"Montenegro",it:"Montenegro",en:"Montenegro",si:"NO ASSET FOUND"},motors:0,coords:"",gulets:0,nome:"Montenegro",basi:[{marine:[{name:"Stadtmarina Kotor"},{name:"Stadtmarina Kotor"},{name:"Kotor"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:12,catamaransWE:0,yachts:4,yachtsWE:0,catamarans:2,motors:0,coords:"42.43293,18.77",gulets:0,nome:"Kotor",guletsWE:0},{marine:[{name:"Budva"},{name:"Budva"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:2,yachtsWE:0,catamarans:0,motors:0,coords:"42.27993,18.83948",gulets:0,nome:"Budva",guletsWE:0},{marine:[{name:"Bar"},{name:"Bar"},{name:"Bar"},{name:"Bar"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:6,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.09828,19.08644",gulets:0,nome:"Bar",guletsWE:0},{marine:[{name:"Tivat"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:0,catamaransWE:0,yachts:0,yachtsWE:0,catamarans:0,motors:0,coords:"42.42624,18.70018",gulets:0,nome:"Tivat",guletsWE:0}],guletsWE:0},{sailsWE:15,stato:"Slovenia",motorsWE:0,gommonsWE:0,gommons:0,sails:51,catamaransWE:1,yachts:3,yachtsWE:0,catamarans:1,assets:{de:"Slowenien",it:"Slovenia",en:"Slovenia",si:"NO ASSET FOUND"},motors:2,coords:"",gulets:0,nome:"Slovenia",basi:[{marine:[{name:"Marina Portoroz"},{name:"Portoroz"}],sailsWE:0,motorsWE:0,gommons:0,gommonsWE:0,sails:36,catamaransWE:0,yachts:1,yachtsWE:0,catamarans:0,motors:0,coords:"45.51428,13.59089",gulets:0,nome:"Portoroz",guletsWE:0},{marine:[{name:"Marina Isola"},{name:"Marina di Izola"},{name:"Marina Izola"},{name:"Izola"}],sailsWE:15,motorsWE:0,gommons:0,gommonsWE:0,sails:15,catamaransWE:1,yachts:2,yachtsWE:0,catamarans:1,motors:2,coords:"45.53561,13.65123",gulets:0,nome:"Izola",guletsWE:0}],guletsWE:0}]

STATE_ASSETS=new Array();
STATE_ASSETS["Croazia"]={it:"Croazia",en:"Croatia",de:"Kroatien",si:"NO ASSET FOUND"};
STATE_ASSETS["Montenegro"]={it:"Montenegro",en:"Montenegro",de:"Montenegro",si:"NO ASSET FOUND"};
STATE_ASSETS["Slovenia"]={it:"Slovenia",en:"Slovenia",de:"Slowenien",si:"NO ASSET FOUND"};
STATE_ASSETS["Italia"]={it:"Italia",en:"Italy",de:"Italien",si:"NO ASSET FOUND"};
STATE_ASSETS["Grecia"]={it:"Grecia",en:"Greece",de:"Griechenland",si:"NO ASSET FOUND"};
STATE_ASSETS["ALL_LABEL"]={value:"Tutta ", it:"Tutta ",en:"Whole ",de:"Ganz ",si:"NO ASSET FOUND"};

STATI=new Array();
var ALLREGVALUE="Tutte le Regioni";
STATI[ALLREGVALUE]={regioni:REGIONI,stato:ALLREGVALUE,assets:{it:"Tutte le regioni",en:"All regions",de:"Alle Regionen",si:"NO ASSET FOUND"}};
REGIONI.mEach(function(region){
	if(!STATI[region.stato]){
		var regioniArray = new Array();
		STATI[region.stato]={regioni:regioniArray,stato:region.stato,assets:{it:STATE_ASSETS[region.stato].it,en:STATE_ASSETS[region.stato].en,de:STATE_ASSETS[region.stato].de,si:STATE_ASSETS[region.stato].si}}
	}
	STATI[region.stato].regioni[STATI[region.stato].regioni.length]=region;
});
TIPI=[{label_si:"NO ASSET FOUND",label_en:"Sailing boat",tipo:"Barca a vela",label_it:"Barca a vela",label_de:"Segelboot"},{label_si:"NO ASSET FOUND",label_en:"Motorboat",tipo:"Motoscafo",label_it:"Motoscafo",label_de:"Motorboat"},{label_si:"NO ASSET FOUND",label_en:"Yacht",tipo:"Yacht",label_it:"Yacht",label_de:"Yacht"},{label_si:"NO ASSET FOUND",label_en:"Catamaran",tipo:"Catamarano",label_it:"Catamarano",label_de:"Katamaran"},{label_si:"NO ASSET FOUND",label_en:"Gulet",tipo:"Gulet",label_it:"Caicco",label_de:"Gulet"},{label_si:"NO ASSET FOUND",label_en:"Dinghy",tipo:"Gommone",label_it:"Gommone",label_de:"Schlauchboot"}]

MPRENOTAFIELDS = {
	alertnocampicompleto:  "Wenn Sie nicht richtig alle Felder verfaßt haben, korrigieren Sie, bitte, die Fehler in rot.",
	alertnoweekselect:     "Sie müssen mindestens eine Woche auswählen!",
	noskipper:             "F&uuml;r dieses Boot ist kein Skipper verf&uuml;gbar",
	skipperprezzouno:      "F&uuml;r dieses Boot ist ein Skipper verf&uuml;gbar mit einem Kostenaufwand von ",
	skipperprezzodue:      " pro Woche",
	skipperdescrizione:    "Der Skipper wird die Person mit der Rolle sein, das Boot und seine Besatzung sicher durch Meer zu f&uuml;hren. Seine Bek&ouml;stigung geht zu Ihren Lasten.",
	nohostess:             "F&uuml;r dieses Boot gibt es keine Hostess",
	hostessprezzouno:      "F&uuml;r dieses Boot ist eine Hostess verf&uuml;gbar zu einem Preis von ",
	hostessprezzodue:      " pro Woche",
	hostessdescrizione:    "Der Skipper wird die Person mit der Rolle sein, das Boot und seine Besatzung sicher durch Meer zu f&uuml;hren. Seine Bek&ouml;stigung geht zu Ihren Lasten.",
	dal:                   "vom",
	al:                    "bis"
}

ADVANCE_RATE = 0.5

﻿var loadedAll=false;
function initializeAll(loadEvent){
	if(loadEvent){
        mPersistence.getBuilders();
        $('preloadedStuff').getElements('img').each(function(safeimg){
    	    safeimg.src=safeimg.getAttribute("safe_src");
        })
	}
	
	if(loadedAll)
		return;
	mEffects.init();
	mPersistence.init();
	mPersistence.getLastMinutes();
	
	dhtmlHistory.initialize();
	dhtmlHistory.addListener(historyListener);
	var initialLocation = dhtmlHistory.getCurrentLocation();
	if(initialLocation!=null){
		initialLocation=unescape(initialLocation);
		initialLocation=initialLocation.substring(2,initialLocation.length);
		var f=initialLocation.substring(0,initialLocation.indexOf(','));
		initialLocation=initialLocation.substring(f.length+3);
		var i=initialLocation.replace(/[$]+/g, "&");
		i=i.replace(/\^/g, "%20");
		if(f=="searchBoatsH"){
			historyIFunctions.searchBoatsH(i);
		}
		if(f=="showBarcaH"){
			historyIFunctions.showBarcaH(i);
		}
	}
	loadedAll=true;
}
