
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - AJS.js - */
// http://turismo.provincia.teramo.it/portal_javascripts/AJS.js?original=1
var GB_ROOT_DIR="http://turismo.provincia.teramo.it/";AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,getScrollTop:function(){var t;if(document.documentElement&&document.documentElement.scrollTop){t=document.documentElement.scrollTop}else{if(document.body){t=document.body.scrollTop}}
return t},addClass:function(){var _2=AJS.forceArray(arguments);var _3=_2.pop();var _4=function(o){if(!new RegExp("(^|\\s)"+_3+"(\\s|$)").test(o.className)){o.className+=(o.className?" ":"")+_3}};AJS.map(_2,function(_6){_4(_6)})},setStyle:function(){var _7=AJS.forceArray(arguments);var _8=_7.pop();var _9=_7.pop();AJS.map(_7,function(_a){_a.style[_9]=AJS.getCssDim(_8)})},extend:function(_b){var _c=new this("no_init");for(k in _b){var _d=_c[k];var _e=_b[k];if(_d&&_d!=_e&&typeof _e=="function"){_e=this._parentize(_e,_d)}
_c[k]=_e}
return new AJS.Class(_c)},log:function(o){if(window.console){console.log(o)}else{var div=AJS.$("ajs_logger");if(!div){div=AJS.DIV({id:"ajs_logger","style":"color: green; position: absolute; left: 0"});div.style.top=AJS.getScrollTop()+"px";AJS.ACN(AJS.getBody(),div)}
AJS.setHTML(div,""+o)}},_getRealScope:function(fn,_12){_12=AJS.$A(_12);var _13=fn._cscope||window;return function(){var _14=AJS.$FA(arguments).concat(_12);return fn.apply(_13,_14)}},documentInsert:function(elm){if(typeof(elm)=="string"){elm=AJS.HTML2DOM(elm)}
document.write("<span id=\"dummy_holder\"></span>");AJS.swapDOM(AJS.$("dummy_holder"),elm)},getWindowSize:function(doc){doc=doc||document;var _17,_18;if(self.innerHeight){_17=self.innerWidth;_18=self.innerHeight}else{if(doc.documentElement&&doc.documentElement.clientHeight){_17=doc.documentElement.clientWidth;_18=doc.documentElement.clientHeight}else{if(doc.body){_17=doc.body.clientWidth;_18=doc.body.clientHeight}}}
return{"w":_17,"h":_18}},flattenList:function(_19){var r=[];var _1b=function(r,l){AJS.map(l,function(o){if(o==null){}else{if(AJS.isArray(o)){_1b(r,o)}else{r.push(o)}}})};_1b(r,_19);return r},isFunction:function(obj){return(typeof obj=="function")},setEventKey:function(e){e.key=e.keyCode?e.keyCode:e.charCode;if(window.event){e.ctrl=window.event.ctrlKey;e.shift=window.event.shiftKey}else{e.ctrl=e.ctrlKey;e.shift=e.shiftKey}
switch(e.key){case 63232:e.key=38;break;case 63233:e.key=40;break;case 63235:e.key=39;break;case 63234:e.key=37;break}},removeElement:function(){var _21=AJS.forceArray(arguments);AJS.map(_21,function(elm){AJS.swapDOM(elm,null)})},_unloadListeners:function(){if(AJS.listeners){AJS.map(AJS.listeners,function(elm,_24,fn){AJS.REV(elm,_24,fn)})}
AJS.listeners=[]},join:function(_26,_27){try{return _27.join(_26)}
catch(e){var r=_27[0]||"";AJS.map(_27,function(elm){r+=_26+elm},1);return r+""}},getIndex:function(elm,_2b,_2c){for(var i=0;i<_2b.length;i++){if(_2c&&_2c(_2b[i])||elm==_2b[i]){return i}}
return-1},isIn:function(elm,_2f){var i=AJS.getIndex(elm,_2f);if(i!=-1){return true}else{return false}},isArray:function(obj){return obj instanceof Array},setLeft:function(){var _32=AJS.forceArray(arguments);_32.splice(_32.length-1,0,"left");AJS.setStyle.apply(null,_32)},appendChildNodes:function(elm){if(arguments.length>=2){AJS.map(arguments,function(n){if(AJS.isString(n)){n=AJS.TN(n)}
if(AJS.isDefined(n)){elm.appendChild(n)}},1)}
return elm},getElementsByTagAndClassName:function(_35,_36,_37,_38){var _39=[];if(!AJS.isDefined(_37)){_37=document}
if(!AJS.isDefined(_35)){_35="*"}
var els=_37.getElementsByTagName(_35);var _3b=els.length;var _3c=new RegExp("(^|\\s)"+_36+"(\\s|$)");for(i=0,j=0;i<_3b;i++){if(_3c.test(els[i].className)||_36==null){_39[j]=els[i];j++}}
if(_38){return _39[0]}else{return _39}},isOpera:function(){return(navigator.userAgent.toLowerCase().indexOf("opera")!=-1)},isString:function(obj){return(typeof obj=="string")},absolutePosition:function(elm){var _3f={"x":elm.offsetLeft,"y":elm.offsetTop};if(elm.offsetParent){var _40=elm.offsetParent;while(_40){_3f.x+=_40.offsetLeft;_3f.y+=_40.offsetTop;_40=_40.offsetParent}}
if(AJS.isSafari()&&elm.style.position=="absolute"){_3f.x-=document.body.offsetLeft;_3f.y-=document.body.offsetTop}
return _3f},hideElement:function(elm){var _42=AJS.forceArray(arguments);AJS.map(_42,function(elm){elm.style.display="none"})},setOpacity:function(elm,p){elm.style.opacity=p;elm.style.filter="alpha(opacity="+p*100+")"},setHeight:function(){var _46=AJS.forceArray(arguments);_46.splice(_46.length-1,0,"height");AJS.setStyle.apply(null,_46)},setWidth:function(){var _47=AJS.forceArray(arguments);_47.splice(_47.length-1,0,"width");AJS.setStyle.apply(null,_47)},createArray:function(v){if(AJS.isArray(v)&&!AJS.isString(v)){return v}else{if(!v){return []}else{return [v]}}},isDict:function(o){var _4a=String(o);return _4a.indexOf(" Object")!=-1},isMozilla:function(){return(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210)},removeEventListener:function(elm,_4c,fn,_4e){var _4f="ajsl_"+_4c+fn;if(!_4e){_4e=false}
fn=elm[_4f]||fn;if(elm["on"+_4c]==fn){elm["on"+_4c]=elm[_4f+"old"]}
if(elm.removeEventListener){elm.removeEventListener(_4c,fn,_4e);if(AJS.isOpera()){elm.removeEventListener(_4c,fn,!_4e)}}else{if(elm.detachEvent){elm.detachEvent("on"+_4c,fn)}}},callLater:function(fn,_51){var _52=function(){fn()};window.setTimeout(_52,_51)},isSafari:function(){return(navigator.userAgent.toLowerCase().indexOf("khtml")!=-1)},setTop:function(){var _53=AJS.forceArray(arguments);_53.splice(_53.length-1,0,"top");AJS.setStyle.apply(null,_53)},_createDomShortcuts:function(){var _54=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","h4","h5","h6","br","textarea","form","p","select","option","optgroup","iframe","script","center","dl","dt","dd","small","pre","i"];var _55=function(elm){AJS[elm.toUpperCase()]=function(){return AJS.createDOM.apply(null,[elm,arguments])}};AJS.map(_54,_55);AJS.TN=function(_57){return document.createTextNode(_57)}},addCallback:function(fn){this.callbacks.unshift(fn)},bindMethods:function(_59){for(var k in _59){var _5b=_59[k];if(typeof(_5b)=="function"){_59[k]=AJS.$b(_5b,_59)}}},partial:function(fn){var _5d=AJS.$FA(arguments);_5d.shift();return function(){_5d=_5d.concat(AJS.$FA(arguments));return fn.apply(window,_5d)}},isNumber:function(obj){return(typeof obj=="number")},insertBefore:function(elm,_60){_60.parentNode.insertBefore(elm,_60);return elm},getCssDim:function(dim){if(AJS.isString(dim)){return dim}else{return dim+"px"}},isIe:function(){return(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)},removeClass:function(){var _62=AJS.forceArray(arguments);var cls=_62.pop();var _64=function(o){o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"")};AJS.map(_62,function(elm){_64(elm)})},setHTML:function(elm,_68){elm.innerHTML=_68;return elm},map:function(_69,fn,_6b,_6c){var i=0,l=_69.length;if(_6b){i=_6b}
if(_6c){l=_6c}
for(i;i<l;i++){var val=fn(_69[i],i);if(val!=undefined){return val}}},insertAfter:function(elm,_71){_71.parentNode.insertBefore(elm,_71.nextSibling);return elm},addEventListener:function(elm,_73,fn,_75,_76){var _77="ajsl_"+_73+fn;if(!_76){_76=false}
AJS.listeners=AJS.$A(AJS.listeners);if(AJS.isIn(_73,["keypress","keydown","keyup","click"])){var _78=fn;fn=function(e){AJS.setEventKey(e);return _78.apply(window,arguments)}}
var _7a=AJS.isIn(_73,["submit","load","scroll","resize"]);var _7b=AJS.$A(elm);AJS.map(_7b,function(_7c){if(_75){var _7d=fn;fn=function(e){AJS.REV(_7c,_73,fn);return _7d.apply(window,arguments)}}
if(_7a){var _7f=_7c["on"+_73];var _80=function(){if(_7f){fn(arguments);return _7f(arguments)}else{return fn(arguments)}};_7c[_77]=_80;_7c[_77+"old"]=_7f;elm["on"+_73]=_80}else{_7c[_77]=fn;if(_7c.attachEvent){_7c.attachEvent("on"+_73,fn)}else{if(_7c.addEventListener){_7c.addEventListener(_73,fn,_76)}}
AJS.listeners.push([_7c,_73,fn])}})},preloadImages:function(){AJS.AEV(window,"load",AJS.$p(function(_81){AJS.map(_81,function(src){var pic=new Image();pic.src=src})},arguments))},forceArray:function(_84){var r=[];AJS.map(_84,function(elm){r.push(elm)});return r},update:function(l1,l2){for(var i in l2){l1[i]=l2[i]}
return l1},getBody:function(){return AJS.$bytc("body")[0]},HTML2DOM:function(_8a,_8b){var d=AJS.DIV();d.innerHTML=_8a;if(_8b){return d.childNodes[0]}else{return d}},getElement:function(id){if(AJS.isString(id)||AJS.isNumber(id)){return document.getElementById(id)}else{return id}},showElement:function(){var _8e=AJS.forceArray(arguments);AJS.map(_8e,function(elm){elm.style.display=""})},bind:function(fn,_91,_92){fn._cscope=_91;return AJS._getRealScope(fn,_92)},createDOM:function(_93,_94){var i=0,_96;var elm=document.createElement(_93);var _98=_94[0];if(AJS.isDict(_94[i])){for(k in _98){_96=_98[k];if(k=="style"||k=="s"){elm.style.cssText=_96}else{if(k=="c"||k=="class"||k=="className"){elm.className=_96}else{elm.setAttribute(k,_96)}}}
i++}
if(_98==null){i=1}
for(var j=i;j<_94.length;j++){var _96=_94[j];if(_96){var _9a=typeof(_96);if(_9a=="string"||_9a=="number"){_96=AJS.TN(_96)}
elm.appendChild(_96)}}
return elm},swapDOM:function(_9b,src){_9b=AJS.getElement(_9b);var _9d=_9b.parentNode;if(src){src=AJS.getElement(src);_9d.replaceChild(src,_9b)}else{_9d.removeChild(_9b)}
return src},isDefined:function(o){return(o!="undefined"&&o!=null)}};AJS.$=AJS.getElement;AJS.$$=AJS.getElements;AJS.$f=AJS.getFormElement;AJS.$p=AJS.partial;AJS.$b=AJS.bind;AJS.$A=AJS.createArray;AJS.DI=AJS.documentInsert;AJS.ACN=AJS.appendChildNodes;AJS.RCN=AJS.replaceChildNodes;AJS.AEV=AJS.addEventListener;AJS.REV=AJS.removeEventListener;AJS.$bytc=AJS.getElementsByTagAndClassName;AJS.$AP=AJS.absolutePosition;AJS.$FA=AJS.forceArray;AJS.addEventListener(window,"unload",AJS._unloadListeners);AJS._createDomShortcuts();AJS.Class=function(_9f){var fn=function(){if(arguments[0]!="no_init"){return this.init.apply(this,arguments)}};fn.prototype=_9f;AJS.update(fn,AJS.Class.prototype);return fn};AJS.Class.prototype={extend:function(_a1){var _a2=new this("no_init");for(k in _a1){var _a3=_a2[k];var cur=_a1[k];if(_a3&&_a3!=cur&&typeof cur=="function"){cur=this._parentize(cur,_a3)}
_a2[k]=cur}
return new AJS.Class(_a2)},implement:function(_a5){AJS.update(this.prototype,_a5)},_parentize:function(cur,_a7){return function(){this.parent=_a7;return cur.apply(this,arguments)}}};script_loaded=true;script_loaded=true;

/* - AJS_fx.js - */
// http://turismo.provincia.teramo.it/portal_javascripts/AJS_fx.js?original=1
AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){var _3=new AJS.fx.Base();_3.elm=AJS.$(_1);_3.options.duration=600;_3.setOptions(_2);AJS.update(_3,{increase:function(){if(this.now==7){_1.style.backgroundColor="#fff"}else{_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)]}}});return _3.custom(6,0)},fadeIn:function(_4,_5){_5=_5||{};if(!_5.from){_5.from=0;AJS.setOpacity(_4,0)}
if(!_5.to){_5.to=1}
var s=new AJS.fx.Style(_4,"opacity",_5);return s.custom(_5.from,_5.to)},fadeOut:function(_7,_8){_8=_8||{};if(!_8.from){_8.from=1}
if(!_8.to){_8.to=0}
_8.duration=300;var s=new AJS.fx.Style(_7,"opacity",_8);return s.custom(_8.from,_8.to)},setWidth:function(_a,_b){var s=new AJS.fx.Style(_a,"width",_b);return s.custom(_b.from,_b.to)},setHeight:function(_d,_e){var s=new AJS.fx.Style(_d,"height",_e);return s.custom(_e.from,_e.to)}};AJS.fx.Base=new AJS.Class({init:function(_10){this.options={onStart:function(){},onComplete:function(){},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};AJS.update(this.options,_10);AJS.bindMethods(this)},setOptions:function(_11){AJS.update(this.options,_11)},step:function(){var _12=new Date().getTime();if(_12<this.time+this.options.duration){this.cTime=_12-this.time;this.setNow()}else{setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);this.clearTimer();this.now=this.to}
this.increase()},setNow:function(){this.now=this.compute(this.from,this.to)},compute:function(_13,to){var _15=to-_13;return this.options.transition(this.cTime,_13,_15,this.options.duration)},clearTimer:function(){clearInterval(this.timer);this.timer=null;return this},_start:function(_16,to){if(!this.options.wait){this.clearTimer()}
if(this.timer){return}
setTimeout(AJS.$p(this.options.onStart,this.elm),10);this.from=_16;this.to=to;this.time=new Date().getTime();this.timer=setInterval(this.step,Math.round(1000/this.options.fps));return this},custom:function(_18,to){return this._start(_18,to)},set:function(to){this.now=to;this.increase();return this},setStyle:function(elm,_1c,val){if(this.property=="opacity"){AJS.setOpacity(elm,val)}else{AJS.setStyle(elm,_1c,val)}}});AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){this.parent();this.elm=elm;this.setOptions(_20);this.property=_1f},increase:function(){this.setStyle(this.elm,this.property,this.now)}});AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){this.parent();this.elm=AJS.$(elm);this.setOptions(_22);this.now={}},setNow:function(){for(p in this.from){this.now[p]=this.compute(this.from[p],this.to[p])}},custom:function(obj){if(this.timer&&this.options.wait){return}
var _24={};var to={};for(p in obj){_24[p]=obj[p][0];to[p]=obj[p][1]}
return this._start(_24,to)},increase:function(){for(var p in this.now){this.setStyle(this.elm,p,this.now[p])}}});AJS.fx.Transitions={linear:function(t,b,c,d){return c*t/d+b},sineInOut:function(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b}};script_loaded=true;script_loaded=true;

/* - gb_scripts.js - */
var GB_CURRENT=null;
GB_hide=function(cb){
GB_CURRENT.hide(cb);
};
GreyBox=new AJS.Class({init:function(_2){
this.use_fx=AJS.fx;
this.type="page";
this.overlay_click_close=false;
this.salt=0;
this.root_dir=GB_ROOT_DIR;
this.callback_fns=[];
this.reload_on_close=false;
this.src_loader=this.root_dir+"loader_frame.html";
var _3=window.location.hostname.indexOf("www");
var _4=this.src_loader.indexOf("www");
if(_3!=-1&&_4==-1){
this.src_loader=this.src_loader.replace("://","://www.");
}
if(_3==-1&&_4!=-1){
this.src_loader=this.src_loader.replace("://www.","://");
}
this.show_loading=true;
AJS.update(this,_2);
},addCallback:function(fn){
if(fn){
this.callback_fns.push(fn);
}
},show:function(_6){
GB_CURRENT=this;
this.url=_6;
var _7=[AJS.$bytc("embed"),AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_7),function(_8){
_8.style.visibility="hidden";
});
this.createElements();
return false;
},hide:function(cb){
var me=this;
AJS.callLater(function(){
var _b=me.callback_fns;
if(_b!=[]){
AJS.map(_b,function(fn){
fn();
});
}
me.onHide();
if(me.use_fx){
var _d=me.overlay;
AJS.fx.fadeOut(me.overlay,{onComplete:function(){
AJS.removeElement(_d);
_d=null;
},duration:300});
AJS.removeElement(me.g_window);
}else{
AJS.removeElement(me.g_window,me.overlay);
}
me.removeFrame();
AJS.REV(window,"scroll",_GB_setOverlayDimension);
AJS.REV(window,"resize",_GB_update);
var _e=[AJS.$bytc("embed"),AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_e),function(_f){
_f.style.visibility="visible";
});
GB_CURRENT=null;
if(me.reload_on_close){
window.location.reload();
}
if(AJS.isFunction(cb)){
cb();
}
},10);
},update:function(){
this.setOverlayDimension();
this.setFrameSize();
this.setWindowPosition();
},createElements:function(){
this.initOverlay();
this.g_window=AJS.DIV({"id":"GB_window"});
AJS.hideElement(this.g_window);
AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);
this.initFrame();
this.initHook();
this.update();
var me=this;
if(this.use_fx){
AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){
me.onShow();
AJS.showElement(me.g_window);
me.startLoading();
}});
}else{
AJS.setOpacity(this.overlay,0.7);
AJS.showElement(this.g_window);
this.onShow();
this.startLoading();
}
AJS.AEV(window,"scroll",_GB_setOverlayDimension);
AJS.AEV(window,"resize",_GB_update);
},removeFrame:function(){
try{
AJS.removeElement(this.iframe);
}
catch(e){
}
this.iframe=null;
},startLoading:function(){
this.iframe.src=this.src_loader+"?s="+this.salt++;
AJS.showElement(this.iframe);
},setOverlayDimension:function(){
var _11=AJS.getWindowSize();
if(AJS.isMozilla()||AJS.isOpera()){
AJS.setWidth(this.overlay,"100%");
}else{
AJS.setWidth(this.overlay,_11.w);
}
var _12=Math.max(AJS.getScrollTop()+_11.h,AJS.getScrollTop()+this.height);
if(_12<AJS.getScrollTop()){
AJS.setHeight(this.overlay,_12);
}else{
AJS.setHeight(this.overlay,AJS.getScrollTop()+_11.h);
}
},initOverlay:function(){
this.overlay=AJS.DIV({"id":"GB_overlay"});
if(this.overlay_click_close){
AJS.AEV(this.overlay,"click",GB_hide);
}
AJS.setOpacity(this.overlay,0);
AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);
},initFrame:function(){
if(!this.iframe){
var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};
if(AJS.isIe()){
d.src="javascript:false;document.write(\"\");";
}
this.iframe=AJS.IFRAME(d);
this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);
this.top_cnt=AJS.DIV();
this.bottom_cnt=AJS.DIV();
AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);
}
},onHide:function(){
},onShow:function(){
},onAfterShow:function(){
},setFrameSize:function(){
},setWindowPosition:function(){
},initHook:function(){
}});
_GB_update=function(){
if(GB_CURRENT){
GB_CURRENT.update();
}
};
_GB_setOverlayDimension=function(){
if(GB_CURRENT){
GB_CURRENT.setOverlayDimension();
}
};
AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");
script_loaded=true;
var GB_SETS={};
function decoGreyboxLinks(){
var as=AJS.$bytc("a");
AJS.map(as,function(a){
if(a.getAttribute("href")&&a.getAttribute("rel")){
var rel=a.getAttribute("rel");
if(rel.indexOf("gb_")==0){
var _17=rel.match(/\w+/)[0];
var _18=rel.match(/\[(.*)\]/)[1];
var _19=_18.split("|");
var _1a=_19[0];
var _1b=0;
var _1c=String(a.title).split(" # ");
var _1d={"caption":_1c[0]||"","url":getImageUrl(a.href),"desc":_1c[1]||""};
if(_17=="gb_imageset"){
if(_19[1]){
_1d.url_big=_1d.url+"/"+_19[1];
}
if(_19[2]){
_1d.url=_1d.url+"/"+_19[2];
}
if(_1d.url_big==undefined){
_1d.url_big=_1d.url;
}
}
if(_17=="gb_image"){
if(_19[0]){
_1d.url_big=_1d.url+"/"+_19[0];
}
if(_19[1]){
_1d.url=_1d.url+"/"+_19[1];
}
if(_1d.url_big==undefined){
_1d.url_big=_1d.url;
}
}
if(_17=="gb_pageset"||_17=="gb_imageset"){
if(!GB_SETS[_1a]){
GB_SETS[_1a]=[];
}
find_element=0;
for(var i=0;i<GB_SETS[_1a].length;i++){
if(GB_SETS[_1a][i].url==_1d.url){
find_element=1;
_1b=i+1;
break;
}
}
if(!find_element){
GB_SETS[_1a].push(_1d);
_1b=GB_SETS[_1a].length;
}
}
if(_17=="gb_pageset"){
a.onclick=function(){
GB_showPageSet(GB_SETS[_1a],_1b,0,1,800,500);
return false;
};
}
if(_17=="gb_imageset"){
a.onclick=function(){
GB_showImageSet(GB_SETS[_1a],_1b);
return false;
};
}
if(_17=="gb_image"){
a.onclick=function(){
GB_showImage(_1d.caption,_1d.url,_1d.url_big,_1d.desc);
return false;
};
}
if(_17=="gb_page"){
a.onclick=function(){
var sp=_1a.split(/, ?/);
GB_show(_1d.caption,_1d.url,_1d.desc,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
if(_17=="gb_page_fs"){
a.onclick=function(){
GB_showFullScreen(_1d.caption,_1d.url,_1d.desc);
return false;
};
}
if(_17=="gb_page_center"){
a.onclick=function(){
var sp=_1a.split(/, ?/);
GB_showCenter(_1d.caption,_1d.url,_1d.desc,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
}
}
});
}
function getImageUrl(url){
qs=String(url).split("?");
params=String(qs[1]).split("&");
image_url=url;
for(var i=0;i<params.length;i++){
o=params[i].split("=");
if(o[0]=="real_url"){
image_url=o[1];
break;
}
}
return image_url;
}
AJS.AEV(window,"load",decoGreyboxLinks);
GB_showImage=function(_23,url,_25,_26,_27){
var _28={width:300,height:300,type:"image",has_big_image:url!=_25,fullscreen:false,center_win:true,caption:_23,desc:_26,callback_fn:_27};
var win=new GB_Gallery(_28);
return win.show(url);
};
GB_showPage=function(_2a,url,_2c,_2d){
var _2e={type:"page",caption:_2a,desc:_2c,callback_fn:_2d,fullscreen:true,center_win:false};
var win=new GB_Gallery(_2e);
return win.show(url);
};
GB_Gallery=GreyBox.extend({init:function(_30){
this.parent({});
this.img_close=this.root_dir+"g_close.gif";
AJS.update(this,_30);
if(this.type=="image"){
this.img_zoom=this.root_dir+"g_zoom.gif";
this.img_normal=this.root_dir+"g_normal.gif";
}
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Gallery");
var _31=AJS.DIV({"class":"inner"});
this.header=AJS.DIV({"class":"GB_header hidden"},_31);
AJS.setOpacity(this.header,0);
AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);
var _32=AJS.TD({"id":"GB_caption","class":"caption"},this.caption);
var _33=AJS.TD({"id":"GB_middle","class":"middle","width":"120px"});
var _34=AJS.IMG({"src":this.img_close,"alt":"Chiudi","title":"Chiudi"});
AJS.AEV(_34,"click",GB_hide);
if(this.type=="image"&&this.has_big_image){
this.btn_zoom=AJS.IMG({"src":this.img_zoom,"alt":"Ingrandisci","title":"Ingrandisci"});
AJS.AEV(this.btn_zoom,"click",this.zoomImage);
var _35=AJS.TD({"class":"close","width":"80px"},this.btn_zoom,_34);
}else{
var _35=AJS.TD({"class":"close","width":"80px"},_34);
}
var _36=AJS.TBODY(AJS.TR(_32,_33,_35));
var _37=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_36);
AJS.ACN(_31,_37);
if(this.desc){
footerc=AJS.DIV({"id":"GB_footer_content","class":"content"},this.desc);
this.footer=AJS.DIV({"id":"GB_footer","class":"footer hidden"},footerc);
AJS.insertAfter(this.footer,this.g_window);
}
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}else{
AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));
}
},setFrameSize:function(){
var _38=this.overlay.offsetWidth;
var _39=AJS.getWindowSize();
if(this.fullscreen){
this.width=_38-160;
this.height=_39.h-80;
}
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
AJS.setWidth(this.g_window,this.width+6);
if((this.width+6)>=500){
AJS.setWidth(this.header,this.width+6);
if(this.footer){
AJS.setWidth(this.footer,this.width+6);
}
}else{
AJS.setWidth(this.header,500);
if(this.footer){
AJS.setWidth(this.footer,500);
}
}
AJS.setWidth(AJS.$("GB_caption"),this.width-200);
},_setHeaderPos:function(){
topscroll=AJS.getScrollTop();
g_window_y=AJS.absolutePosition(this.g_window).y;
g_header_y=AJS.absolutePosition(this.header).y;
if((g_window_y-topscroll)<10){
AJS.setTop(this.header,AJS.getScrollTop()+1);
AJS.setOpacity(this.header,0.5);
if(topscroll<50){
AJS.setOpacity(this.header,1);
}
}else{
if((g_header_y-g_window_y+50)>0){
AJS.setTop(this.header,g_window_y-50);
AJS.setOpacity(this.header,1);
}
}
},setWindowPosition:function(){
var _3a=this.overlay.offsetWidth;
var _3b=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_3a-50-this.width)/2));
if((this.width+6)<500){
AJS.setLeft(this.header,((_3a-50-500)/2));
if(this.footer){
AJS.setLeft(this.footer,((_3a-50-500)/2));
}
}else{
AJS.setLeft(this.header,((_3a-50-this.width)/2));
if(this.footer){
AJS.setLeft(this.footer,((_3a-50-this.width)/2));
}
}
var _3c=AJS.getScrollTop();
if(!this.center_win){
AJS.setTop(this.header,_3c+10);
AJS.setTop(this.g_window,_3c+50);
}else{
var fl=((_3b.h-(this.height+50))/2)+10+_3c;
if(fl<0){
fl=0;
}
if(_3c>fl){
fl=_3c;
}
AJS.setTop(this.header,fl);
AJS.setTop(this.g_window,fl+50);
}
g_window_y=AJS.absolutePosition(this.g_window).y;
if(this.footer){
AJS.setTop(this.footer,g_window_y+this.height+10);
}
this._setHeaderPos();
},onHide:function(){
AJS.removeElement(this.header);
AJS.removeClass(this.g_window,"GB_Gallery");
if(this.footer){
AJS.removeElement(this.footer);
}
},onShow:function(){
if(this.use_fx){
AJS.fx.fadeIn(this.header,{to:1});
}else{
AJS.setOpacity(this.header,1);
}
},onAfterShow:function(){
AJS.removeClass(this.header,"hidden");
if(this.footer){
AJS.removeClass(this.footer,"hidden");
}
},zoomImage:function(){
this.GB_CURRENT.width=900;
this.GB_CURRENT.height=700;
this.GB_CURRENT.is_big_image=true;
this.GB_CURRENT.btn_zoom.src=this.GB_CURRENT.img_normal;
AJS.REV(this.GB_CURRENT.btn_zoom,"click",this.GB_CURRENT.zoomImage);
AJS.AEV(this.GB_CURRENT.btn_zoom,"click",this.GB_CURRENT.normalImage);
this.GB_CURRENT.updateStatus();
this.GB_CURRENT.updateFrame();
},normalImage:function(){
this.GB_CURRENT.width=500;
this.GB_CURRENT.height=300;
this.GB_CURRENT.is_big_image=false;
this.GB_CURRENT.btn_zoom.src=this.GB_CURRENT.img_zoom;
AJS.REV(this.GB_CURRENT.btn_zoom,"click",this.GB_CURRENT.normalImage);
AJS.AEV(this.GB_CURRENT.btn_zoom,"click",this.GB_CURRENT.zoomImage);
this.GB_CURRENT.updateStatus();
this.GB_CURRENT.updateFrame();
}});
AJS.preloadImages(GB_ROOT_DIR+"g_close.gif",GB_ROOT_DIR+"g_zoom.gif",GB_ROOT_DIR+"g_normal.gif");
GB_showPageSet=function(set,_3f,_40,_41,_42,_43,_44){
var _45={type:"page",fullscreen:_40||(!(_43&&_42)&&true||false),center_win:_41||false,height:_43||500,width:_42||500,desc:""};
var _46=new GB_Sets(_45,set);
_46.addCallback(_44);
_46.showSet(_3f-1);
return false;
};
GB_showImageSet=function(set,_48,_49){
var _4a={type:"image",fullscreen:false,center_win:true,has_big_image:true,width:300,height:300,desc:"",is_big_image:false};
var _4b=new GB_Sets(_4a,set);
_4b.addCallback(_49);
_4b.showSet(_48-1);
return false;
};
GB_Sets=GB_Gallery.extend({init:function(_4c,set){
this.parent(_4c);
if(!this.img_next){
this.img_next=this.root_dir+"next.gif";
}
if(!this.img_prev){
this.img_prev=this.root_dir+"prev.gif";
}
this.current_set=set;
},showSet:function(_4e){
this.current_index=_4e;
var _4f=this.current_set[this.current_index];
this.show(_4f.url);
this._setCaption(_4f.caption);
this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});
this.btn_next=AJS.IMG({"class":"right",src:this.img_next});
AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));
AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));
GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});
AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);
if(!this.footer){
footerc=AJS.DIV({"id":"GB_footer_content","class":"content"});
this.footer=AJS.DIV({"id":"GB_footer","class":"footer hidden"},footerc);
AJS.insertAfter(this.footer,AJS.$("GB_window"));
}
if(this.footer){
if(_4f.desc){
AJS.setHTML(AJS.$("GB_footer_content"),_4f.desc);
}
}
this.updateStatus();
},updateStatus:function(){
AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);
if(this.current_index==0){
AJS.addClass(this.btn_prev,"disabled");
}else{
AJS.removeClass(this.btn_prev,"disabled");
}
if(this.current_index==this.current_set.length-1){
AJS.addClass(this.btn_next,"disabled");
}else{
AJS.removeClass(this.btn_next,"disabled");
}
},_setCaption:function(_50){
AJS.setHTML(AJS.$("GB_caption"),_50);
},_setFooter:function(_51){
AJS.setHTML(AJS.$("GB_footer_content"),_51);
AJS.removeClass(this.footer,"hidden");
},updateFrame:function(){
var _52=this.current_set[this.current_index];
if(this.is_big_image){
this.url=_52.url_big;
}else{
this.url=_52.url;
}
this.startLoading();
this._setCaption(_52.caption);
},switchPrev:function(){
if(this.current_index!=0){
this.current_index--;
this.updateFrame();
this.updateStatus();
}
},switchNext:function(){
if(this.current_index!=this.current_set.length-1){
this.current_index++;
this.updateFrame();
this.updateStatus();
}
},onAfterShow:function(){
AJS.removeClass(this.header,"hidden");
var _53=this.current_set[this.current_index];
if(this.footer){
if(_53.desc&&!this.is_big_image){
this._setFooter(_53.desc);
}else{
AJS.addClass(this.footer,"hidden");
}
}
}});
AJS.AEV(window,"load",function(){
AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif");
});
GB_show=function(_54,url,_56,_57,_58,_59){
var _5a={caption:_54,desc:_56,height:_57||500,width:_58||500,fullscreen:false,callback_fn:_59};
var win=new GB_Window(_5a);
return win.show(url);
};
GB_showCenter=function(_5c,url,_5e,_5f,_60,_61){
var _62={caption:_5c,desc:_5e,center_win:true,height:_5f||500,width:_60||500,fullscreen:false,callback_fn:_61};
var win=new GB_Window(_62);
return win.show(url);
};
GB_showFullScreen=function(_64,url,_66,_67){
var _68={caption:_64,desc:_66,fullscreen:true,callback_fn:_67};
var win=new GB_Window(_68);
return win.show(url);
};
GB_Window=GreyBox.extend({init:function(_6a){
this.parent({});
this.img_header=this.root_dir+"header_bg.gif";
this.img_close=this.root_dir+"g_close.gif";
this.show_close_img=true;
AJS.update(this,_6a);
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Window");
this.header=AJS.TABLE({"class":"header"});
this.header.style.backgroundImage="url("+this.img_header+")";
var _6b=AJS.TD({"class":"caption"},this.caption);
var _6c=AJS.TD({"class":"close","width":"80px"});
if(this.show_close_img){
var _6d=AJS.IMG({"src":this.img_close,"alt":"Chiudi","title":"Chiudi"});
AJS.AEV(_6d,"click",GB_hide);
AJS.ACN(_6c,_6d);
}
tbody_header=AJS.TBODY();
AJS.ACN(tbody_header,AJS.TR(_6b,_6c));
AJS.ACN(this.header,tbody_header);
AJS.ACN(this.top_cnt,this.header);
if(this.desc){
footerc=AJS.DIV({"id":"GB_footer_content","class":"content"},this.desc);
this.footer=AJS.DIV({"id":"GB_footer","class":"footer hidden"},footerc);
AJS.insertAfter(this.footer,this.g_window);
}
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}
},setFrameSize:function(){
if(this.fullscreen){
var _6e=AJS.getWindowSize();
overlay_h=_6e.h;
this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);
this.height=Math.round(overlay_h-(overlay_h/100)*10);
if(this.footer){
this.height=this.height-32;
}
}
AJS.setWidth(this.header,this.width+6);
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
if(this.footer){
AJS.setWidth(this.footer,this.width+6);
}
},setWindowPosition:function(){
var _6f=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_6f.w-this.width)/2)-13);
if(this.footer){
AJS.setLeft(this.footer,((_6f.w-this.width)/2)-35);
}
var _70=AJS.getScrollTop();
if(!this.center_win){
AJS.setTop(this.g_window,_70);
}else{
var fl=((_6f.h-this.height)/2)-20+_70;
if(this.footer){
fl=fl-22;
}
if(fl<0){
fl=0;
}
AJS.setTop(this.g_window,fl);
}
var _72=AJS.absolutePosition(this.g_window).y;
if(this.footer){
AJS.setTop(this.footer,_72+this.height+37);
}
},onHide:function(){
if(this.footer){
AJS.removeElement(this.footer);
}
},onAfterShow:function(){
if(this.footer){
AJS.removeClass(this.footer,"hidden");
}
}});
function popupWindow(url,_74,_75){
winWidth=window.outerwidth;
winHeight=window.outerheight;
_74=_74+50;
if(winWidth<=1024&&_74>850){
_74=850;
}
_75=_75+100;
if(winHeight<=768&&_75>650){
_75=650;
}
w=window.open(url,"Popup","toolbar=0,location=0,directories=0,menubar=0,resizable=1,status=0,scrollbars=1,width="+_67+",height="+_68);
w.focus();
w.resizeTo(_75,_75);
return false;
}
AJS.preloadImages(GB_ROOT_DIR+"g_close.gif",GB_ROOT_DIR+"header_bg.gif");


script_loaded=true;

