(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret}})(name,prop[name]):prop[name]}function Class(){if(!initializing&&this.init){this.init.apply(this,arguments)}}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class}})();Function.prototype.bind=function(scope){var proxied=this;return function(){var args=Array.prototype.slice.call(arguments);args.push(this);return proxied.apply(scope,args)}};function $W(path){if(Spider.widgets[path]){return Spider.widgets[path]}var wdgt_id=path.replace(/\//g,"-");var wdgt=$("#"+wdgt_id);if(wdgt.length==0){return null}return Spider.Widget.initFromEl(wdgt)}Spider=function(){};if(window.SPIDER_BASE_URL){Spider.baseUrl=window.SPIDER_BASE_URL}else{Spider.baseUrl=""}Spider.widgets={};Widgets=function(){};Spider.Widget=Class.extend({init:function(container,path,config){this.el=container;this.path=path;var pathParts=path.split("/");this.widgetId=pathParts[pathParts.length-1];this.fullId=pathParts.join("_");this.backend=new Spider.WidgetBackend(this);this.readyFunctions=[];config=$.extend({},config);this.config=config;this.model=config.model;Spider.widgets[path]=this;this.events=[];this.onWidgetCallbacks={};this.widgets={};this.findWidgets();this.startup();this.ready();this.applyReady();this.plugins=[];if(this.includePlugins){for(var i=0;i<this.includePlugins.length;i++){this.plugin(this.includePlugins[i])}}},remote:function(){var args=Array.prototype.slice.call(arguments);var method=args.shift();var options={};if($.isFunction(args[args.length-1])){options.callback=args.pop()}return this.backend.send(method,args,options)},onReady:function(callback){this.readyFunctions.push(callback);callback.apply(this)},applyReady:function(){for(var i=0;i<this.readyFunctions.length;i++){this.readyFunctions[i].apply(this)}},reload:function(params,callback){if(!callback&&$.isFunction(params)){callback=params;params={}}if($.browser.msie){if(!params){params={}}params._t=(new Date).valueOf()}$C.loadWidget(this.path,params,callback)},isLoaded:function(){return !this.el.is(":empty")},startup:function(){},ready:function(){},update:function(){},afterReplace:function(){},replaceHTML:function(html){var el=$(html);this.el.html(el.html());this.findWidgets();this.update();this.ready();Spider.newHTML(this.el);this.applyReady();this.afterReplace()},replaceEl:function(el){this.el=el;this.findWidgets();this.update();this.ready();this.applyReady();this.afterReplace()},findWidgets:function(){var self=this;$(".widget",this.el).filter(function(index){if($(this).parents(".widget").get(0)==self.el.get(0)){return true}return false}).each(function(){var $this=$(this);var w=$this.spiderWidget();if(!self.widgets[w.widgetId]){self.addWidget(w.widgetId,w)}else{self.widgets[w.widgetId].replaceEl($this)}})},addWidget:function(id,w){this.widgets[id]=w;if(this.onWidgetCallbacks[id]){for(var i=0;i<this.onWidgetCallbacks[id].length;i++){this.onWidgetCallbacks[id][i].call(this,w)}}},paramName:function(key){var pathParts=this.path.split("/");var param="_w";for(var i=0;i<pathParts.length;i++){param+="["+pathParts[i]+"]"}var matches=key.match(/(.+)(\[.*\])/);if(matches){param+="["+matches[1]+"]"+matches[2]}else{param+="["+key+"]"}return param},ajaxifyAll:function(options){var els=$("form:not(.ajaxified), a:not(.ajaxified)",this.el);if(!options){options={}}if(options.filter){els=els.filter(options.filter)}if(options.not){els=els.not(options.not)}this.ajaxify(els,options)},findWidgetsAjaxifiable:function(options){var selfEl=this.el.get(0);return $("form:not(.ajaxified), a:not(.ajaxified)",this.el).filter(function(index){var p=$(this).parent();while(p){if(p.is(".widget")){if(p.get(0)==selfEl){return true}return false}p=p.parent()}return false})},ajaxify:function(el,options){var w=this;if(!el||!el.eq){options=el;el=this.findWidgetsAjaxifiable()}if(!options){options={}}el.each(function(){var $this=$(this);if(this.tagName=="FORM"){w.ajaxifyForm($(this),options)}else{if(this.tagName=="A"){w.ajaxifyLink($(this),options)}}})},ajaxifyForm:function(form,options){var isForm=form.get(0).tagName=="FORM";if(!options){options={}}$("input[type=submit]",form).addClass("ajaxified").bind("click.ajaxify",function(e){var $this=$(this);var w=$this.parentWidget();e.preventDefault();w.setLoading();var submitName=$this.attr("name");var submitValue=$this.val();var formOptions={dataType:"html",semantic:!isForm,beforeSubmit:function(data,form,options){data.push({name:submitName,value:submitValue});data.push({name:"_wt",value:w.path});if(options.before){options.before()}},success:function(res){w.trigger("ajaxifyResponse",form);w.replaceHTML(res);w.removeLoading();if(options.onLoad){options.onLoad(form)}w.trigger("ajaxifyLoad",form)}};if(!isForm){formOptions.type="POST"}form.ajaxSubmit(formOptions)})},ajaxifyLink:function(a,options){var w=this;if(!options){options={}}a.addClass("ajaxified").bind("click.ajaxify",function(e){if(options.before){var res=options.before.apply(w);if(res===false){return false}}e.preventDefault();var a=$(e.target);var url=w.urlToAction($(this).attr("href"));if(options.before){options.before()}w.setLoading();$.ajax({url:url,type:"GET",dataType:"html",success:function(res){w.trigger("ajaxifyResponse",a);w.replaceHTML(res);w.removeLoading();if(options.onLoad){options.onLoad(a)}w.trigger("ajaxifyLoad",a)}});return true})},urlToAction:function(url){var parts=url.split("?");url=parts[0];url+="?";if(parts[1]){url+=parts[1]+"&"}url+="_wt="+this.path;return url},setLoading:function(){if(this.el.is(":empty")||this.el.children().hasClass("empty-placeholder")){this.el.addClass("loading-empty")}else{this.el.addClass("loading")}},removeLoading:function(){this.el.removeClass("loading").removeClass("loading-empty")},acceptDataObject:function(model,acceptOptions,droppableOptions){if(!model.push){model=[model]}var cls="";for(var i=0;i<model.length;i++){if(cls){cls+=", "}cls+=".model-"+Spider.modelToCSS(model[i])+" .dataobject"}droppableOptions=$.extend({accept:cls,hoverClass:"drophover",tolerance:"pointer"},droppableOptions);acceptOptions=$.extend({el:this.el},acceptOptions);if(acceptOptions.el!=this.el){this.onReady(function(){$(acceptOptions.el,this.el).droppable(droppableOptions)})}else{this.el.droppable(droppableOptions)}},getClassInfo:function(prefix){var info=[];var cl=this.el.attr("class");var cl_parts=cl.split(" ");for(var i=0;i<cl_parts.length;i++){if(cl_parts[i].substr(0,prefix.length)==prefix){info.push(cl_parts[i].substr(prefix.length+1))}}return info},plugin:function(pClass,prop){if(prop){pClass=pClass.extend(prop)}this.plugins[pClass]=new pClass(this);var plugin=this.plugins[pClass];for(var name in pClass.prototype){if(name.substring(0,1)=="_"){continue}if(typeof pClass.prototype[name]=="function"&&!this[name]){this[name]=function(name){return function(){return plugin[name].apply(this,arguments)}}(name)}}},widget:function(id){return this.widgets[id]},onWidget:function(id,callback){var idParts=id.split("/",2);if(idParts[1]){return this.onWidget(idParts[0],function(w){w.onWidget(idParts[1],callback)})}if(this.widgets[id]){callback.call(this,this.widgets[id])}else{if(!this.onWidgetCallbacks[id]){this.onWidgetCallbacks[id]=[]}this.onWidgetCallbacks[id].push(callback)}return true},removeOnWidget:function(id,callback){for(var i=0;i<this.onWidgetCallbacks[id].length;i++){if(this.onWidgetCallbacks[id][i]==callback){this.onWidgetCallbacks[id].splice(i,1);return}}},parentWidget:function(){var pathParts=this.path.split("/");return $W(pathParts.slice(0,pathParts.length-1).join("/"))}});Spider.Widget.initFromEl=function(el){if(!el||!el.attr("id")){return null}var path=Spider.Widget.pathFromId(el.attr("id"));if(Spider.widgets[path]){var widget=Spider.widgets[path];if(el.get(0)!=widget.el.get(0)){widget.replaceEl(el)}return widget}var cl=el.attr("class");var cl_parts=cl.split(" ");var w_cl=null;var config={};var i;for(i=0;i<cl_parts.length;i++){if(cl_parts[i].substr(0,5)=="wdgt-"){w_cl=cl_parts[i].substr(5)}else{if(cl_parts[i].substr(0,6)=="model-"){config.model=cl_parts[i].substr(6)}}}if(w_cl){var w_cl_parts=w_cl.split("-");var target=Widgets;for(i=0;i<w_cl_parts.length;i++){target=target[w_cl_parts[i]];if(!target){break}}}var func=null;if(target){func=target}else{func=Spider.Widget}var obj=new func(el,path,config);return obj};Spider.Widget.pathFromId=function(id){return id.replace(/-/g,"/")};Spider.WidgetBackend=Class.extend({init:function(widget){this.widget=widget;this.baseUrl=document.location.href.split("#")[0];this.urlParts=this.baseUrl.split("?");this.wUrl=this.urlParts[0]+"?";if(this.urlParts[1]){this.wUrl+=this.urlParts[1]+"&"}this.wUrl+="_wt="+this.widget.path},urlForMethod:function(method){return this.wUrl+"&_we="+method},send:function(method,args,options){if(!options){options={}}var defaults={type:"POST",dataType:"json"};options=$.extend(defaults,options);if(!options.format){options.format=options.dataType}var url=this.baseUrl;var data={};if($.isPlainObject(args[0])){data=args[0]}else{data={_wp:args}}$.extend(data,{_wt:this.widget.path,_we:method,_wf:options.format});var callback=this.widget[method+"_response"];if(!callback){callback=options.callback}if(!callback){callback=function(){}}delete (options.callback);options.success=callback;options.data=data;options.url=url;$.ajax(options)}});Spider.widgetClasses={};Spider.defineWidget=function(name,parent,w){if(!w){w=parent;parent=null}var parts=name.split(".");var curr=Widgets;for(var i=0;i<parts.length-1;i++){if(!curr[parts[i]]){curr[parts[i]]=function(){}}curr=curr[parts[i]]}var last=parts[parts.length-1];var widget;if(curr[last]){widget=curr[last].extend(w)}else{if(parent){parent=Spider.widgetClasses[parent]}else{parent=Spider.Widget}widget=parent.extend(w)}curr[last]=widget;Spider.widgetClasses[name]=widget;if(w.autoInit){var initSelector=null;if(w.autoInit===true){initSelector=".wdgt-"+parts.join("-")}else{initSelector=w.autoInit}Spider.onHTML(function(){$(initSelector,this).each(function(){Spider.Widget.initFromEl($(this))})})}return widget};Spider.Controller=Class.extend({init:function(){var loc=$("link[rel=index]").attr("href");if(loc){if(loc.substr(loc.length-5)=="index"){loc=loc.substr(0,loc.length-5)}url=loc}else{var loc=""+document.location;var slashPos=loc.lastIndexOf("/");url=loc.substr(0,slashPos)}this.setUrl(url);this.currentAction=loc.substr(slashPos+1)},setUrl:function(url){this.url=url;this.publicUrl=this.url+"/public";this.homeUrl=this.url+"/_h"},remote:function(method,params,callback,options){var args=Array.prototype.slice.call(arguments);if($.isFunction(params)){options=callback;callback=params;params=null}if(!callback){callback=function(){}}var url=this.url+"/"+method+".json";var defaults={url:url,type:"POST",success:callback,data:params,dataType:"json"};options=$.extend(defaults,options);$.ajax(options)},loadWidget:function(path,params,callback){var widget=$W(path);var href=document.location.href;var urlParts=href.split("?");var docParts=urlParts[0].split("#");var url=docParts[0]+"?_wt="+path;if(urlParts[1]){url+="&"+urlParts[1]}if(params){for(var key in params){url+="&"+this.paramToQuery(params[key],widget.paramName(key))}}widget.setLoading();$.ajax({url:url,type:"GET",dataType:"html",success:function(res){widget.replaceHTML(res);widget.removeLoading();if(callback){callback.apply(widget)}}})},paramToQuery:function(value,prefix){return Spider.paramToQuery(value,prefix)}});$C=new Spider.Controller();$(document).ready(function(){$("a.ajax").click(function(e){e.preventDefault();var a=$(e.target);var url=$(this).attr("href");var parts=url.split("?");url=parts[0]+".json";if(parts[1]){url+="?"+parts[1]}$.ajax({url:url,type:"GET",dataType:"json",success:function(res){a.trigger("autoAjaxSuccess",res)}});return false})});$.fn.spiderWidget=function(){if(!this.attr("id")){return null}var path=Spider.Widget.pathFromId(this.attr("id"));if(Spider.widgets[path]){return Spider.widgets[path]}return Spider.Widget.initFromEl(this)};$.fn.parentWidget=function(){var par=this;while(par&&par.length>0&&!par.is(".widget")){par=par.parent()}if(!par){return null}return par.spiderWidget()};$.fn.getDataObjectKey=function(){var doParent=null;var par=this;while(par&&par.length>0&&!par.is(".dataobject")){par=par.parent()}if(!par){return null}return $(">.dataobject-key",par).text()};$.fn.getDataModel=function(){var par=this;while(par&&par.length>0&&!par.is(".model")){par=par.parent()}if(!par){return null}var cl=par.attr("class");if(!cl){return null}var cl_parts=cl.split(" ");for(var i=0;i<cl_parts.length;i++){if(cl_parts[i].substr(0,6)=="model-"){return cl_parts[i].substr(6).replace(/-/g,"::")}}return null};Spider.htmlFunctions=[];Spider.onHTML=function(callback){Spider.htmlFunctions.push(callback);$(document).ready(function(){callback.call($(this.body))})};Spider.newHTML=function(el){for(var i=0;i<Spider.htmlFunctions.length;i++){Spider.htmlFunctions[i].call(el)}};Spider.modelToCSS=function(name){return name.split("::").join("-")};Spider.paramToQuery=function(value,prefix){var res=null;if(!prefix){prefix=""}if(!value){return"=null"}else{if(value.push){for(var i=0;i<value.length;i++){if(!res){res=""}else{res+="&"}res+=this.paramToQuery(value[i],prefix+"[]")}return res}else{if(typeof(value)=="object"){for(var name in value){if(!res){res=""}else{res+="&"}res+=this.paramToQuery(value[name],prefix+"["+name+"]")}return res}else{return prefix+"="+value}}}};jQuery.parseISODate=function(iso){var d=new Date();var r=/(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2}))?/.exec(iso);if(r){d.setFullYear(r[1],r[2]-1,r[3]);if(!r[4]){r[4]=0}if(!r[5]){r[5]=0}if(!r[6]){r[6]=0}d.setHours(r[4],r[5],r[6],0);return d}else{return null}};if(!Date.prototype.toISOString){Date.prototype.toISOString=(function(){function t(i){return i<10?"0"+i:i}function h(i){return i.length<2?"00"+i:i.length<3?"0"+i:3<i.length?Math.round(i/Math.pow(10,i.length-3)):i}return function(){return"".concat(this.getUTCFullYear(),"-",t(this.getUTCMonth()+1),"-",t(this.getUTCDate()),"T",t(this.getUTCHours()),":",t(this.getUTCMinutes()),":",t(this.getUTCSeconds()),".",h(""+this.getUTCMilliseconds()),"Z")}})()}Spider.EventTarget={bind:function(eventName,callback){if(!this.events){this.events={}}var handleObj={callback:callback};if(eventName.indexOf(".")>-1){var namespaces=eventName.split(".");eventName=namespaces.shift();handleObj.namespace=namespaces.slice(0).sort().join(".")}if(!this.events[eventName]){this.events[eventName]=[]}this.events[eventName].push(handleObj)},on:function(eventName,callback){return this.bind(eventName,callback)},trigger:function(eventName){if(!this.events){this.events={}}if(eventName.indexOf(".")>-1){var namespaces=eventName.split(".");eventName=namespaces.shift();namespace=namespaces.slice(0).sort().join(".")}if(!this.events[eventName]){return}var args=Array.prototype.slice.call(arguments,1);for(var i=0;i<this.events[eventName].length;i++){this.events[eventName][i].callback.apply(this,args)}},unbind:function(eventName){if(!this.events){this.events={}}var namespace=null;if(eventName.indexOf(".")>-1){var namespaces=eventName.split(".");eventName=namespaces.shift();namespace=namespaces.slice(0).sort().join(".")}if(namespace){for(var i=0;i<this.events[eventName].length;i++){if(this.events[eventName][i].namespace==namespace){this.events[eventName].splice(i)}}}else{this.events[eventName]=[]}}};$.extend(Spider.Widget.prototype,Spider.EventTarget);var translations={};function _(s){var str=s;var tr=translations[s];if(tr){str=tr}for(var i=1;i<arguments.length;i++){str=str.replace("%s",arguments[i])}return str}if(!window.console){window.console=new function(){this.log=function(str){};this.dir=function(str){}}}function basename(path){return path.replace(/\\/g,"/").replace(/.*\//,"")}function dirname(path){return path.replace(/\\/g,"/").replace(/\/[^\/]*$/,"")}new function(settings){var $separator=settings.separator||"&";var $spaces=settings.spaces===false?false:true;var $suffix=settings.suffix===false?"":"[]";var $prefix=settings.prefix===false?false:true;var $hash=$prefix?settings.hash===true?"#":"?":"";var $numbers=settings.numbers===false?false:true;jQuery.query=new function(){var is=function(o,t){return o!=undefined&&o!==null&&(!!t?o.constructor==t:true)};var parse=function(path){var m,rx=/\[([^[]*)\]/g,match=/^([^[]+?)(\[.*\])?$/.exec(path),base=match[1],tokens=[];while(m=rx.exec(match[2])){tokens.push(m[1])}return[base,tokens]};var set=function(target,tokens,value){var o,token=tokens.shift();if(typeof target!="object"){target=null}if(token===""){if(!target){target=[]}if(is(target,Array)){target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}else{if(is(target,Object)){var i=0;while(target[i++]!=null){}target[--i]=tokens.length==0?value:set(target[i],tokens.slice(0),value)}else{target=[];target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}}}else{if(token&&token.match(/^\s*[0-9]+\s*$/)){var index=parseInt(token,10);if(!target){target=[]}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{if(token){var index=token.replace(/^\s*|\s*$/g,"");if(!target){target={}}if(is(target,Array)){var temp={};for(var i=0;i<target.length;++i){temp[i]=target[i]}target=temp}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{return value}}}return target};var queryObject=function(a){var self=this;self.keys={};if(a.queryObject){jQuery.each(a.get(),function(key,val){self.SET(key,val)})}else{jQuery.each(arguments,function(){var q=""+this;q=q.replace(/^[?#]/,"");q=q.replace(/[;&]$/,"");if($spaces){q=q.replace(/[+]/g," ")}jQuery.each(q.split(/[&;]/),function(){var key=decodeURIComponent(this.split("=")[0]||"");var val=decodeURIComponent(this.split("=")[1]||"");if(!key){return}if($numbers){if(/^[+-]?[0-9]+\.[0-9]*$/.test(val)){val=parseFloat(val)}else{if(/^[+-]?[0-9]+$/.test(val)){val=parseInt(val,10)}}}val=(!val&&val!==0)?true:val;if(val!==false&&val!==true&&typeof val!="number"){val=val}self.SET(key,val)})})}return self};queryObject.prototype={queryObject:true,has:function(key,type){var value=this.get(key);return is(value,type)},GET:function(key){if(!is(key)){return this.keys}var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];while(target!=null&&tokens.length!=0){target=target[tokens.shift()]}return typeof target=="number"?target:target||""},get:function(key){var target=this.GET(key);if(is(target,Object)){return jQuery.extend(true,{},target)}else{if(is(target,Array)){return target.slice(0)}}return target},SET:function(key,val){var value=!is(val)?null:val;var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];this.keys[base]=set(target,tokens.slice(0),value);return this},set:function(key,val){return this.copy().SET(key,val)},REMOVE:function(key){return this.SET(key,null).COMPACT()},remove:function(key){return this.copy().REMOVE(key)},EMPTY:function(){var self=this;jQuery.each(self.keys,function(key,value){delete self.keys[key]});return self},load:function(url){var hash=url.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var search=url.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new queryObject(url.length==search.length?"":search,url.length==hash.length?"":hash)},empty:function(){return this.copy().EMPTY()},copy:function(){return new queryObject(this)},COMPACT:function(){function build(orig){var obj=typeof orig=="object"?is(orig,Array)?[]:{}:orig;if(typeof orig=="object"){function add(o,key,value){if(is(o,Array)){o.push(value)}else{o[key]=value}}jQuery.each(orig,function(key,value){if(!is(value)){return true}add(obj,key,build(value))})}return obj}this.keys=build(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var i=0,queryString=[],chunks=[],self=this;var encode=function(str){str=str+"";if($spaces){str=str.replace(/ /g,"+")}return encodeURIComponent(str)};var addFields=function(arr,key,value){if(!is(value)||value===false){return}var o=[encode(key)];if(value!==true){o.push("=");o.push(encode(value))}arr.push(o.join(""))};var build=function(obj,base){var newKey=function(key){return !base||base==""?[key].join(""):[base,"[",key,"]"].join("")};jQuery.each(obj,function(key,value){if(typeof value=="object"){build(value,newKey(key))}else{addFields(chunks,newKey(key),value)}})};build(this.keys);if(chunks.length>0){queryString.push($hash)}queryString.push(chunks.join($separator));return queryString.join("")}};return new queryObject(location.search,location.hash)}}(jQuery.query||{});
/*!
 * jQuery Form Plugin
 * version: 2.73 (03-MAY-2011)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof options=="function"){options={success:options}}var action=this.attr("action");var url=(typeof action==="string")?$.trim(action):"";if(url){url=(url.match(/^([^#]+)/)||[])[1]}url=url||window.location.href||"";options=$.extend(true,{url:url,success:$.ajaxSettings.success,type:this[0].getAttribute("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},options);var veto={};this.trigger("form-pre-serialize",[this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var n,v,a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(n in options.data){if(options.data[n] instanceof Array){for(var k in options.data[n]){a.push({name:n,value:options.data[n][k]})}}else{v=options.data[n];v=$.isFunction(v)?v():v;a.push({name:n,value:v})}}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[a,this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var q=$.param(a);if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;options.data=null}else{options.data=q}var $form=this,callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm()})}if(options.clearForm){callbacks.push(function(){$form.clearForm()})}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?"replaceWith":"html";$(options.target)[fn](data).each(oldSuccess,arguments)})}else{if(options.success){callbacks.push(options.success)}}options.success=function(data,status,xhr){var context=options.context||options;for(var i=0,max=callbacks.length;i<max;i++){callbacks[i].apply(context,[data,status,xhr||$form,$form])}};var fileInputs=$("input:file",this).length>0;var mp="multipart/form-data";var multipart=($form.attr("enctype")==mp||$form.attr("encoding")==mp);if(options.iframe!==false&&(fileInputs||options.iframe||multipart)){if(options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload)}else{fileUpload()}}else{$.ajax(options)}this.trigger("form-submit-notify",[this,options]);return this;function fileUpload(){var form=$form[0];if($(":input[name=submit],:input[id=submit]",form).length){alert('Error: Form elements must not have name or id of "submit".');return}var s=$.extend(true,{},$.ajaxSettings,options);s.context=s.context||s;var id="jqFormIO"+(new Date().getTime()),fn="_"+id;var $io=$('<iframe id="'+id+'" name="'+id+'" src="'+s.iframeSrc+'" />');var io=$io[0];$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(status){var e=(status==="timeout"?"timeout":"aborted");log("aborting upload... "+e);this.aborted=1;$io.attr("src",s.iframeSrc);xhr.error=e;s.error&&s.error.call(s.context,xhr,e,e);g&&$.event.trigger("ajaxError",[xhr,s,e]);s.complete&&s.complete.call(s.context,xhr,e)}};var g=s.global;if(g&&!$.active++){$.event.trigger("ajaxStart")}if(g){$.event.trigger("ajaxSend",[xhr,s])}if(s.beforeSend&&s.beforeSend.call(s.context,xhr,s)===false){if(s.global){$.active--}return}if(xhr.aborted){return}var timedOut=0,timeoutHandle;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){s.extraData=s.extraData||{};s.extraData[n]=sub.value;if(sub.type=="image"){s.extraData[n+".x"]=form.clk_x;s.extraData[n+".y"]=form.clk_y}}}function doSubmit(){var t=$form.attr("target"),a=$form.attr("action");form.setAttribute("target",id);if(form.getAttribute("method")!="POST"){form.setAttribute("method","POST")}if(form.getAttribute("action")!=s.url){form.setAttribute("action",s.url)}if(!s.skipEncodingOverride){$form.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(s.timeout){timeoutHandle=setTimeout(function(){timedOut=true;cb(true)},s.timeout)}var extraInputs=[];try{if(s.extraData){for(var n in s.extraData){extraInputs.push($('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />').appendTo(form)[0])}}$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);form.submit()}finally{form.setAttribute("action",a);if(t){form.setAttribute("target",t)}else{$form.removeAttr("target")}$(extraInputs).remove()}}if(s.forceSync){doSubmit()}else{setTimeout(doSubmit,10)}var data,doc,domCheckCount=50,callbackProcessed;function cb(e){if(xhr.aborted||callbackProcessed){return}if(e===true&&xhr){xhr.abort("timeout");return}var doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;if(!doc||doc.location.href==s.iframeSrc){if(!timedOut){return}}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var ok=true;try{if(timedOut){throw"timeout"}var isXml=s.dataType=="xml"||doc.XMLDocument||$.isXMLDoc(doc);log("isXml="+isXml);if(!isXml&&window.opera&&(doc.body==null||doc.body.innerHTML=="")){if(--domCheckCount){log("requeing onLoad callback, DOM not available");setTimeout(cb,250);return}}xhr.responseText=doc.body?doc.body.innerHTML:doc.documentElement?doc.documentElement.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(isXml){s.dataType="xml"}xhr.getResponseHeader=function(header){var headers={"content-type":s.dataType};return headers[header]};var scr=/(json|script|text)/.test(s.dataType);if(scr||s.textarea){var ta=doc.getElementsByTagName("textarea")[0];if(ta){xhr.responseText=ta.value}else{if(scr){var pre=doc.getElementsByTagName("pre")[0];var b=doc.getElementsByTagName("body")[0];if(pre){xhr.responseText=pre.textContent}else{if(b){xhr.responseText=b.innerHTML}}}}}else{if(s.dataType=="xml"&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText)}}data=httpData(xhr,s.dataType,s)}catch(e){log("error caught:",e);ok=false;xhr.error=e;s.error&&s.error.call(s.context,xhr,"error",e);g&&$.event.trigger("ajaxError",[xhr,s,e])}if(xhr.aborted){log("upload aborted");ok=false}if(ok){s.success&&s.success.call(s.context,data,"success",xhr);g&&$.event.trigger("ajaxSuccess",[xhr,s])}g&&$.event.trigger("ajaxComplete",[xhr,s]);if(g&&!--$.active){$.event.trigger("ajaxStop")}s.complete&&s.complete.call(s.context,xhr,ok?"success":"error");callbackProcessed=true;if(s.timeout){clearTimeout(timeoutHandle)}setTimeout(function(){$io.removeData("form-plugin-onload");$io.remove();xhr.responseXML=null},100)}var toXml=$.parseXML||function(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s)}else{doc=(new DOMParser()).parseFromString(s,"text/xml")}return(doc&&doc.documentElement&&doc.documentElement.nodeName!="parsererror")?doc:null};var parseJSON=$.parseJSON||function(s){return window["eval"]("("+s+")")};var httpData=function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml=type==="xml"||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.nodeName==="parsererror"){$.error&&$.error("parsererror")}if(s&&s.dataFilter){data=s.dataFilter(data,type)}if(typeof data==="string"){if(type==="json"||!type&&ct.indexOf("json")>=0){data=parseJSON(data)}else{if(type==="script"||!type&&ct.indexOf("javascript")>=0){$.globalEval(data)}}}return data}}};$.fn.ajaxForm=function(options){if(this.length===0){var o={s:this.selector,c:this.context};if(!$.isReady&&o.s){log("DOM not ready, queuing ajaxForm");$(function(){$(o.s,o.c).ajaxForm(options)});return this}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(e){if(!e.isDefaultPrevented()){e.preventDefault();$(this).ajaxSubmit(options)}}).bind("click.form-plugin",function(e){var target=e.target;var $el=$(target);if(!($el.is(":submit,input:image"))){var t=$el.closest(":submit");if(t.length==0){return}target=t[0]}var form=this;form.clk=target;if(target.type=="image"){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY}else{if(typeof $.fn.offset=="function"){var offset=$el.offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top}else{form.clk_x=e.pageX-target.offsetLeft;form.clk_y=e.pageY-target.offsetTop}}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)})};$.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};$.fn.formToArray=function(semantic){var a=[];if(this.length===0){return a}var form=this[0];var els=semantic?form.getElementsByTagName("*"):form.elements;if(!els){return a}var i,j,n,v,el,max,jmax;for(i=0,max=els.length;i<max;i++){el=els[i];n=el.name;if(!n){continue}if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}continue}v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v})}}}if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0];n=input.name;if(n&&!input.disabled&&input.type=="image"){a.push({name:n,value:$input.val()});a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}}return a};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue}v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(successful===undefined){successful=true}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null}if(tag=="select"){var index=el.selectedIndex;if(index<0){return null}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v){v=(op.attributes&&op.attributes.value&&!(op.attributes.value.specified))?op.text:op.value}if(one){return v}a.push(v)}}return a}return $(el).val()};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value=""}else{if(t=="checkbox"||t=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b===undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.selected=function(select){if(select===undefined){select=true}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=select}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").selected(false)}this.selected=select}}})};function log(){if($.fn.ajaxSubmit.debug){var msg="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(msg)}else{if(window.opera&&window.opera.postError){window.opera.postError(msg)}}}}})(jQuery);Spider.Plugin=Class.extend({init:function(widget){this.widget=widget}});Spider.defineWidget("Cms.NewsListWidget",{autoInit:true,scrollInterval:5000,scrollHiddenOpacity:0.2,ready:function(){var self=this;if(this.el.is(".autoscroll")){var ul=$("ul",this.el);ul.css("overflow","hidden");if($(".paginator",this.el).length==0){return}this.baseUrl=$(".paginator a.next",this.el).attr("href").split("?")[0];var numShown=$("li",ul).length;this.numShown=numShown;this.remote("get_all",numShown,function(res){self.scrollLoaded=true;for(var i=0;i<res.length;i++){ul.append($("<li />").html(res[i].html).css("opacity",self.scrollHiddenOpacity))}if(self.afterScrollLoaded){if(self.afterScrollLoaded=="back"){self.scrollBack()}else{if(self.afterScrollLoaded=="next"){self.scrollNext()}}}self.initScroll()});$(".paginator a.prev",this.el).click(function(e){e.preventDefault();if(!self.scrollLoaded){self.afterScrollLoaded="back";return}self.scrollBack()});$(".paginator a.next",this.el).click(function(e){e.preventDefault();if(!self.scrollLoaded){self.afterScrollLoaded="next";return}self.scrollNext()});this.el.hover(function(e){self.scrollPaused=true},function(e){self.scrollPaused=false})}else{this.ajaxify($(".paginator a",this.el))}},initScroll:function(){var el=this.el;var self=this;setTimeout(function(){if(!self.scrollPaused){self.scrollNext()}self.initScroll()},this.scrollInterval)},scrollNext:function(){var firstEl=$("ul li:first",this.el);var currHeight=firstEl.outerHeight(true);var self=this;$("ul li:gt(0):lt("+this.numShown+")",this.el).animate({opacity:1});$("ul li:first",this.el).animate({marginTop:"-"+currHeight+"px",opacity:this.scrollHiddenOpacity},800,function(){$(this).appendTo($("ul",self.el)).removeAttr("style").css("opacity",self.scrollHiddenOpacity)})},scrollBack:function(){var firstEl=$("ul li:first",this.el);var currHeight=firstEl.outerHeight(true);var self=this;var lastLi=$("ul li:last",this.el);lastLi.css({marginTop:"-"+currHeight+"px"}).prependTo($("ul",self.el));lastLi.animate({marginTop:0,opacity:1},800,function(){$(this).removeAttr("style")});$("ul li:gt("+(this.numShown-1)+")",this.el).animate({opacity:this.scrollHiddenOpacity})}});$(function(){var ticker=function(){setTimeout(function(){$("#ticker li:first").animate({marginTop:"-120px"},800,function(){$(this).appendTo("ul#ticker").removeAttr("style")});ticker()},4000)};ticker()});function imgpreload(imgs,settings){if(settings instanceof Function){settings={all:settings}}if(typeof imgs=="string"){imgs=[imgs]}var loaded=[];var t=imgs.length;var i=0;for(i;i<t;i++){var img=new Image();img.onload=function(){loaded.push(this);if(settings.each instanceof Function){settings.each.call(this)}if(loaded.length>=t&&settings.all instanceof Function){settings.all.call(loaded)}};img.src=imgs[i]}}if(typeof jQuery!="undefined"){(function($){$.imgpreload=imgpreload;$.fn.imgpreload=function(settings){settings=$.extend({},$.fn.imgpreload.defaults,(settings instanceof Function)?{all:settings}:settings);this.each(function(){var elem=this;imgpreload($(this).attr("src"),function(){if(settings.each instanceof Function){settings.each.call(elem)}})});var urls=[];this.each(function(){urls.push($(this).attr("src"))});var selection=this;imgpreload(urls,function(){if(settings.all instanceof Function){settings.all.call(selection)}});return this};$.fn.imgpreload.defaults={each:null,all:null}})(jQuery)}Spider.defineWidget("Cms.ImageSliderWidget",{autoInit:true,ready:function(){var self=this;this.images=[];this.imgContainer=this.el.find(">.img-container");this.currentI=0;var first=this.imgContainer.find(">img:first");if(first.length>0){this.images.push({url:first.attr("src"),caption:this.el.find(".img-slider-bar .caption").text(),link:this.el.find(".img-slider-bar .caption a").attr("href")})}var imageList=$.trim(this.el.find(".image-list").text());if(imageList){imageList=$.parseJSON(imageList);var i;for(i=0;i<imageList.length;i++){this.images.push(imageList[i])}this.buildSliderControls();if(!window.Cms){this.startSlideShow()}}},buildSliderControls:function(){var self=this;this.sliderControls=this.el.find(">.img-slider-bar >.controls");this.sliderControls.empty();if(this.images.length==1){return}var button;for(i=0;i<this.images.length;i++){button=$('<div class="image-button" />').appendTo(this.sliderControls);if(i==0){button.addClass("active")}button.data("img",i);button.click(function(e){var i=$(this).data("img");self.goTo(i)})}if(this.sliderControlsAdmin){this.sliderControlsAdmin()}},goTo:function(num){var self=this;if(this.currentI==num){return}if(this.going){this.goNext=num;return}this.going=true;this.currentI=num;if(!this.imgContainer){this.imgContainer=this.el.find(">.img-container")}var curr=this.imgContainer.find(">img:first");curr.css("z-index",99);var img=this.images[num];var next=$("<img />").hide().attr("src",img.url).appendTo(this.imgContainer);var pos=curr.position();next.css({"z-index":100,position:"absolute",left:pos.left,top:pos.top});var captionDiv=this.el.find(".caption");if(img.caption){if(img.link){var a=$("<a />").attr("href",img.link).text(img.caption);captionDiv.empty().append(a)}else{captionDiv.empty().text(img.caption)}}else{captionDiv.html(this.el.find(">.slider-caption").html())}if(curr.length>0){curr.fadeOut();next.fadeIn(2000,function(){curr.remove();self.going=false;if(self.goNext){self.goTo(self.goNext);self.goNext=null}})}else{curr.show()}this.sliderControls.find(">.image-button").removeClass("active");this.sliderControls.find(">.image-button:eq("+num+")").addClass("active")},startSlideShow:function(){var self=this;var slide=function(){var n=self.currentI+1;if(n>=self.images.length){n=0}self.goTo(n);setTimeout(slide,10000)};var prel=[];var i=null;for(i=0;i<this.images.length;i++){prel.push(this.images[i].url)}$.imgpreload(prel,function(){setTimeout(slide,10000)})}});Spider.defineWidget("InterportoPD.ImmaginiTop","Cms.ImageSliderWidget",{autoInit:true});(function($){function BsmSelect(target,options){this.$original=$(target);this.buildingSelect=false;this.ieClick=false;this.ignoreOriginalChangeEvent=false;this.options=options;this.buildDom()}BsmSelect.prototype={generateUid:function(index){return(this.uid=this.options.containerClass+index)},buildDom:function(){var self=this,o=this.options;if(o.addItemTarget==="original"){$("option",this.$original).each(function(i,o){if($(o).data("bsm-order")===null){$(o).data("bsm-order",i)}})}for(var index=0;$("#"+this.generateUid(index)).size();index++){}this.$select=$("<select>",{"class":o.selectClass,name:o.selectClass+this.uid,id:o.selectClass+this.uid,change:$.proxy(this.selectChangeEvent,this),click:$.proxy(this.selectClickEvent,this)});this.$list=$.isFunction(o.listType)?o.listType(this.$original):$("<"+o.listType+">",{id:o.listClass+this.uid});this.$list.addClass(o.listClass);this.$container=$("<div>",{"class":o.containerClass,id:this.uid});this.buildSelect();this.$original.change($.proxy(this.originalChangeEvent,this)).wrap(this.$container).before(this.$select);if(!this.$list.parent().length){this.$original.before(this.$list)}if(this.$original.attr("id")){$("label[for="+this.$original.attr("id")+"]").attr("for",this.$select.attr("id"))}this.$list.delegate("."+o.removeClass,"click",function(){self.dropListItem($(this).closest("li"));return false});$.each(o.plugins,function(){this.init(self)})},selectChangeEvent:function(){if($.browser.msie&&$.browser.version<7&&!this.ieClick){return}var bsmOpt=$("option:selected:eq(0)",this.$select);if(bsmOpt.data("orig-option")){this.addListItem(bsmOpt);this.triggerOriginalChange(bsmOpt.data("orig-option"),"add")}this.ieClick=false},selectClickEvent:function(){this.ieClick=true},originalChangeEvent:function(){if(this.ignoreOriginalChangeEvent){this.ignoreOriginalChangeEvent=false}else{this.buildSelect();if($.browser.opera){this.$list.hide().show()}}},buildSelect:function(){var self=this;this.buildingSelect=true;this.$select.empty().prepend($('<option value=""></option>').text(this.$original.attr("title")||this.options.title));this.$list.empty();this.$original.children().each(function(){if($(this).is("option")){self.addSelectOption(self.$select,$(this))}else{if($(this).is("optgroup")){self.addSelectOptionGroup(self.$select,$(this))}}});if(!this.options.debugMode){this.$original.hide()}this.selectFirstItem();this.buildingSelect=false},addSelectOption:function($parent,$origOpt){var $bsmOpt=$("<option>",{text:$origOpt.text(),val:$origOpt.val()}).appendTo($parent).data("orig-option",$origOpt),isSelected=$origOpt.is(":selected"),isDisabled=$origOpt.is(":disabled");$origOpt.data("bsm-option",$bsmOpt);if(isSelected&&!isDisabled){this.addListItem($bsmOpt);this.disableSelectOption($bsmOpt)}else{if(!isSelected&&isDisabled){this.disableSelectOption($bsmOpt)}}},addSelectOptionGroup:function($parent,$group){var self=this,$G=$("<optgroup>",{label:$group.attr("label")}).appendTo($parent);if($group.is(":disabled")){$G.attr("disabled","disabled")}$("option",$group).each(function(){self.addSelectOption($G,$(this))})},selectFirstItem:function(){$("option:eq(0)",this.$select).attr("selected","selected")},disableSelectOption:function($bsmOpt){$bsmOpt.addClass(this.options.optionDisabledClass).removeAttr("selected").attr("disabled","disabled").toggle(!this.options.hideWhenAdded);if($.browser.msie&&$.browser.version<8){this.$select.hide().show()}},enableSelectOption:function($bsmOpt){$bsmOpt.removeClass(this.options.optionDisabledClass).removeAttr("disabled").toggle(!this.options.hideWhenAdded);if($.browser.msie&&$.browser.version<8){this.$select.hide().show()}},addListItem:function($bsmOpt){var $item,$origOpt=$bsmOpt.data("orig-option"),o=this.options;if(!$origOpt){return}if(!this.buildingSelect){if($origOpt.is(":selected")){return}$origOpt.attr("selected","selected")}$item=$("<li>",{"class":o.listItemClass}).append($("<span>",{"class":o.listItemLabelClass,html:o.extractLabel($bsmOpt,o)})).append($("<a>",{href:"#","class":o.removeClass,html:o.removeLabel})).data("bsm-option",$bsmOpt);this.disableSelectOption($bsmOpt.data("item",$item));switch(o.addItemTarget){case"bottom":this.$list.append($item.hide());break;case"original":var order=$origOpt.data("bsm-order"),inserted=false;$("."+o.listItemClass,this.$list).each(function(){if(order<$(this).data("bsm-option").data("orig-option").data("bsm-order")){$item.hide().insertBefore(this);inserted=true;return false}});if(!inserted){this.$list.append($item.hide())}break;default:this.$list.prepend($item.hide())}if(this.buildingSelect){$.bsmSelect.effects.show($item)}else{o.showEffect($item);o.highlightEffect(this.$select,$item,o.highlightAddedLabel,this.options);this.selectFirstItem()}},dropListItem:function($item){var $bsmOpt=$item.data("bsm-option"),o=this.options;$bsmOpt.removeData("item").data("orig-option").removeAttr("selected");(this.buildingSelect?$.bsmSelect.effects.remove:o.hideEffect)($item);this.enableSelectOption($bsmOpt);o.highlightEffect(this.$select,$item,o.highlightRemovedLabel,o);this.triggerOriginalChange($bsmOpt.data("orig-option"),"drop")},triggerOriginalChange:function($origOpt,type){this.ignoreOriginalChangeEvent=true;this.$original.trigger("change",[{option:$origOpt,value:$origOpt.val(),item:$origOpt.data("bsm-option").data("item"),type:type}])}};$.fn.bsmSelect=function(customOptions){var options=$.extend({},$.bsmSelect.conf,customOptions);return this.each(function(){var bsm=$(this).data("bsmSelect");if(!bsm){bsm=new BsmSelect($(this),options);$(this).data("bsmSelect",bsm)}})};$.bsmSelect={};$.extend($.bsmSelect,{effects:{show:function($el){$el.show()},remove:function($el){$el.remove()},highlight:function($select,$item,label,conf){var $highlight,id=$select.attr("id")+conf.highlightClass;$("#"+id).remove();$highlight=$("<span>",{"class":conf.highlightClass,id:id,html:label+$item.children("."+conf.listItemLabelClass).first().text()}).hide();$select.after($highlight.fadeIn("fast").delay(50).fadeOut("slow",function(){$(this).remove()}))},verticalListAdd:function($el){$el.animate({opacity:"show",height:"show"},100,function(){$(this).animate({height:"+=2px"},100,function(){$(this).animate({height:"-=2px"},100)})})},verticalListRemove:function($el){$el.animate({opacity:"hide",height:"hide"},100,function(){$(this).prev("li").animate({height:"-=2px"},100,function(){$(this).animate({height:"+=2px"},100)});$(this).remove()})}},plugins:{}});$.bsmSelect.conf={listType:"ol",showEffect:$.bsmSelect.effects.show,hideEffect:$.bsmSelect.effects.remove,highlightEffect:$.noop,addItemTarget:"bottom",hideWhenAdded:false,debugMode:false,title:"Select...",removeLabel:"remove",highlightAddedLabel:"Added: ",highlightRemovedLabel:"Removed: ",extractLabel:function($o){return $o.html()},plugins:[],containerClass:"bsmContainer",selectClass:"bsmSelect",optionDisabledClass:"bsmOptionDisabled",listClass:"bsmList",listItemClass:"bsmListItem",listItemLabelClass:"bsmListItemLabel",removeClass:"bsmListItemRemove",highlightClass:"bsmHighlight"}})(jQuery);Spider.defineWidget("Cms.ImageGalleryWidget",{autoInit:true,ready:function(){this.texts={startSlideshow:_("Play slideshow"),stopSlideshow:_("Stop slideshow")};var self=this;this.el.find("a").click(function(e){e.preventDefault();if(!self.editingEnabled){self.openGallery($(this).parent().index())}})},buildList:function(){var self=this;this.images=[];this.el.find(".img").each(function(){var imgDiv=$(this);var img=imgDiv.find("img");var a=imgDiv.find("a");var href=a.attr("href");var base=href.split("?")[0];self.images.push({base:base,thumb:base+"?v=micro",img:href,title:img.attr("title"),caption:imgDiv.find(".caption").text()})})},openGallery:function(cnt){var self=this;this.preloaded={};this.buildList();this.g={};this.g.div=$('<div class="img-gallery-overlay" />');this.prevScroll=[window.pageXOffset,window.pageYOffset];window.scrollTo(0,0);this.g.backdrop=$('<div class="img-gallery-backdrop" />').appendTo(this.g.div);this.prevBodyOverflow=$("body").css("overflow");$("body").css("overflow","hidden").append(this.g.div);this.g.thumbs=$('<div class="img-gallery-thumbs" />').appendTo(this.g.div);this.g.infoStrip=$('<div class="img-gallery-infostrip" />').appendTo(this.g.div);this.g.slideshowDiv=$('<div class="img-gallery-slideshow-but" />').appendTo(this.g.infoStrip);this.g.startSlideshowLink=$('<a href="#" >'+this.texts.startSlideshow+"</a>").click(function(e){e.preventDefault();self.toggleSlideshow()}).appendTo(this.g.slideshowDiv);this.g.cntDiv=$('<div class="img-gallery-cnt" />').appendTo(this.g.infoStrip);this.g.titleDiv=$('<div class="img-gallery-title" />').appendTo(this.g.infoStrip);this.g.container=$('<div class="img-container" />').appendTo(this.g.div);this.g.thumbsStrip=$('<div class="thumbs-strip" />').appendTo(this.g.div);this.g.div.append($('<div class="close-gallery" />').click(function(){self.closeGallery()}));this.g.imgLoader=$('<div class="img-loader" />').hide().appendTo(this.g.container);this.g.captionDivWrapper=$('<div class="img-gallery-caption-wrapper" />').appendTo(this.g.container);this.g.captionDiv=$('<span class="img-gallery-caption" />').appendTo(this.g.captionDivWrapper);this.g.bottomButtons=$('<div class="img-gallery-bottom-buttons" />').hide().appendTo(this.g.container);this.g.fullSizeButton=$('<a href="#" class="img-gallery-full-size" target="_blank"/>').text(_("Full size")).appendTo(this.g.bottomButtons);this.g.saveButton=$('<a href="#" class="img-gallery-save"/>').text(_("Save")).appendTo(this.g.bottomButtons);for(var i=0;i<this.images.length;i++){var img=this.images[i];this.g.thumbs.append($("<img />").attr({src:img.thumb}))}this.g.thumbs.delegate("img","click",function(){self.showImage($(this).index())});this.resizeContainer();$(window).bind("resize.cmsImageGallery",function(){self.resizeContainer()});this.g.container.delegate("img.img-gallery-main-img","mouseenter.imgGallery",function(e){self.g.bottomButtons.fadeIn(200)}).delegate("img.img-gallery-main-img","mouseleave.imgGallery",function(e){var rt=$(e.relatedTarget);if(rt.is(".img-gallery-bottom-buttons")||rt.parents().is(".img-gallery-bottom-buttons")){return}self.g.bottomButtons.fadeOut(200)});this.g.container.delegate("img.img-gallery-main-img","click.imgGallery",function(e){self.nextImage()});this.showImage(cnt)},closeGallery:function(){$("body").unbind("resize.cmsImageGallery");$("body").css("overflow",this.prevBodyOverflow);window.scrollTo(this.prevScroll[0],this.prevScroll[1]);this.stopSlideshow();this.g.div.remove()},showImage:function(cnt){this.currentImg=cnt;var self=this;var img=this.images[cnt];var curr=this.g.container.find("img");curr.remove();var image=$('<img class="img-gallery-main-img"/>').attr({src:img.img,title:img.title});this.g.container.append(image);this.g.container.find("img").bind("readystatechange load",function(){self.preloaded[cnt]=true;if(this.complete){self.preloadImages()}});this.g.thumbs.css("margin-left",-(39+(68*cnt)));this.g.thumbs.find("img.selected").removeClass("selected");this.g.thumbs.find("img:eq("+cnt+")").addClass("selected");this.g.cntDiv.text(_("%s of %s",cnt+1,this.images.length));this.g.titleDiv.text(img.title);this.g.captionDiv.text(img.caption);if(img.caption){this.g.captionDivWrapper.show()}else{this.g.captionDivWrapper.hide()}this.g.fullSizeButton.attr("href",img.base);this.g.saveButton.attr("href",img.base+"?dl")},preloadImages:function(){var self=this;var thW=this.g.thumbsStrip.width();var preload=[];this.g.thumbs.find("img").each(function(){var $this=$(this);if($this.position().top<10&&$this.offset().left<thW){var i=$this.index();if(!self.preloaded[i]){preload.push(self.images[i].img);self.preloaded[i]=true}}});$.imgpreload(preload,{})},resizeContainer:function(){var h=$(window).height();var sub=this.g.thumbs.height()+40;this.g.container.height(h-sub)},toggleSlideshow:function(){var self=this;if(this.slideshowTimeout){clearTimeout(this.slideshowTimeout);this.slideshowTimeout=null;this.g.startSlideshowLink.text(this.texts.startSlideshow)}else{var slideShowGo=function(){self.nextImage();self.slideshowTimeout=setTimeout(function(){slideShowGo()},5000)};self.slideshowTimeout=setTimeout(slideShowGo,3000);this.g.startSlideshowLink.text(this.texts.stopSlideshow)}},stopSlideshow:function(){if(this.slideshowTimeout){this.toggleSlideshow()}},nextImage:function(){var next=this.currentImg+1;if(next>=this.images.length){next=0}this.showImage(next)}});Spider.defineWidget("Cms.MenuWidget",{autoInit:true,ready:function(){var self=this;if(this.el.is(".container-only")){this.containerOnly=true}this.parentMenu=this.el.parents(".wdgt-Cms-MenuWidget").eq(0);if(this.el.is(".dropdown")||(this.parentMenu&&this.parentMenu.is(".dropdown"))){this.isDropDown=true}this.titleEl=this.el.find(">.title");if(this.titleEl.length==0){this.titleEl=this.el.parent().find(">.title")}if(this.isDropDown){this.titleEl.bind("mouseenter.menudropdown",function(e){self.showDropDown()})}},showDropDown:function(){var self=this;if(this.editingEnabled){return}if(this.dropDownShown){return}this.dropDownShown=true;var title=this.titleEl;var titlePos=title.offset();var ul=this.el.find(">ul.section").clone();this.dropDownUL=ul;ul.css({position:"absolute",left:titlePos.left,top:titlePos.top+title.outerHeight()-5,"min-width":title.outerWidth()});ul.addClass("dropdown");ul.show().appendTo($("body"));title.bind("mouseleave.dropdown",function(e){self.hideDropDown(e)});ul.mouseleave(function(e){self.hideDropDown(e)})},hideDropDown:function(e){var self=this;if(!this.dropDownShown){return}var title=this.titleEl;if(e.relatedTarget==title[0]||e.relatedTarget==this.dropDownUL[0]){return}if($.contains(this.dropDownUL[0],e.relatedTarget)){return}if($.contains(this.titleEl[0],e.relatedTarget)){return}this.dropDownUL.fadeOut("fast",function(){self.dropDownUL.remove()});title.unbind("mouseleave.dropdown");this.dropDownShown=false}});$("body").addClass("js-enabled");$(document).ready(function(){if($("body").is(".editing")){var bottomNewsHeight;var bottomNews=$("#bottom-news");Cms.on("activateLayoutEditMode",function(){bottomNewsHeight=bottomNews.css("height");bottomNews.height("auto");bottomNews.find(".blocco").height("auto");$("#bottom-center").addClass("editing-enabled");restoreNews()});Cms.on("deactivateLayoutEditMode",function(){bottomNews.height(bottomNewsHeight);bottomNews.find(".blocco").height(bottomNewsHeight);$("#bottom-center").removeClass("editing-enabled");truncateNews()})}else{newsListCycle($("#notizie_bottom_sx ul"));newsListCycle($("#notizie_bottom_dx ul"))}$("#bottom-center ul").show();truncateNews();var strCerca="Cerca";$("#cerca-text").val(strCerca).addClass("idle");$("#cerca-text").focus(function(e){if($("#cerca-text").val()==strCerca){$("#cerca-text").removeClass("idle");$("#cerca-text").val("")}}).blur(function(e){if(!$("#cerca-text").val()){$("#cerca-text").val(strCerca);$("#cerca-text").addClass("idle")}})});var truncateNews=function(){var link=$("#bottom-center").find(".link-text a").attr("href");$("#bottom-center").find("li.news_list").each(function(){var li=$(this);var trunc=li.find(".text").truncate({max_length:90,link:link})});if(link){$("#bottom-center").find("span.more").css("cursor","pointer").click(function(e){document.location=link})}};var restoreNews=function(){$("#bottom-center").find("li.news_list").each(function(){$(this).find(".text.truncated").remove();$(this).find(".text").show()})};function newsListCycle(list){if(list.find(">li").length<2){return}var isOver=false;list.mouseenter(function(){isOver=true}).mouseleave(function(){isOver=false});list.find(">li:not(:first)").hide();var curr=list.find(">li:first");var first=curr;curr.show();var prev=list.find(">li:last");var pos=curr.position();curr.position(pos);curr.css("position","absolute");curr.css("z-index",100);var cycleNext=function(){if(!isOver){var prev=curr;curr=curr.next();if(curr.length==0){curr=first}var pos=curr.position();curr.hide().css("z-index",100);prev.show().css("z-index",99);curr.css("position","absolute").position(prev.position());prev.fadeOut(2000);curr.fadeIn(2000)}setTimeout(cycleNext,8000)};setTimeout(cycleNext,8000)}(function($){var trailing_whitespace=true;$.fn.truncate=function(options){var opts=$.extend({},$.fn.truncate.defaults,options);var truncated=null;$(this).each(function(){var content_length=$.trim(squeeze($(this).text())).length;if(content_length<=opts.max_length){return}var actual_max_length=opts.max_length-opts.more.length-3;var truncated_node=recursivelyTruncate(this,actual_max_length);var full_node=$(this).hide();truncated_node.addClass("truncated").insertAfter(full_node)})};$.fn.truncate.defaults={max_length:100,more:"â€¦more",less:"less"};function recursivelyTruncate(node,max_length){return(node.nodeType==3)?truncateText(node,max_length):truncateNode(node,max_length)}function truncateNode(node,max_length){var node=$(node);if(node.is(":hidden")){return new_node}var new_node=node.clone().empty();var truncatedChild;node.contents().each(function(){var remaining_length=max_length-new_node.text().length;if(remaining_length==0){return}truncatedChild=recursivelyTruncate(this,remaining_length);if(truncatedChild){new_node.append(truncatedChild)}});return new_node}function truncateText(node,max_length){var text=squeeze(node.data);if(trailing_whitespace){text=text.replace(/^ /,"")}trailing_whitespace=!!text.match(/ $/);var mustCut=(text.length>0&&text.length>max_length);var doTrim=mustCut;if(mustCut){var lastChar=text.charAt(max_length);if(lastChar==" "){doTrim=false}}var text=text.slice(0,max_length);if(doTrim){while(text.length>0&&text.charAt(text.length-1)!=" "){text=text.slice(0,text.length-2)}text=text.slice(0,text.length-2)}textDiv=$("<div/>").text(text);if(mustCut){textDiv.append($('<span class="more">...</span>'))}text=textDiv.html();return text}function squeeze(string){return string.replace(/\s+/g," ")}function findNodeForMore(node){var $node=$(node);var last_child=$node.children(":last");if(!last_child){return node}var display=last_child.css("display");if(!display||display=="inline"){return $node}return findNodeForMore(last_child)}function findNodeForLess(node){var $node=$(node);var last_child=$node.children(":last");if(last_child&&last_child.is("p")){return last_child}return node}})(jQuery);
