var Prototype={Version:"1.6.0",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==
document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;if(Prototype.Browser.WebKit)Prototype.BrowserFeatures.XPath=false;
var Class={create:function(){function a(){this.initialize.apply(this,arguments)}var b=null,c=$A(arguments);if(Object.isFunction(c[0]))b=c.shift();Object.extend(a,Class.Methods);a.superclass=b;a.subclasses=[];if(b){var d=function(){};d.prototype=b.prototype;a.prototype=new d;b.subclasses.push(a)}for(b=0;b<c.length;b++)a.addMethods(c[b]);if(!a.prototype.initialize)a.prototype.initialize=Prototype.emptyFunction;return a.prototype.constructor=a}};
Class.Methods={addMethods:function(a){var b=this.superclass&&this.superclass.prototype,c=Object.keys(a);Object.keys({toString:true}).length||c.push("toString","valueOf");for(var d=0,e=c.length;d<e;d++){var h=c[d],k=a[h];if(b&&Object.isFunction(k)&&k.argumentNames().first()=="$super"){var p=k;k=Object.extend(function(o){return function(){return b[o].apply(this,arguments)}}(h).wrap(p),{valueOf:function(){return p},toString:function(){return p.toString()}})}this.prototype[h]=k}return this}};
var Abstract={};Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a};
Object.extend(Object,{inspect:function(a){try{if(a===undefined)return"undefined";if(a===null)return"null";return a.inspect?a.inspect():a.toString()}catch(b){if(b instanceof RangeError)return"...";throw b;}},toJSON:function(a){switch(typeof a){case "undefined":case "function":case "unknown":return;case "boolean":return a.toString()}if(a===null)return"null";if(a.toJSON)return a.toJSON();if(!Object.isElement(a)){var b=[];for(var c in a){var d=Object.toJSON(a[c]);d!==undefined&&b.push(c.toJSON()+": "+
d)}return"{"+b.join(", ")+"}"}},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var b=[];for(var c in a)b.push(c);return b},values:function(a){var b=[];for(var c in a)b.push(a[c]);return b},clone:function(a){return Object.extend({},a)},isElement:function(a){return a&&a.nodeType==1},isArray:function(a){return a&&a.constructor===Array},isHash:function(a){return a instanceof Hash},isFunction:function(a){return typeof a==
"function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});
Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&arguments[0]===undefined)return this;var a=this,b=$A(arguments),c=b.shift();return function(){return a.apply(c,b.concat($A(arguments)))}},bindAsEventListener:function(){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[d||window.event].concat(b))}},curry:function(){if(!arguments.length)return this;
var a=this,b=$A(arguments);return function(){return a.apply(this,b.concat($A(arguments)))}},delay:function(){var a=this,b=$A(arguments),c=b.shift()*1E3;return window.setTimeout(function(){return a.apply(a,b)},c)},wrap:function(a){var b=this;return function(){return a.apply(this,[b.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized)return this._methodized;var a=this;return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))}}});
Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){for(var a,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a}};RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};
var PeriodicalExecuter=Class.create({initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},execute:function(){this.callback(this)},stop:function(){if(this.timer){clearInterval(this.timer);this.timer=null}},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.execute()}finally{this.currentlyExecuting=false}}});
Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(a,b){var c="",d=this,e;for(b=arguments.callee.prepareReplacement(b);d.length>0;)if(e=d.match(a)){c+=d.slice(0,e.index);c+=String.interpret(b(e));d=d.slice(e.index+e[0].length)}else{c+=d;d=""}return c},sub:function(a,b,c){b=this.gsub.prepareReplacement(b);c=c===undefined?1:c;return this.gsub(a,function(d){if(--c<0)return d[0];return b(d)})},scan:function(a,b){this.gsub(a,b);return String(this)},truncate:function(a,b){a=a||30;b=b===undefined?"...":b;return this.length>
a?this.slice(0,a-b.length)+b:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var a=new RegExp(Prototype.ScriptFragment,"img"),b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(c){return(c.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(a){return eval(a)})},
escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=new Element("div");a.innerHTML=this.stripTags();return a.childNodes[0]?a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue:""},toQueryParams:function(a){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b)return{};return b[1].split(a||"&").inject({},function(c,d){if((d=d.split("="))[0]){var e=decodeURIComponent(d.shift());d=d.length>
1?d.join("="):d[0];if(d!=undefined)d=decodeURIComponent(d);if(e in c){Object.isArray(c[e])||(c[e]=[c[e]]);c[e].push(d)}else c[e]=d}return c})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(a){return a<1?"":(new Array(a+1)).join(this)},camelize:function(){var a=this.split("-"),b=a.length;if(b==1)return a[0];for(var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):
a[0],d=1;d<b;d++)c+=a[d].charAt(0).toUpperCase()+a[d].substring(1);return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(a){var b=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,
16)});if(a)return'"'+b.replace(/"/g,'\\"')+'"';return"'"+b.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))},evalJSON:function(a){var b=this.unfilterJSON();try{if(!a||b.isJSON())return eval("("+b+")")}catch(c){}throw new SyntaxError("Badly formed JSON string: "+this.inspect());},include:function(a){return this.indexOf(a)>
-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(a,b){return(new Template(this,b)).evaluate(a)}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE)Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}});String.prototype.gsub.prepareReplacement=function(a){if(Object.isFunction(a))return a;var b=new Template(a);return function(c){return b.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML)div.appendChild(text);
var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(Object.isFunction(a.toTemplateReplacements))a=a.toTemplateReplacements();return this.template.gsub(this.pattern,function(b){if(a==null)return"";var c=b[1]||"";if(c=="\\")return b[2];var d=a,e=b[3],h=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=h.exec(e);if(b==null)return c;for(;b!=null;){var k=b[1].startsWith("[")?b[2].gsub("\\\\]","]"):b[1];d=d[k];if(null==d||""==
b[3])break;e=e.substring("["==b[3]?b[1].length:b[0].length);b=h.exec(e)}return c+String.interpret(d)}.bind(this))}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable={each:function(a,b){var c=0;a=a.bind(b);try{this._each(function(e){a(e,c++)})}catch(d){if(d!=$break)throw d;}return this},eachSlice:function(a,b,c){b=b?b.bind(c):Prototype.K;for(var d=-a,e=[],h=this.toArray();(d+=a)<h.length;)e.push(h.slice(d,d+a));return e.collect(b,c)},all:function(a,b){a=a?a.bind(b):Prototype.K;var c=true;this.each(function(d,e){c=c&&!!a(d,e);if(!c)throw $break;});return c},any:function(a,b){a=a?a.bind(b):Prototype.K;var c=false;this.each(function(d,e){if(c=
!!a(d,e))throw $break;});return c},collect:function(a,b){a=a?a.bind(b):Prototype.K;var c=[];this.each(function(d,e){c.push(a(d,e))});return c},detect:function(a,b){a=a.bind(b);var c;this.each(function(d,e){if(a(d,e)){c=d;throw $break;}});return c},findAll:function(a,b){a=a.bind(b);var c=[];this.each(function(d,e){a(d,e)&&c.push(d)});return c},grep:function(a,b,c){b=b?b.bind(c):Prototype.K;var d=[];if(Object.isString(a))a=new RegExp(a);this.each(function(e,h){a.match(e)&&d.push(b(e,h))});return d},
include:function(a){if(Object.isFunction(this.indexOf))if(this.indexOf(a)!=-1)return true;var b=false;this.each(function(c){if(c==a){b=true;throw $break;}});return b},inGroupsOf:function(a,b){b=b===undefined?null:b;return this.eachSlice(a,function(c){for(;c.length<a;)c.push(b);return c})},inject:function(a,b,c){b=b.bind(c);this.each(function(d,e){a=b(a,d,e)});return a},invoke:function(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})},max:function(a,b){a=a?a.bind(b):
Prototype.K;var c;this.each(function(d,e){d=a(d,e);if(c==undefined||d>=c)c=d});return c},min:function(a,b){a=a?a.bind(b):Prototype.K;var c;this.each(function(d,e){d=a(d,e);if(c==undefined||d<c)c=d});return c},partition:function(a,b){a=a?a.bind(b):Prototype.K;var c=[],d=[];this.each(function(e,h){(a(e,h)?c:d).push(e)});return[c,d]},pluck:function(a){var b=[];this.each(function(c){b.push(c[a])});return b},reject:function(a,b){a=a.bind(b);var c=[];this.each(function(d,e){a(d,e)||c.push(d)});return c},
sortBy:function(a,b){a=a.bind(b);return this.map(function(c,d){return{value:c,criteria:a(c,d)}}).sort(function(c,d){c=c.criteria;d=d.criteria;return c<d?-1:c>d?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var a=Prototype.K,b=$A(arguments);if(Object.isFunction(b.last()))a=b.pop();var c=[this].concat(b).map($A);return this.map(function(d,e){return a(c.pluck(e))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+
">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(a){if(!a)return[];if(a.toArray)return a.toArray();for(var b=a.length,c=new Array(b);b--;)c[b]=a[b];return c}
if(Prototype.Browser.WebKit)$A=function(a){if(!a)return[];if(!(Object.isFunction(a)&&a=="[object NodeList]")&&a.toArray)return a.toArray();for(var b=a.length,c=new Array(b);b--;)c[b]=a[b];return c};Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(a){for(var b=0,c=this.length;b<c;b++)a(this[b])},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(a,b){return a.concat(Object.isArray(b)?b.flatten():[b])})},without:function(){var a=$A(arguments);return this.select(function(b){return!a.include(b)})},reverse:function(a){return(a!==
false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(b,c,d){if(0==d||(a?b.last()!=c:!b.include(c)))b.push(c);return b})},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(c){return b===c})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){b=
Object.toJSON(b);b!==undefined&&a.push(b)});return"["+a.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach))Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){b||(b=0);var c=this.length;if(b<0)b=c+b;for(;b<c;b++)if(this[b]===a)return b;return-1};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(a,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;a=this.slice(0,b).reverse().indexOf(a);return a<0?a:b-a-1};
Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a))return[];return(a=a.strip())?a.split(/\s+/):[]}if(Prototype.Browser.Opera)Array.prototype.concat=function(){for(var a=[],b=0,c=this.length;b<c;b++)a.push(this[b]);b=0;for(c=arguments.length;b<c;b++)if(Object.isArray(arguments[b]))for(var d=0,e=arguments[b].length;d<e;d++)a.push(arguments[b][d]);else a.push(arguments[b]);return a};
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(a,b){b=this.toString(b||10);return"0".times(a-b.length)+b},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)}
var Hash=Class.create(Enumerable,function(){function a(b,c){if(Object.isUndefined(c))return b;return b+"="+encodeURIComponent(String.interpret(c))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(){var b=0,c=function(e){this.key=e};c.prototype.key="foo";for(var d in new c("bar"))b++;return b>1}()?function(b){var c=[];for(var d in this._object){var e=this._object[d];if(!c.include(d)){c.push(d);var h=[d,e];h.key=d;h.value=e;b(h)}}}:function(b){for(var c in this._object){var d=
this._object[c],e=[c,d];e.key=c;e.value=d;b(e)}},set:function(b,c){return this._object[b]=c},get:function(b){return this._object[b]},unset:function(b){var c=this._object[b];delete this._object[b];return c},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(b){var c=this.detect(function(d){return d.value===b});return c&&c.key},merge:function(b){return this.clone().update(b)},update:function(b){return(new Hash(b)).inject(this,
function(c,d){c.set(d.key,d.value);return c})},toQueryString:function(){return this.map(function(b){var c=encodeURIComponent(b.key);if((b=b.value)&&typeof b=="object")if(Object.isArray(b))return b.map(a.curry(c)).join("&");return a(c,b)}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}}());
Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(a,b,c){this.start=a;this.end=b;this.exclusive=c},_each:function(a){for(var b=this.start;this.include(b);){a(b);b=b.succ()}},include:function(a){if(a<this.start)return false;if(this.exclusive)return a<this.end;return a<=this.end}}),$R=function(a,b,c){return new ObjectRange(a,b,c)},Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||
false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){this.include(a)||this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,c,d){this.each(function(e){if(Object.isFunction(e[a]))try{e[a].apply(e,[b,c,d])}catch(h){}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});
Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))this.options.parameters=this.options.parameters.toQueryParams()}});
Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,c){$super(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;a=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){a._method=this.method;this.method="post"}this.parameters=a;if(a=Object.toQueryString(a))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+=
"&_=";try{var b=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);this.options.asynchronous&&this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?this.options.postBody||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:
"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(Object.isFunction(b.push))for(var c=0,d=b.length;c<d;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(h){a[h.key]=h.value})}for(var e in a)this.transport.setRequestHeader(e,a[e])},success:function(){var a=this.getStatus();return!a||a>=200&&a<300},getStatus:function(){try{return this.transport.status||
0}catch(a){return 0}},respondToReadyState:function(a){a=Ajax.Request.Events[a];var b=new Ajax.Response(this);if(a=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(c){this.dispatchException(c)}var d=b.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&d&&d.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))this.evalResponse()}try{(this.options["on"+
a]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+a,this,b,b.headerJSON)}catch(e){this.dispatchException(e)}if(a=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(a){this.dispatchException(a)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,
a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Response=Class.create({initialize:function(a){this.request=a;a=this.transport=a.transport;var b=this.readyState=a.readyState;if(b>2&&!Prototype.Browser.IE||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(a.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){a=a.responseXML;this.responseXML=a===undefined?null:a;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||
""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a)return null;a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON)}catch(b){this.request.dispatchException(b)}},
_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))return null;try{return this.transport.responseText.evalJSON(a.sanitizeJSON)}catch(b){this.request.dispatchException(b)}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,b,c,d){this.container={success:b.success||b,failure:b.failure||(b.success?null:b)};d=d||{};var e=d.onComplete;d.onComplete=function(h,k){this.updateContent(h.responseText);Object.isFunction(e)&&e(h,k)}.bind(this);$super(c,d)},updateContent:function(a){var b=this.container[this.success()?"success":"failure"],c=this.options;c.evalScripts||(a=a.stripScripts());if(b=$(b))if(c.insertion)if(Object.isString(c.insertion)){var d={};d[c.insertion]=
a;b.insert(d)}else c.insertion(b,a);else b.update(a);this.success()&&this.onComplete&&this.onComplete.bind(this).defer()}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,c,d){$super(d);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=b;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},
updateComplete:function(a){if(this.options.decay){this.decay=a.responseText==this.lastText?this.decay*this.options.decay:1;this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});
function $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(a,b){var c=[];a=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);b=0;for(var d=a.snapshotLength;b<d;b++)c.push(Element.extend(a.snapshotItem(b)));return c};if(!window.Node)var Node={};
Node.ELEMENT_NODE||Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});
(function(){var a=this.Element;this.Element=function(b,c){c=c||{};b=b.toLowerCase();var d=Element.cache;if(Prototype.Browser.IE&&c.name){b="<"+b+' name="'+c.name+'">';delete c.name;return Element.writeAttribute(document.createElement(b),c)}d[b]||(d[b]=Element.extend(document.createElement(b)));return Element.writeAttribute(d[b].cloneNode(false),c)};Object.extend(this.Element,a||{})}).call(window);Element.cache={};
Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b))return a.update().insert(b);b=Object.toHTML(b);a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();
return a},replace:function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c,d,e;for(position in b){c=b[position];position=position.toLowerCase();d=
Element._insertionTranslations[position];if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))d.insert(a,c);else{c=Object.toHTML(c);e=a.ownerDocument.createRange();d.initializeRange(a,e);d.insert(a,e.createContextualFragment(c.stripScripts()));c.evalScripts.bind(c).defer()}}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else b=Object.isString(b)?new Element(b,c):new Element("div",b);a.parentNode&&a.parentNode.replaceChild(b,a);b.appendChild(a);return b},
inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var d=c.first();c=c.last();if(d=(a[d]||"").toString())b+=" "+c+"="+d.inspect(true)});return b+">"},recursivelyCollect:function(a,b){a=$(a);for(var c=[];a=a[b];)a.nodeType==1&&c.push(Element.extend(a));return c},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*")).each(Element.extend)},firstDescendant:function(a){for(a=
$(a).firstChild;a&&a.nodeType!=1;)a=a.nextSibling;return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild))return[];for(;a&&a.nodeType!=1;)a=a.nextSibling;if(a)return[a].concat($(a).nextSiblings());return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(a,b){if(Object.isString(b))b=
new Selector(b);return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);var d=a.ancestors();return b?Selector.findElement(d,b,c):d[c||0]},down:function(a,b,c){a=$(a);if(arguments.length==1)return a.firstDescendant();var d=a.descendants();return b?Selector.findElement(d,b,c):d[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var d=a.previousSiblings();return b?Selector.findElement(d,b,c):d[c||0]},
next:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(a));var d=a.nextSiblings();return b?Selector.findElement(d,b,c):d[c||0]},select:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},adjacent:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(a){a=$(a);var b=a.readAttribute("id"),c=arguments.callee;if(b)return b;do b="anonymous_element_"+c.counter++;
while($(b));a.writeAttribute("id",b);return b},readAttribute:function(a,b){a=$(a);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b])return c.values[b](a,b);if(c.names[b])b=c.names[b];if(b.include(":"))return!a.attributes||!a.attributes[b]?null:a.attributes[b].value}return a.getAttribute(b)},writeAttribute:function(a,b,c){a=$(a);var d={},e=Element._attributeTranslations.write;if(typeof b=="object")d=b;else d[b]=c===undefined?true:c;for(var h in d){b=e.names[h]||h;c=
d[h];if(e.values[h])b=e.values[h](a,c);if(c===false||c===null)a.removeAttribute(b);else c===true?a.setAttribute(b,b):a.setAttribute(b,c)}return a},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(a=$(a)){a=a.className;return a.length>0&&(a==b||(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(a))}},addClassName:function(a,b){if(a=$(a)){a.hasClassName(b)||(a.className+=
(a.className?" ":"")+b);return a}},removeClassName:function(a,b){if(a=$(a)){a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a}},toggleClassName:function(a,b){if(a=$(a))return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)},cleanWhitespace:function(a){a=$(a);for(var b=a.firstChild;b;){var c=b.nextSibling;b.nodeType==3&&!/\S/.test(b.nodeValue)&&a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,b){a=
$(a);b=$(b);if(a.compareDocumentPosition)return(a.compareDocumentPosition(b)&8)===8;if(a.sourceIndex&&!Prototype.Browser.Opera){var c=a.sourceIndex,d=b.sourceIndex,e=b.nextSibling;if(!e){do b=b.parentNode;while(!(e=b.nextSibling)&&b.parentNode)}if(e)return c>d&&c<e.sourceIndex}for(;a=a.parentNode;)if(a==b)return true;return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=="float"?"cssFloat":b.camelize();var c=a.style[b];
if(!c)c=(a=document.defaultView.getComputedStyle(a,null))?a[b]:null;if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:c},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var c=a.style;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var d in b)if(d=="opacity")a.setOpacity(b[d]);else c[d=="float"||d=="cssFloat"?c.styleFloat===undefined?"cssFloat":"styleFloat":d]=b[d];
return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;return a},getDimensions:function(a){a=$(a);var b=$(a).getStyle("display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};b=a.style;var c=b.visibility,d=b.position,e=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var h=a.clientWidth;a=a.clientHeight;b.display=e;b.position=d;b.visibility=c;return{width:h,height:a}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,
"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow)return a;a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden")a.style.overflow="hidden";return a},undoClipping:function(a){a=
$(a);if(!a._overflow)return a;a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(c,b)},positionedOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a=a.offsetParent){if(a.tagName=="BODY")break;var d=Element.getStyle(a,"position");if(d=="relative"||d=="absolute")break}}while(a);return Element._returnOffset(c,b)},absolutize:function(a){a=
$(a);if(a.getStyle("position")!="absolute"){var b=a.positionedOffset(),c=b[1];b=b[0];var d=a.clientWidth,e=a.clientHeight;a._originalLeft=b-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=c+"px";a.style.left=b+"px";a.style.width=d+"px";a.style.height=e+"px";return a}},relativize:function(a){a=$(a);if(a.getStyle("position")!="relative"){a.style.position="relative";var b=parseFloat(a.style.top||
0)-(a._originalTop||0),c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=b+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a}},cumulativeScrollOffset:function(a){var b=0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(c,b)},getOffsetParent:function(a){if(a.offsetParent)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!=
"static")return $(a);return $(document.body)},viewportOffset:function(a){var b=0,c=0,d=a;do{b+=d.offsetTop||0;c+=d.offsetLeft||0;if(d.offsetParent==document.body&&Element.getStyle(d,"position")=="absolute")break}while(d=d.offsetParent);d=a;do if(!Prototype.Browser.Opera||d.tagName=="BODY"){b-=d.scrollTop||0;c-=d.scrollLeft||0}while(d=d.parentNode);return Element._returnOffset(c,b)},clonePosition:function(a,b,c){c=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},
c||{});b=$(b);var d=b.viewportOffset();a=$(a);var e=[0,0],h=null;if(Element.getStyle(a,"position")=="absolute"){h=a.getOffsetParent();e=h.viewportOffset()}if(h==document.body){e[0]-=document.body.offsetLeft;e[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=d[0]-e[0]+c.offsetLeft+"px";if(c.setTop)a.style.top=d[1]-e[1]+c.offsetTop+"px";if(c.setWidth)a.style.width=b.offsetWidth+"px";if(c.setHeight)a.style.height=b.offsetHeight+"px";return a}};Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(!document.createRange||Prototype.Browser.Opera)Element.Methods.insert=function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c=Element._insertionTranslations,d,e,h,k;for(e in b){d=b[e];e=e.toLowerCase();h=c[e];if(d&&d.toElement)d=d.toElement();if(Object.isElement(d))h.insert(a,d);else{d=Object.toHTML(d);k=(e=="before"||e=="after"?a.parentNode:a).tagName.toUpperCase();if(c.tags[k]){k=Element._getContentFromAnonymousElement(k,
d.stripScripts());if(e=="top"||e=="after")k.reverse();k.each(h.insert.curry(a))}else a.insertAdjacentHTML(h.adjacency,d.stripScripts());d.evalScripts.bind(d).defer()}}return a};
if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(a,b){switch(b){case "left":case "top":case "right":case "bottom":if(Element._getStyle(a,"position")=="static")return null;default:return Element._getStyle(a,b)}};Element.Methods._readAttribute=Element.Methods.readAttribute;Element.Methods.readAttribute=function(a,b){if(b=="title")return a.title;return Element._readAttribute(a,b)}}else if(Prototype.Browser.IE){$w("positionedOffset getOffsetParent viewportOffset").each(function(a){Element.Methods[a]=
Element.Methods[a].wrap(function(b,c){c=$(c);var d=c.getStyle("position");if(d!="static")return b(c);c.setStyle({position:"relative"});b=b(c);c.setStyle({position:d});return b})});Element.Methods.getStyle=function(a,b){a=$(a);b=b=="float"||b=="cssFloat"?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle)c=a.currentStyle[b];if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(c[1])return parseFloat(c[1])/100;return 1}if(c=="auto"){if((b=="width"||b=="height")&&
a.getStyle("display")!="none")return a["offset"+b.capitalize()]+"px";return null}return c};Element.Methods.setOpacity=function(a,b){function c(h){return h.replace(/alpha\([^\)]*\)/gi,"")}a=$(a);var d=a.currentStyle;if(d&&!d.hasLayout||!d&&a.style.zoom=="normal")a.style.zoom=1;d=a.getStyle("filter");var e=a.style;if(b==1||b===""){(d=c(d))?(e.filter=d):e.removeAttribute("filter");return a}else if(b<1.0E-5)b=0;e.filter=c(d)+"alpha(opacity="+b*100+")";return a};Element._attributeTranslations={read:{names:{"class":"className",
"for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,b){return(a=a.getAttributeNode(b))?a.value:""},_getEv:function(a,b){return(b=a.getAttribute(b))?b.toString().slice(23,-2):null},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){return a.title}}}};Element._attributeTranslations.write={names:Object.clone(Element._attributeTranslations.read.names),values:{checked:function(a,
b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,
onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values)}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent))Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=
b==1?0.999999:b===""?"":b<1.0E-5?0:b;return a};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;if(b==1)if(a.tagName=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(d){}return a};Element.Methods.cumulativeOffset=function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,"position")=="absolute")break;
a=a.offsetParent}while(a);return Element._returnOffset(c,b)}}
if(Prototype.Browser.IE||Prototype.Browser.Opera)Element.Methods.update=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b))return a.update().insert(b);b=Object.toHTML(b);var c=a.tagName.toUpperCase();if(c in Element._insertionTranslations.tags){$A(a.childNodes).each(function(d){a.removeChild(d)});Element._getContentFromAnonymousElement(c,b.stripScripts()).each(function(d){a.appendChild(d)})}else a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a};
if(document.createElement("div").outerHTML)Element.Methods.replace=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b)){a.parentNode.replaceChild(b,a);return a}b=Object.toHTML(b);var c=a.parentNode,d=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[d]){var e=a.next();d=Element._getContentFromAnonymousElement(d,b.stripScripts());c.removeChild(a);e?d.each(function(h){c.insertBefore(h,e)}):d.each(function(h){c.appendChild(h)})}else a.outerHTML=b.stripScripts();
b.evalScripts.bind(b).defer();return a};Element._returnOffset=function(a,b){var c=[a,b];c.left=a;c.top=b;return c};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div");a=Element._insertionTranslations.tags[a];c.innerHTML=a[0]+b+a[1];a[2].times(function(){c=c.firstChild});return $A(c.childNodes)};
Element._insertionTranslations={before:{adjacency:"beforeBegin",insert:function(a,b){a.parentNode.insertBefore(b,a)},initializeRange:function(a,b){b.setStartBefore(a)}},top:{adjacency:"afterBegin",insert:function(a,b){a.insertBefore(b,a.firstChild)},initializeRange:function(a,b){b.selectNodeContents(a);b.collapse(true)}},bottom:{adjacency:"beforeEnd",insert:function(a,b){a.appendChild(b)}},after:{adjacency:"afterEnd",insert:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},initializeRange:function(a,
b){b.setStartAfter(a)}},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){this.bottom.initializeRange=this.top.initializeRange;Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);
Element.Methods.Simulated={hasAttribute:function(a,b){b=Element._attributeTranslations.has[b]||b;return(a=$(a).getAttributeNode(b))&&a.specified}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}
Element.extend=function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)return Prototype.K;var a={},b=Element.Methods.ByTag,c=Object.extend(function(d){if(!d||d._extendedByPrototype||d.nodeType!=1||d==window)return d;var e=Object.clone(a),h=d.tagName,k;b[h]&&Object.extend(e,b[h]);for(k in e){h=e[k];if(Object.isFunction(h)&&!(k in d))d[k]=h.methodize()}d._extendedByPrototype=Prototype.emptyFunction;return d},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,
Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});c.refresh();return c}();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};
Element.addMethods=function(a){function b(o){o=o.toUpperCase();Element.Methods.ByTag[o]||(Element.Methods.ByTag[o]={});Object.extend(Element.Methods.ByTag[o],a)}function c(o,j,t){t=t||false;for(var r in o){var u=o[r];if(Object.isFunction(u))if(!t||!(r in j))j[r]=u.methodize()}}function d(o){var j,t={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",
Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(t[o])j="HTML"+t[o]+"Element";if(window[j])return window[j];j="HTML"+o+"Element";if(window[j])return window[j];j="HTML"+o.capitalize()+"Element";if(window[j])return window[j];window[j]={};window[j].prototype=document.createElement(o).__proto__;
return window[j]}var e=Prototype.BrowserFeatures,h=Element.Methods.ByTag;if(!a){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var k=a;a=arguments[1]}if(k)Object.isArray(k)?k.each(b):b(k);else Object.extend(Element.Methods,a||{});if(e.ElementExtensions){c(Element.Methods,
HTMLElement.prototype);c(Element.Methods.Simulated,HTMLElement.prototype,true)}if(e.SpecificElementExtensions)for(var p in Element.Methods.ByTag){e=d(p);Object.isUndefined(e)||c(h[p],e.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};
document.viewport={getDimensions:function(){var a={};$w("width height").each(function(b){var c=b.capitalize();a[b]=self["inner"+c]||document.documentElement["client"+c]||document.body["client"+c]});return a},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||
document.body.scrollTop)}};
var Selector=Class.create({initialize:function(a){this.expression=a.strip();this.compileMatcher()},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!/(\[[\w-]*?:|:checked)/.test(this.expression))return this.compileXPathMatcher();var a=this.expression,b=Selector.patterns,c=Selector.criteria,d,e;if(Selector._cache[a])this.matcher=Selector._cache[a];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];a&&d!=a&&/\S/.test(a);){d=a;
for(var h in b){e=b[h];if(e=a.match(e)){this.matcher.push(Object.isFunction(c[h])?c[h](e):(new Template(c[h])).evaluate(e));a=a.replace(e[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var a=this.expression,b=Selector.patterns,c=Selector.xpath,d,e;if(Selector._cache[a])this.xpath=Selector._cache[a];else{for(this.matcher=[".//*"];a&&d!=a&&/\S/.test(a);){d=a;for(var h in b)if(e=a.match(b[h])){this.matcher.push(Object.isFunction(c[h])?
c[h](e):(new Template(c[h])).evaluate(e));a=a.replace(e[0],"");break}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(a){a=a||document;if(this.xpath)return document._getElementsByXPath(this.xpath,a);return this.matcher(a)},match:function(a){this.tokens=[];for(var b=this.expression,c=Selector.patterns,d=Selector.assertions,e,h;b&&e!==b&&/\S/.test(b);){e=b;for(var k in c){h=c[k];if(h=b.match(h))if(d[k]){this.tokens.push([k,Object.clone(h)]);b=b.replace(h[0],
"")}else return this.findElements(document).include(a)}}b=true;for(k=0;d=this.tokens[k];k++){c=d[0];d=d[1];if(!Selector.assertions[c](a,d)){b=false;break}}return b},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*")return"";return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(a){a[3]=a[5]||a[6];return(new Template(Selector.xpath.operators[a[2]])).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];
if(!b)return"";if(Object.isFunction(b))return b(a);return(new Template(Selector.xpath.pseudos[a[1]])).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]",
"only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(a){for(var b=a[6],c=Selector.patterns,d=Selector.xpath,e,h,k=[];b&&e!=b&&/\S/.test(b);){e=b;for(var p in c)if(a=b.match(c[p])){h=Object.isFunction(d[p])?d[p](a):(new Template(d[p])).evaluate(a);k.push("("+h.substring(1,h.length-1)+")");b=b.replace(a[0],"");break}}return"[not("+
k.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]=
"1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(a,b){var c=b[6];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";if(b=c.match(/^(\d+)$/))return"["+a+"= "+b[1]+"]";if(b=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(b[1]=="-")b[1]=-1;c=b[1]?Number(b[1]):1;b=b[2]?Number(b[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:a,
a:c,b:b})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(a){a[3]=a[5]||a[6];return(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;')).evaluate(a)},pseudo:function(a){if(a[6])a[6]=a[6].replace(/"/g,'\\"');return(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(a)},
descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},
assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(a,b){a=Element.readAttribute(a,b[1]);return Selector.operators[b[2]](a,b[3])}},handlers:{concat:function(a,b){for(var c=0,d;d=b[c];c++)a.push(d);return a},mark:function(a){for(var b=0,c;c=a[b];b++)c._counted=true;return a},unmark:function(a){for(var b=
0,c;c=a[b];b++)c._counted=undefined;return a},index:function(a,b,c){a._counted=true;if(b){a=a.childNodes;b=a.length-1;for(var d=1;b>=0;b--){var e=a[b];if(e.nodeType==1&&(!c||e._counted))e.nodeIndex=d++}}else{b=0;d=1;for(a=a.childNodes;e=a[b];b++)if(e.nodeType==1&&(!c||e._counted))e.nodeIndex=d++}},unique:function(a){if(a.length==0)return a;for(var b=[],c,d=0,e=a.length;d<e;d++)if(!(c=a[d])._counted){c._counted=true;b.push(Element.extend(c))}return Selector.handlers.unmark(b)},descendant:function(a){for(var b=
Selector.handlers,c=0,d=[],e;e=a[c];c++)b.concat(d,e.getElementsByTagName("*"));return d},child:function(a){for(var b=0,c=[],d;d=a[b];b++)for(var e=0,h;h=d.childNodes[e];e++)h.nodeType==1&&h.tagName!="!"&&c.push(h);return c},adjacent:function(a){for(var b=0,c=[],d;d=a[b];b++)(d=this.nextElementSibling(d))&&c.push(d);return c},laterSibling:function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)b.concat(d,Element.nextSiblings(e));return d},nextElementSibling:function(a){for(;a=a.nextSibling;)if(a.nodeType==
1)return a;return null},previousElementSibling:function(a){for(;a=a.previousSibling;)if(a.nodeType==1)return a;return null},tagName:function(a,b,c,d){c=c.toUpperCase();var e=[],h=Selector.handlers;if(a){if(d){if(d=="descendant"){for(b=0;d=a[b];b++)h.concat(e,d.getElementsByTagName(c));return e}else a=this[d](a);if(c=="*")return a}for(b=0;d=a[b];b++)d.tagName.toUpperCase()==c&&e.push(d);return e}else return b.getElementsByTagName(c)},id:function(a,b,c,d){c=$(c);var e=Selector.handlers;if(!c)return[];
if(!a&&b==document)return[c];if(a){if(d)if(d=="child")for(b=0;d=a[b];b++){if(c.parentNode==d)return[c]}else if(d=="descendant")for(b=0;d=a[b];b++){if(Element.descendantOf(c,d))return[c]}else if(d=="adjacent")for(b=0;d=a[b];b++){if(Selector.handlers.previousElementSibling(c)==d)return[c]}else a=e[d](a);for(b=0;d=a[b];b++)if(d==c)return[c];return[]}return c&&Element.descendantOf(c,b)?[c]:[]},className:function(a,b,c,d){if(a&&d)a=this[d](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,
b,c){a||(a=Selector.handlers.descendant([b]));b=" "+c+" ";for(var d=0,e=[],h,k;h=a[d];d++){k=h.className;if(k.length!=0)if(k==c||(" "+k+" ").include(b))e.push(h)}return e},attrPresence:function(a,b,c){a||(a=b.getElementsByTagName("*"));b=[];for(var d=0,e;e=a[d];d++)Element.hasAttribute(e,c)&&b.push(e);return b},attr:function(a,b,c,d,e){a||(a=b.getElementsByTagName("*"));b=Selector.operators[e];e=[];for(var h=0,k;k=a[h];h++){var p=Element.readAttribute(k,c);p!==null&&b(p,d)&&e.push(k)}return e},pseudo:function(a,
b,c,d,e){if(a&&e)a=this[e](a);a||(a=d.getElementsByTagName("*"));return Selector.pseudos[b](a,c,d)}},pseudos:{"first-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.previousElementSibling(d)||c.push(d);return c},"last-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.nextElementSibling(d)||c.push(d);return c},"only-child":function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)!b.previousElementSibling(e)&&!b.nextElementSibling(e)&&d.push(e);return d},"nth-child":function(a,
b,c){return Selector.pseudos.nth(a,b,c)},"nth-last-child":function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},"nth-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},"nth-last-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},"first-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,false,true)},"last-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},"only-of-type":function(a,b,c){var d=Selector.pseudos;return d["last-of-type"](d["first-of-type"](a,
b,c),b,c)},getIndices:function(a,b,c){if(a==0)return b>0?[b]:[];return $R(1,c).inject([],function(d,e){0==(e-b)%a&&(e-b)/a>=0&&d.push(e);return d})},nth:function(a,b,c,d,e){if(a.length==0)return[];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";c=Selector.handlers;var h=[],k=[],p;c.mark(a);for(var o=0;p=a[o];o++)if(!p.parentNode._counted){c.index(p.parentNode,d,e);k.push(p.parentNode)}if(b.match(/^\d+$/)){b=Number(b);for(o=0;p=a[o];o++)p.nodeIndex==b&&h.push(p)}else if(p=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(p[1]==
"-")p[1]=-1;o=p[1]?Number(p[1]):1;p=p[2]?Number(p[2]):0;b=Selector.pseudos.getIndices(o,p,a.length);o=0;for(d=b.length;p=a[o];o++)for(e=0;e<d;e++)p.nodeIndex==b[e]&&h.push(p)}c.unmark(a);c.unmark(k);return h},empty:function(a){for(var b=0,c=[],d;d=a[b];b++)d.tagName=="!"||d.firstChild&&!d.innerHTML.match(/^\s*$/)||c.push(d);return c},not:function(a,b,c){var d=Selector.handlers;b=(new Selector(b)).findElements(c);d.mark(b);c=0;for(var e=[],h;h=a[c];c++)h._counted||e.push(h);d.unmark(b);return e},enabled:function(a){for(var b=
0,c=[],d;d=a[b];b++)d.disabled||c.push(d);return c},disabled:function(a){for(var b=0,c=[],d;d=a[b];b++)d.disabled&&c.push(d);return c},checked:function(a){for(var b=0,c=[],d;d=a[b];b++)d.checked&&c.push(d);return c}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a.startsWith(b)},"$=":function(a,b){return a.endsWith(b)},"*=":function(a,b){return a.include(b)},"~=":function(a,b){return(" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return("-"+
a.toUpperCase()+"-").include("-"+b.toUpperCase()+"-")}},matchElements:function(a,b){b=(new Selector(b)).findElements();var c=Selector.handlers;c.mark(b);for(var d=0,e=[],h;h=a[d];d++)h._counted&&e.push(h);c.unmark(b);return e},findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){var c=b.join(",");b=[];c.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(p){b.push(p[1].strip())});c=[];for(var d=Selector.handlers,
e=0,h=b.length,k;e<h;e++){k=new Selector(b[e].strip());d.concat(c,k.findElements(a))}return h>1?d.unique(c):c}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(a){$(a).reset();return a},serializeElements:function(a,b){if(typeof b!="object")b={hash:!!b};else if(b.hash===undefined)b.hash=true;var c,d,e=false,h=b.submit;a=a.inject({},function(k,p){if(!p.disabled&&p.name){c=p.name;d=$(p).getValue();if(d!=null&&(p.type!="submit"||!e&&h!==false&&(!h||c==h)&&(e=true)))if(c in k){Object.isArray(k[c])||(k[c]=[k[c]]);k[c].push(d)}else k[c]=d}return k});return b.hash?a:Object.toQueryString(a)}};
Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){Form.Element.Serializers[c.tagName.toLowerCase()]&&b.push(Element.extend(c));return b})},getInputs:function(a,b,c){a=$(a);a=a.getElementsByTagName("input");if(!b&&!c)return $A(a).map(Element.extend);for(var d=0,e=[],h=a.length;d<h;d++){var k=a[d];b&&k.type!=b||c&&k.name!=c||e.push(Element.extend(k))}return e},disable:function(a){a=
$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(a){a=$(a).getElements().findAll(function(c){return"hidden"!=c.type&&!c.disabled});var b=a.findAll(function(c){return c.hasAttribute("tabIndex")&&c.tabIndex>=0}).sortBy(function(c){return c.tabIndex}).first();return b?b:a.find(function(c){return["input","select","textarea"].include(c.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();
return a},request:function(a,b){a=$(a);b=Object.clone(b||{});var c=b.parameters,d=a.readAttribute("action")||"";if(d.blank())d=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute("method")&&!b.method)b.method=a.method;return new Ajax.Request(d,b)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};
Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();
if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type)))a.select()}catch(b){}return a},disable:function(a){a=$(a);a.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element,$F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(b===undefined)return a.checked?a.value:null;else a.checked=!!b},textarea:function(a,b){if(b===undefined)return a.value;else a.value=b},select:function(a,b){if(b===undefined)return this[a.type=="select-one"?"selectOne":"selectMany"](a);else for(var c,d,e=!Object.isArray(b),
h=0,k=a.length;h<k;h++){c=a.options[h];d=this.optionValue(c);if(e){if(d==b){c.selected=true;return}}else c.selected=b.include(d)}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,c=a.length;if(!c)return null;var d=0;for(b=[];d<c;d++){var e=a.options[d];e.selected&&b.push(this.optionValue(e))}return b},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,d){$super(d,c);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});
Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});
Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type)switch(a.type.toLowerCase()){case "checkbox":case "radio":Event.observe(a,
"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event)var Event={};
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(a){switch(a.type){case "mouseover":a=a.fromElement;break;case "mouseout":a=a.toElement;break;default:return null}return Element.extend(a)}});
Event.Methods=function(){var a;if(Prototype.Browser.IE){var b={0:1,1:4,2:2};a=function(c,d){return c.button==b[d]}}else a=Prototype.Browser.WebKit?function(c,d){switch(d){case 0:return c.which==1&&!c.metaKey;case 1:return c.which==1&&c.metaKey;default:return false}}:function(c,d){return c.which?c.which===d+1:c.button===d};return{isLeftClick:function(c){return a(c,0)},isMiddleClick:function(c){return a(c,1)},isRightClick:function(c){return a(c,2)},element:function(c){c=Event.extend(c).target;return Element.extend(c.nodeType==
Node.TEXT_NODE?c.parentNode:c)},findElement:function(c,d){c=Event.element(c);return c.match(d)?c:c.up(d)},pointer:function(c){return{x:c.pageX||c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft),y:c.pageY||c.clientY+(document.documentElement.scrollTop||document.body.scrollTop)}},pointerX:function(c){return Event.pointer(c).x},pointerY:function(c){return Event.pointer(c).y},stop:function(c){Event.extend(c);c.preventDefault();c.stopPropagation();c.stopped=true}}}();
Event.extend=function(){var a=Object.keys(Event.Methods).inject({},function(b,c){b[c]=Event.Methods[c].methodize();return b});if(Prototype.Browser.IE){Object.extend(a,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(b){if(!b)return false;if(b._extendedByPrototype)return b;b._extendedByPrototype=Prototype.emptyFunction;var c=Event.pointer(b);Object.extend(b,{target:b.srcElement,relatedTarget:Event.relatedTarget(b),
pageX:c.x,pageY:c.y});return Object.extend(b,a)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,a);return Prototype.K}}();
Object.extend(Event,function(){function a(j){if(j._eventID)return j._eventID;arguments.callee.id=arguments.callee.id||1;return j._eventID=++arguments.callee.id}function b(j){if(j&&j.include(":"))return"dataavailable";return j}function c(j){return o[j]=o[j]||{}}function d(j,t){j=c(j);return j[t]=j[t]||[]}function e(j,t,r){var u=a(j);u=d(u,t);if(u.pluck("handler").include(r))return false;var y=function(v){if(!Event||!Event.extend||v.eventName&&v.eventName!=t)return false;Event.extend(v);r.call(j,v)};
y.handler=r;u.push(y);return y}function h(j,t,r){return d(j,t).find(function(u){return u.handler==r})}function k(j,t,r){var u=c(j);if(!u[t])return false;u[t]=u[t].without(h(j,t,r))}function p(){for(var j in o)for(var t in o[j])o[j][t]=null}var o=Event.cache;window.attachEvent&&window.attachEvent("onunload",p);return{observe:function(j,t,r){j=$(j);var u=b(t);t=e(j,t,r);if(!t)return j;j.addEventListener?j.addEventListener(u,t,false):j.attachEvent("on"+u,t);return j},stopObserving:function(j,t,r){j=
$(j);var u=a(j),y=b(t);if(!r&&t){d(u,t).each(function(z){j.stopObserving(t,z.handler)});return j}else if(!t){Object.keys(c(u)).each(function(z){j.stopObserving(z)});return j}var v=h(u,t,r);if(!v)return j;j.removeEventListener?j.removeEventListener(y,v,false):j.detachEvent("on"+y,v);k(u,t,r);return j},fire:function(j,t,r){j=$(j);if(j==document&&document.createEvent&&!j.dispatchEvent)j=document.documentElement;if(document.createEvent){var u=document.createEvent("HTMLEvents");u.initEvent("dataavailable",
true,true)}else{u=document.createEventObject();u.eventType="ondataavailable"}u.eventName=t;u.memo=r||{};document.createEvent?j.dispatchEvent(u):j.fireEvent(u.eventType,u);return u}}}());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});
(function(){function a(){if(!c){b&&window.clearInterval(b);document.fire("dom:loaded");c=true}}var b,c=false;if(document.addEventListener)if(Prototype.Browser.WebKit){b=window.setInterval(function(){/loaded|complete/.test(document.readyState)&&a()},0);Event.observe(window,"load",a)}else document.addEventListener("DOMContentLoaded",a,false);else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=
null;a()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||
document.documentElement.scrollTop||document.body.scrollTop||0},within:function(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,b,c){var d=Element.cumulativeScrollOffset(a);this.xcomp=b+d[0]-this.deltaX;this.ycomp=c+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);
return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(a,b){if(!a)return 0;if(a=="vertical")return(this.offset[1]+b.offsetHeight-this.ycomp)/b.offsetHeight;if(a=="horizontal")return(this.offset[0]+b.offsetWidth-this.xcomp)/b.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},
relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(a){function b(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}a.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,d){d=d.toString().strip();return(d=/\s/.test(d)?$w(d).map(b).join(""):b(d))?document._getElementsByXPath(".//*"+d,c):[]}:function(c,d){d=d.toString().strip();var e=[],h=/\s/.test(d)?$w(d):null;if(!h&&!d)return e;c=$(c).getElementsByTagName("*");d=" "+d+" ";for(var k=
0,p,o;p=c[k];k++)if(p.className&&(o=" "+p.className+" ")&&(o.include(d)||h&&h.all(function(j){return!j.toString().blank()&&o.include(" "+j+" ")})))e.push(Element.extend(p));return e};return function(c,d){return $(d||document.body).getElementsByClassName(c)}}(Element.Methods);Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){this.include(a)||this.set($A(this).concat(a).join(" "))},remove:function(a){this.include(a)&&this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();window.SAPO=typeof SAPO=="undefined"?{}:window.SAPO;SAPO.namespace=function(a){if(!a||!a.length)return null;a=a.split(".");for(var b=SAPO,c=a[0]=="SAPO"?1:0;c<a.length;++c){b[a[c]]=b[a[c]]||{};b=b[a[c]]}return b};function s$(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push(s$(arguments[b]));return c}if(typeof a=="string")a=document.getElementById(a);return a}
Function.prototype.bindObj=function(){if(arguments.length<2&&arguments[0]===undefined)return this;for(var a=this,b=[],c=0,d=arguments.length;c<d;c++)b.push(arguments[c]);var e=b.shift();return function(){return a.apply(e,b.concat(function(h){for(var k=[],p=0,o=h.length;p<o;p++)k.push(h[p]);return k}(arguments)))}};Function.prototype.bindObjEvent=function(){for(var a=this,b=[],c=0;c<arguments.length;c++)b.push(arguments[c]);var d=b.shift();return function(e){return a.apply(d,[e||window.event].concat(b))}};
Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a};
if(typeof SAPO.Browser=="undefined"){SAPO.Browser={IE:false,GECKO:false,OPERA:false,SAFARI:false,KONQUEROR:false,model:false,version:false,userAgent:false,init:function(){this.detectBrowser();this.setDimensions();this.setReferrer()},setDimensions:function(){var a=0,b=0;if(typeof window.innerWidth=="number"){a=window.innerWidth;b=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a=document.documentElement.clientWidth;
b=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a=document.body.clientWidth;b=document.body.clientHeight}this.windowWidth=a;this.windowHeight=b},setReferrer:function(){this.referrer=document.referrer!==undefined?document.referrer.length>0?escape(document.referrer):false:false},detectBrowser:function(){var a=navigator.userAgent;this.userAgent=a;a=a.toLowerCase();if(/applewebkit\//.test(a)){this.SAFARI=true;this.model="safari";
this.version=a.replace(/(.*)applewebkit\/([^\s]+)(.*)/,"$2")}else if(/opera/.test(a)){this.OPERA=true;this.model="opera";this.version=a.replace(/(.*)opera.([^\s$]+)(.*)/,"$2")}else if(/konqueror/.test(a)){this.KONQUEROR=true;this.model="konqueror";this.version=a.replace(/(.*)konqueror\/([^;]+);(.*)/,"$2")}else if(/msie /.test(a)){this.IE=true;this.model="ie";this.version=a.replace(/(.*)\smsie\s([^;]+);(.*)/,"$2")}else if(/gecko/.test(a)){this.GECKO=true;var b=new RegExp("(camino|chimera|epiphany|minefield|firefox|firebird|phoenix|galeon|iceweasel|k-meleon|seamonkey|netscape|songbird|sylera)");
if(b.test(a)){this.model=a.match(b)[1];this.version=a.replace(new RegExp("(.*)"+this.model+"/([^;\\s$]+)(.*)"),"$2")}else{this.model="mozilla";b=/(.*)rv:([^)]+)(.*)/;if(b.test(a))this.version=a.replace(b,"$2")}}},debug:function(){var a="known browsers: (ie, gecko, opera, safari, konqueror) \n";a+=[this.IE,this.GECKO,this.OPERA,this.SAFARI,this.KONQUEROR]+"\n";a+="model -> "+this.model+"\n";a+="version -> "+this.version+"\n";a+="\n";a+="original UA -> "+this.userAgent;alert(a)}};SAPO.Browser.init()}
SAPO.logReferer=function(a,b){b=Object.extend({s:"js.sapo.pt",swakt:"59a97a5f-0924-3720-a62e-0c44d9ea4f16",pg:false,swasection:false,ref:false,etype:"libsapojs-view",swav:"1",swauv:"1",bcs:"1",bsr:"1",bul:"1",bje:"1",bfl:"1",debug:false},b||{});if(typeof a!="undefined"&&a!=null){if(!b.pg)b.pg=a;if(!b.swasection)b.swasection=a;if(!b.ref)b.ref=location.href;a=["pg="+encodeURIComponent(b.pg),"swasection="+encodeURIComponent(b.swasection),"s="+b.s,"ref="+encodeURIComponent(b.ref),"swakt="+b.swakt,"etype="+
encodeURIComponent(b.etype),"swav="+encodeURIComponent(b.swav),"swauv="+encodeURIComponent(b.swauv),"bcs="+encodeURIComponent(b.bcs),"bsr="+encodeURIComponent(b.bsr),"bul="+encodeURIComponent(b.bul),"bje="+encodeURIComponent(b.bje),"bfl="+encodeURIComponent(b.bfl),""];b=location.protocol=="https:"?"https://ssl.sapo.pt/wa.sl.pt/wa.gif?":"http://wa.sl.pt/wa.gif?";(new Image).src=b+a.join("&")}};
SAPO._require=function(a,b){if(typeof a=="string"){var c=document.createElement("script");c.type="text/javascript";if(document.attachEvent)c.onreadystatechange=function(){this.readyState=="loaded"&&typeof b!="undefined"&&b()};else c.onload=function(){typeof b!="undefined"&&b()};c.src=a;a=document.getElementsByTagName("HEAD");a.length>0&&a[0].appendChild(c)}};
SAPO.require=function(a,b){var c=[],d=[],e=function(v){if(typeof v=="string")if(/^SAPO\./.test(v))return true;return false},h=function(v){if(typeof v=="object"&&v.constructor==Object)if(typeof v.uri=="string")return true;return false},k=function(v){if(typeof v=="object"&&v.constructor==Array)return true;return false},p=function(v){v=v.split(".").join("/");return v="http://js.sapo.pt/"+v+"/"},o=function(v){return v.uri},j=function(v){if(typeof v!="undefined"){v=v.split(".");for(var z=window,A=0,F=
v.length;A<F;A++)if(typeof z[v[A]]!="undefined")z=z[v[A]];else return false;return true}},t=function(){if(d.length>1){SAPO._require(d[0],t);d.splice(0,1)}else if(d.length==1){typeof b!="undefined"?SAPO._require(d[0],b):SAPO._require(d[0]);d.splice(0,1)}else d.length===0&&typeof b!="undefined"&&b()};if(typeof a!="undefined"){var r=false;if(typeof a=="string")if(e(a))j(a)||d.push(p(a));else d.push(a);else for(var u=0,y=a.length;u<y;u++){r=a[u];if(e(r)){if(!j(r)){c.push(r);d.push(p(r))}}else if(k(r)){if(r.length>
0)if(e(r[0]))j(r[0])||(r.length===2?d.push(p(r[0])+r[1]+"/"):d.push(p(r[0])))}else if(typeof r=="string")d.push(r);else if(h(r))if(typeof r.check=="string")j(r.check)||d.push(o(r));else d.push(o(r))}if(arguments.length==3){if(typeof arguments[2]=="boolean"){if(arguments[2]===true){c=0;for(e=d.length;c<e;c++)SAPO._require(d[c])}typeof b!="undefined"&&b()}}else t()}};if(!SAPO.Dom||typeof SAPO.Dom=="undefined")SAPO.namespace("Dom");
SAPO.Dom.Event={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,element:function(a){a=a.srcElement?a.srcElement:a.target;return a.nodeType==3?a.parentNode:a},findElement:function(a,b){for(a=this.element(a);;)if(a.nodeName.toLowerCase()===b.toLowerCase()||a.nodeName.toLowerCase()==="body")return a;else a=a.parentNode},fire:function(a,b,c){a=s$(a);var d;if(a!==null){if(a==
document&&document.createEvent&&!a.dispatchEvent)a=document.documentElement;if(document.createEvent){d=document.createEvent("HTMLEvents");d.initEvent("dataavailable",true,true)}else{d=document.createEventObject();d.eventType="ondataavailable"}d.eventName=b;d.memo=c||{};document.createEvent?a.dispatchEvent(d):a.fireEvent(d.eventType,d);return d}},observe:function(a,b,c){a=s$(a);if(a!==null){if(b.indexOf(":")!=-1)b="dataavailable";a.addEventListener?a.addEventListener(b,c,false):a.attachEvent("on"+
b,c)}},stopObserving:function(a,b,c){a=s$(a);if(a!==null)a.removeEventListener?a.removeEventListener(b,c,false):a.detachEvent("on"+b,c)},stop:function(a){if(a.cancelBubble!==null)a.cancelBubble=true;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(window.event)a.returnValue=false;if(a.cancel!==null)a.cancel=true},pointer:function(a){return{x:a.pageX||a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft),y:a.pageY||a.clientY+(document.documentElement.scrollTop||
document.body.scrollTop)}},pointerX:function(a){return this.pointer(a).x},pointerY:function(a){return this.pointer(a).y},debug:function(){}};if(!SAPO.Dom||typeof SAPO.Dom=="undefined")SAPO.namespace("Dom");
SAPO.Dom.Css={addClassName:function(a,b){a=s$(a);if(a!==null)if(typeof a.classList!=="undefined")a.classList.add(b);else this.hasClassName(a,b)||(a.className+=(a.className?" ":"")+b)},removeClassName:function(a,b){a=s$(a);if(a!==null)if(typeof a.classList!=="undefined")a.classList.remove(b);else{if(typeof a.className=="undefined")return false;var c=a.className;c=c.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ");c=c.replace(/^\s+/,"").replace(/\s+$/,"");a.className=c}},hasClassName:function(a,b){a=
s$(a);if(a!==null)if(typeof a.classList!=="undefined")return a.classList.contains(b);else{if(typeof a.className=="undefined")return false;a=a.className;if(typeof a.length=="undefined")return false;if(a.length>0)if(a==b)return true;else if((new RegExp("(^|\\s)"+b+"(\\s|$)")).test(a))return true}return false},toggleClassName:function(a,b,c){if(a!==null)if(typeof a.classList!=="undefined"){a=s$(a);a!==null&&a.classList.toggle(b);return true}if(typeof c!="undefined")if(c===true)this.addClassName(a,b);
else c===false&&this.removeClassName(a,b);else this.hasClassName(a,b)?this.removeClassName(a,b):this.addClassName(a,b)},setOpacity:function(a,b){a=s$(a);if(a!==null){var c=1;isNaN(Number(b))||(c=b<=0?0:b<=1?b:b<=100?b/100:1);if(SAPO.Browser.IE)a.style.filter="alpha(opacity:"+c*100+")";else a.style.opacity=c}},_camelCase:function(a){var b,c=a.indexOf("-");if(c!=-1)a=a.replace(/\-/,"");b=a.charAt(c).toUpperCase();a=a.replace(new RegExp("(.{"+c+"}).(.*)","i"),"$1"+b+"$2");if(a.indexOf("-")!=-1)a=this._camelCase(a);
return a},getStyle:function(a,b){a=s$(a);if(a!==null){b=b=="float"?"cssFloat":SAPO.Dom.Css._camelCase(b);var c=a.style[b];if(!c||c=="auto")c=(a=document.defaultView.getComputedStyle(a,null))?a[b]:null;if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:c}},setStyle:function(a,b){a=s$(a);if(a!==null)if(typeof b==="string"){a.style.cssText+="; "+b;b.indexOf("opacity")!=-1&&this.setOpacity(a,b.match(/opacity:\s*(\d?\.?\d*)/)[1])}else for(var c in b)if(b.hasOwnProperty(c))if(c=="opacity")this.setOpacity(a,
b[c]);else if(c=="float"||c=="cssFloat")if(typeof a.style.styleFloat=="undefined")a.style.cssFloat=b[c];else a.style.styleFloat=b[c];else a.style[c]=b[c]},show:function(a){a=s$(a);if(a!==null)a.style.display=""},hide:function(a){a=s$(a);if(a!==null)a.style.display="none"},toggle:function(a,b){a=s$(a);if(a!==null)if(typeof b!="undefined")b===true?this.show(a):this.hide(a);else a.style.display=="none"?this.show(a):this.hide(a)},debug:function(){}};if(!SAPO.Communication||typeof SAPO.Communication=="undefined")SAPO.namespace("Communication");SAPO.Communication.Ajax=function(a,b){this.init(a,b)};
SAPO.Communication.Ajax.prototype={init:function(a,b){this.options=Object.extend({asynchronous:true,method:"post",parameters:false,timeout:false,postBody:false,encoding:"UTF-8",contentType:"application/x-www-form-urlencoded",requestHeaders:false,onComplete:false,onSuccess:false,onFailure:false,onCreate:false,onInit:false,onTimeout:false,sanitizeJSON:false,evalJS:true,debug:false},b||{});this.options.method=this.options.method.toLowerCase();if(this.options.method!="get"&&this.options.method=="post")this.options.method=
"post";this.options.onInit&&this.options.onInit();this.stoTimeout=false;this.url=a;this.transport=this.getTransport();this.request()},getTransport:function(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;else if(typeof ActiveXObject!="undefined")try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){return new ActiveXObject("Microsoft.XMLHTTP")}else return false},setHeaders:function(){if(this.transport)try{var a={"User-Agent":navigator.userAgent,Accept:"text/javascript,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1",
"Accept-Language":navigator.language,"Accept-Charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.7",Referer:this.url};if(this.options.method=="post"){a["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.options.postBody)a["Content-length"]=this.options.postBody.length}a["X-Requested-With"]="XMLHttpRequest";a["X-SAPO-Version"]="0.1";if(this.options.method=="post")this.transport.setRequestHeader("Content-type",this.options.contentType+(this.options.encoding?
"; charset="+this.options.encoding:""));if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)a.Connection="close";if(this.options.requestHeaders&&typeof this.options.requestHeaders=="object")for(var b in this.options.requestHeaders)a[b]=this.options.requestHeaders[b];for(var c in a)a.hasOwnProperty(c)&&this.transport.setRequestHeader(c,a[c])}catch(d){}},setParams:function(){var a=false,b=this.options.parameters;if(this.options.method=="get"){if(typeof b===
"string")a=b;else if(typeof b==="object"){a="";for(var c in b)if(b.hasOwnProperty(c))a+=c+"="+b[c]+"&";if(a!=="")a=a.substr(0,a.length-1)}if(a)this.url=this.url.indexOf("?")>-1?this.url+"&"+a:this.url+"?"+a}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},getResponse:function(){var a=this.transport,b={headerJSON:null,responseJSON:null,getHeader:this.getHeader,request:this,transport:a};b.readyState=a.readyState;b.responseText=a.responseText;b.responseXML=
a.responseXML;b.status=a.status;b.statusText=a.statusText;return b},runStateChange:function(){var a,b,c;try{var d=this.transport.status||0}catch(e){d=0}if(this.transport.readyState==4){this.stoTimeout&&clearTimeout(this.stoTimeout);b=this.transport.responseText;c=this.getResponse();a=this.getHeader("Content-type");if(a==null)a="";if(this.options.evalJS&&a.indexOf("application/json")>=0||this.options.evalJS==="force")if(a=this.evalJSON(b,this.sanitizeJSON))b=c.responseJSON=a;if((a=this.getHeader("X-JSON"))&&
this.options.evalJS){a=this.evalJSON(a,this.sanitizeJSON);b=c.headerJSON=a}if(this.transport.responseXML!==null&&c.responseJSON===null&&this.transport.responseXML.xml!=="")b=this.transport.responseXML;if(d>=200&&d<300)this.options.onSuccess&&this.options.onSuccess(c,b);else this.options.onFailure&&this.options.onFailure(c,b);typeof this.options["on"+d]!="undefined"&&this.options["on"+d](c,b);this.options.onComplete&&this.options.onComplete(c,b)}},request:function(){if(this.transport){this.setParams();
this.options.method=="get"?this.transport.open("GET",this.url,this.options.asynchronous):this.transport.open("POST",this.url,this.options.asynchronous);this.setHeaders();this.options.onCreate&&this.options.onCreate();if(this.options.timeout&&!isNaN(this.options.timeout))this.stoTimeout=setTimeout(function(){if(this.options.onTimeout){this.transport.abort();this.options.onTimeout()}}.bindObj(this),this.options.timeout*1E3);if(this.options.asynchronous)this.transport.onreadystatechange=function(){this.runStateChange()}.bindObj(this);
this.options.method=="get"?this.transport.send(null):this.transport.send(this.options.postBody?this.options.postBody:this.options.parameters);this.options.asynchronous||this.runStateChange()}},isJSON:function(a){if(a.length===0||typeof a!=="string")return false;a=a.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)},evalJSON:function(a,b){if(!b||this.isJSON(a))try{if(typeof JSON!=="undefined"&&typeof JSON.parse!=="undefined")return JSON.parse(a);
return eval("("+a+")")}catch(c){throw new Error("ERROR: Bad JSON string...");}return false},debug:function(){}};SAPO.Communication.Ajax.load=function(a,b){return new SAPO.Communication.Ajax(a,{method:"get",onSuccess:function(c){b(c.responseText)}})};if(!SAPO.Utility||typeof SAPO.Utility=="undefined")SAPO.namespace("Utility");
SAPO.Utility.Dimensions={elementWidth:function(a){if(typeof a==="string")a=document.getElementById(a);return a.offsetWidth},elementHeight:function(a){if(typeof a==="string")a=document.getElementById(a);return a.offsetHeight},elementLeft:function(a){if(typeof a==="string")a=document.getElementById(a);return a.offsetLeft},elementTop:function(a){if(typeof a==="string")a=document.getElementById(a);return a.offsetTop},elementDimensions:function(a){if(typeof a==="string")a=document.getElementById(a);return Array(a.offsetWidth,
a.offsetHeight)},pageWidth:function(){var a;a=window.innerWidth&&window.scrollMaxX?window.innerWidth+window.scrollMaxX:document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth;var b;if(self.innerWidth)b=document.documentElement.clientWidth?document.documentElement.clientWidth:self.innerWidth;else if(document.documentElement&&document.documentElement.clientWidth)b=document.documentElement.clientWidth;else if(document.body)b=document.body.clientWidth;return a<
b?a:b},pageHeight:function(){var a;a=window.innerHeight&&window.scrollMaxY?window.innerHeight+window.scrollMaxY:document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight;var b;if(self.innerHeight)b=self.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)b=document.documentElement.clientHeight;else if(document.body)b=document.body.clientHeight;return a<b?b:a},viewportWidth:function(){if(typeof window.innerWidth!=="undefined")return window.innerWidth;
else if(document.documentElement&&typeof document.documentElement.offsetWidth!=="undefined")return document.documentElement.offsetWidth},viewportHeight:function(){if(typeof window.innerHeight!=="undefined")return window.innerHeight;else if(document.documentElement&&typeof document.documentElement.offsetHeight!=="undefined")return document.documentElement.offsetHeight},scrollWidth:function(){return self.pageXOffset?self.pageXOffset:typeof document.documentElement!="undefined"&&typeof document.documentElement.scrollLeft!=
"undefined"?document.documentElement.scrollLeft:document.body.scrollLeft},scrollHeight:function(){return self.pageYOffset?self.pageYOffset:typeof document.documentElement!="undefined"&&typeof document.documentElement.scrollTop!="undefined"?document.documentElement.scrollTop:document.body.scrollTop},debug:function(){}};if(!SAPO.Component||typeof SAPO.Component=="undefined")SAPO.namespace("Component");
SAPO.Component.Dialog={_dialogs:{},_overlayLock:false,_elementsToHide:{embed:true,object:true,iframe:true,select:true},_makeNewDialog:function(a){var b,c=0,d;if(!SAPO.Dom||typeof SAPO.Dom=="undefined")SAPO.namespace("Dom");if(!SAPO.Dom.Event||typeof SAPO.Dom.Event=="undefined")SAPO.Dom.Event=Event;for(;;){if(typeof a[0].id!="undefined")if(typeof this._dialogs[a[0].id]!="undefined")return false;if(typeof this._dialogs[b]=="undefined"){d=this._setOptions(a);b=d.id;this._dialogs[b]={options:d,overlay:false,
component:false,targetElement:false,originalPosition:false,initialHeight:false,initialWidth:false};break}else b="SAPODialog_"+Math.round(1E4*Math.random());if(c>10)throw"You are creating too many dialogs";else c++}this._currentDialogId=b;a=parseInt(d.width,10);c=d.height;if(this._setTargetElement(d)===false)return false;var e=this.getPageSize(b),h=this.getPageScroll(),k=Number(e[2])/2-a/2;d.message=d.message.replace(new RegExp("\\n","g"),"<br />");this.addLayer(d.className,e);this._dialogs[b].component=
this.createMessageComponent(d.message,a,c,0,k,d.className);return{pageDims:e,scrollDims:h}},_setOptions:function(a){if(typeof a[0]==="string")a[0]={message:a[0]};var b=this._elementsToHide;if(typeof a[0].hide!="undefined"){b=Object.extend(this._elementsToHide,a[0].hide);delete a[0].hide}return Object.extend({id:"SAPODialog_"+Math.round(1E4*Math.random()),width:250,height:false,onComplete:false,callBack:false,callBackCancel:false,className:false,targetElement:false,okLabel:"Ok",cancelLabel:"Cancelar",
hide:b,debug:false},a[0]||{})},_stoHideFlash:false,_intervalHideFlash:2E3,_currentDialogId:false,addLayer:function(a,b){var c=this._currentDialogId,d=this._dialogs[c],e=d.targetElement;b=this._createOverlay(b);this._dialogs[c].overlay=b;if(e){c=e.style.position;if(c===""||c==="static"){e.style.position="relative";d.originalPosition=Array();d.originalPosition[0]=e.style.top;d.originalPosition[1]=e.style.left;d.originalPosition[2]=e.style.bottom;d.originalPosition[3]=e.style.right;e.style.top=0;e.style.left=
0;e.style.bottom=0;e.style.right=0}e.appendChild(b)}else document.body.appendChild(b);if(this._stoHideFlash){clearInterval(this._stoHideFlash);this._stoHideFlash=false}this._hideAllFlash(a,this._currentDialogId);this._stoHideFlash=setInterval(function(h,k){this._hideAllFlash(h,k)}.bindObj(this,a,this._currentDialogId),this._intervalHideFlash)},_createOverlay:function(a){var b=document.createElement("div");b.style.position="absolute";b.style.zIndex="100000";b.style.backgroundColor="#696969";b.style.cursor=
"not-allowed";b.className="sapo_widget_dialog_overlay";b.style.width=a[0]+"px";b.style.height=a[1]+"px";b.style.left="0px";b.style.top="0px";if(SAPO.Browser.IE)b.style.filter="alpha(opacity:50)";else b.style.opacity=0.5;return b},removeLayer:function(a){if(typeof a=="undefined")a=this._currentDialogId;var b=this._dialogs[a];b.component&&b.component.parentNode.removeChild(b.component);b.overlay&&b.overlay.parentNode.removeChild(b.overlay);if(b.targetElement)if(b.originalPosition===false){b.targetElement.style.top=
b.originalPosition[0];b.targetElement.style.left=b.originalPosition[1];b.targetElement.style.bottom=b.originalPosition[2];b.targetElement.style.right=b.originalPosition[3]}this.showAllFlash(a);this._overlayLock=false;delete this._dialogs[a]},_addComponent:function(){var a=this._dialogs[this._currentDialogId];if(a.targetElement){a.targetElement.appendChild(a.component);a.targetElement=a.component.parentNode}else document.body.appendChild(a.component)},_setupComponent:function(a){var b=this._currentDialogId,
c=s$(b),d=this._dialogs[b].component;this._dialogs[b].initialHeight=c.clientHeight;this._dialogs[b].initialWidth=c.clientWidth;c=parseInt(SAPO.Utility.Dimensions.elementHeight(d),10);a=this._getTopPosition(a.pageDims,a.scrollDims,c,b);d.style.top=a+"px";this._dialogs[b].options.onComplete&&this._dialogs[b].options.onComplete(d)},_setTargetElement:function(a){var b=this._currentDialogId,c=this._dialogs[b];if(a.targetElement){c.targetElement=typeof a.targetElement==="string"?document.getElementById(a.targetElement):
a.targetElement;for(var d in this._dialogs)if(c.targetElement===this._dialogs[d].targetElement&&d!=b){delete this._dialogs[b];return false}}else if(this._overlayLock===false)this._overlayLock=true;else return false;return true},_getTopPosition:function(a,b,c,d){if(typeof d=="undefined")d=this._currentDialogId;a=Number(Number(a[3])/2-c/2);if(a<0)a=5;return this._dialogs[d].targetElement?a:a+Number(b[1])},_getLeftPosition:function(a,b,c,d){if(typeof d=="undefined")d=this._currentDialogId;a=Number(Number(a[2])/
2-c/2);if(a<0)a=5;return this._dialogs[d].targetElement?a:a+Number(b[0])},_makeOkButton:function(){var a=document.createElement("INPUT"),b=this._dialogs[this._currentDialogId].options;if(b.image&&typeof b.image!="undefined"){a.type="image";a.src=b.image}else{a.type="button";a.value=b.okLabel}a.style.fontFamily="Arial, Verdana, sans-serif";a.style.fontSize="12px";SAPO.Dom.Event.observe(a,"click",function(c,d,e){d&&d(this._dialogs[e].component);SAPO.Component.Dialog.removeLayer(e)}.bindObjEvent(this,
b.callBack,this._currentDialogId));return a},_makeCancelButton:function(){var a=document.createElement("INPUT"),b=this._dialogs[this._currentDialogId].options;if(b.imageCancel&&typeof b.imageCancel!="undefined"){a.type="image";a.src=b.imageCancel}else{a.type="button";a.value=b.cancelLabel}a.style.fontFamily="Arial, Verdana, sans-serif";a.style.fontSize="12px";SAPO.Dom.Event.observe(a,"click",function(c,d,e){d&&d(this._dialogs[e].component);SAPO.Component.Dialog.removeLayer(e)}.bindObjEvent(this,b.callBackCancel,
this._currentDialogId));return a},alert:function(){var a=this._makeNewDialog(arguments);if(a===false)return false;var b=this._dialogs[this._currentDialogId].component,c=this._makeOkButton(),d=document.createElement("DIV");d.style.textAlign="center";d.style.padding="20px";d.appendChild(c);b.appendChild(d);this._addComponent();this._setupComponent(a)},confirm:function(){var a=this._makeNewDialog(arguments);if(a===false)return false;var b=this._dialogs[this._currentDialogId].component,c=this._makeOkButton(),
d=this._makeCancelButton(),e=document.createElement("DIV");e.style.textAlign="center";e.style.padding="20px";e.appendChild(c);e.appendChild(document.createTextNode("   "));e.appendChild(d);b.appendChild(e);this._addComponent();this._setupComponent(a)},info:function(){var a=this._makeNewDialog(arguments);if(a===false)return false;this._addComponent();this._setupComponent(a)},createMessageComponent:function(a,b,c,d,e,h){var k=document.createElement("div");k.id=this._currentDialogId;k.style.position=
"absolute";k.style.zIndex="100001";k.style.width=b+"px";if(c)k.style.height=c+"px";k.style.left=e+"px";k.style.top=d+"px";k.style.cursor="default";if(h&&typeof h!="undefined"&&h!==null)k.className=h;else{k.style.padding="5px";k.style.fontFamily="Arial, Verdana, sans-serif";k.style.fontSize="12px";k.style.textAlign="center";k.style.backgroundColor="#FFF";k.style.border="1px solid black";k.className="sapo_widget_dialog_component"}k.innerHTML=a;return k},isInsideComponent:function(a,b){for(;a.nodeName.toLowerCase()!=
"body";){if(a.className===b)return true;a=a.parentNode}return false},_hideAllFlash:function(a,b){var c,d,e,h;c=this._dialogs[b].targetElement?this._dialogs[b].targetElement:document.body;e=this._dialogs[b].options;if(e.hide.embed){h=c.getElementsByTagName("EMBED");b=0;for(d=h.length;b<d;b++)if(!this.isInsideComponent(h[b],a))h[b].style.visibility="hidden"}if(e.hide.object){h=c.getElementsByTagName("OBJECT");b=0;for(d=h.length;b<d;b++)if(!this.isInsideComponent(h[b],a))h[b].style.visibility="hidden"}if(e.hide.iframe){h=
c.getElementsByTagName("IFRAME");b=0;for(d=h.length;b<d;b++)if(!this.isInsideComponent(h[b],a))h[b].style.visibility="hidden"}if(e.hide.select){c=c.getElementsByTagName("SELECT");b=0;for(d=c.length;b<d;b++)if(!this.isInsideComponent(c[b],a))c[b].style.visibility="hidden"}},showAllFlash:function(a){var b,c,d,e;if(this._stoHideFlash){clearInterval(this._stoHideFlash);this._stoHideFlash=false}b=this._dialogs[a].targetElement?this._dialogs[a].targetElement:document.body;d=this._dialogs[a].options;if(d.hide.embed){e=
b.getElementsByTagName("EMBED");a=0;for(c=e.length;a<c;a++)e[a].style.visibility="visible"}if(d.hide.object){e=b.getElementsByTagName("OBJECT");a=0;for(c=e.length;a<c;a++)e[a].style.visibility="visible"}if(d.hide.iframe){e=b.getElementsByTagName("IFRAME");a=0;for(c=e.length;a<c;a++)e[a].style.visibility="visible"}if(d.hide.select){b=b.getElementsByTagName("SELECT");a=0;for(c=b.length;a<c;a++)b[a].style.visibility="visible"}},getPageScroll:function(){return[SAPO.Utility.Dimensions.scrollWidth(),SAPO.Utility.Dimensions.scrollHeight()]},
getPageSize:function(a){var b=false;if(typeof a!="undefined")b=this._dialogs[a].targetElement;return b?[SAPO.Utility.Dimensions.elementWidth(b),SAPO.Utility.Dimensions.elementHeight(b),SAPO.Utility.Dimensions.elementWidth(b),SAPO.Utility.Dimensions.elementHeight(b)]:[SAPO.Utility.Dimensions.pageWidth(),SAPO.Utility.Dimensions.pageHeight(),SAPO.Utility.Dimensions.viewportWidth(),SAPO.Utility.Dimensions.viewportHeight()]},updatePosition:function(a){if(typeof a=="undefined")a=this._currentDialogId;var b=
s$(a),c=b.clientHeight,d=b.clientWidth,e=this.getPageSize(a),h=this.getPageScroll();if(this._dialogs[a].initialWidth!=d){b.style.left=this._getLeftPosition(e,h,d,a)+"px";this._dialogs[a].initialWidth=d}if(this._dialogs[a].initialHeight!=c){b.style.top=this._getTopPosition(e,h,c,a)+"px";this._dialogs[a].initialHeight=c}},updateSize:function(a,b,c){if(typeof c=="undefined")c=this._currentDialogId;var d=s$(c);if(a!==false)d.style.width=a+"px";if(b!==false)d.style.height=b+"px";this.updatePosition(c)},
debug:function(){}};if(!SAPO.Dom||typeof SAPO.Dom=="undefined")SAPO.namespace("Dom");
(function(){function a(f){for(var g="",i,l=0;f[l];l++){i=f[l];if(i.nodeType===3||i.nodeType===4)g+=i.nodeValue;else if(i.nodeType!==8)g+=a(i.childNodes)}return g}function b(f,g,i,l,n,m){n=0;for(var s=l.length;n<s;n++){var q=l[n];if(q){q=q[f];for(var w=false;q;){if(q.sizcache===i){w=l[q.sizset];break}if(q.nodeType===1&&!m){q.sizcache=i;q.sizset=n}if(q.nodeName.toLowerCase()===g){w=q;break}q=q[f]}l[n]=w}}}function c(f,g,i,l,n,m){n=0;for(var s=l.length;n<s;n++){var q=l[n];if(q){q=q[f];for(var w=false;q;){if(q.sizcache===
i){w=l[q.sizset];break}if(q.nodeType===1){if(!m){q.sizcache=i;q.sizset=n}if(typeof g!=="string"){if(q===g){w=true;break}}else if(o.filter(g,[q]).length>0){w=q;break}}q=q[f]}l[n]=w}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,h=Object.prototype.toString,k=false,p=true;[0,0].sort(function(){p=false;return 0});var o=function(f,g,i,l){i=i||[];var n=g=g||document;if(g.nodeType!==1&&g.nodeType!==9)return[];
if(!f||typeof f!=="string")return i;for(var m=[],s,q,w,E,B=true,D=A(g),C=f;(d.exec(""),s=d.exec(C))!==null;){C=s[3];m.push(s[1]);if(s[2]){E=s[3];break}}if(m.length>1&&t.exec(f))if(m.length===2&&j.relative[m[0]])q=F(m[0]+m[1],g);else for(q=j.relative[m[0]]?[g]:o(m.shift(),g);m.length;){f=m.shift();if(j.relative[f])f+=m.shift();q=F(f,q)}else{if(!l&&m.length>1&&g.nodeType===9&&!D&&j.match.ID.test(m[0])&&!j.match.ID.test(m[m.length-1])){s=o.find(m.shift(),g,D);g=s.expr?o.filter(s.expr,s.set)[0]:s.set[0]}if(g){s=
l?{expr:m.pop(),set:u(l)}:o.find(m.pop(),m.length===1&&(m[0]==="~"||m[0]==="+")&&g.parentNode?g.parentNode:g,D);q=s.expr?o.filter(s.expr,s.set):s.set;if(m.length>0)w=u(q);else B=false;for(;m.length;){var x=m.pop();s=x;if(j.relative[x])s=m.pop();else x="";if(s==null)s=g;j.relative[x](w,s,D)}}else w=[]}w||(w=q);w||o.error(x||f);if(h.call(w)==="[object Array]")if(B)if(g&&g.nodeType===1)for(f=0;w[f]!=null;f++){if(w[f]&&(w[f]===true||w[f].nodeType===1&&z(g,w[f])))i.push(q[f])}else for(f=0;w[f]!=null;f++)w[f]&&
w[f].nodeType===1&&i.push(q[f]);else i.push.apply(i,w);else u(w,i);if(E){o(E,n,i,l);o.uniqueSort(i)}return i};o.uniqueSort=function(f){if(v){k=p;f.sort(v);if(k)for(var g=1;g<f.length;g++)f[g]===f[g-1]&&f.splice(g--,1)}return f};o.matches=function(f,g){return o(f,null,null,g)};o.find=function(f,g,i){var l,n;if(!f)return[];for(var m=0,s=j.order.length;m<s;m++){var q=j.order[m];if(n=j.leftMatch[q].exec(f)){var w=n[1];n.splice(1,1);if(w.substr(w.length-1)!=="\\"){n[1]=(n[1]||"").replace(/\\/g,"");l=j.find[q](n,
g,i);if(l!=null){f=f.replace(j.match[q],"");break}}}}l||(l=g.getElementsByTagName("*"));return{set:l,expr:f}};o.filter=function(f,g,i,l){for(var n=f,m=[],s=g,q,w,E=g&&g[0]&&A(g[0]);f&&g.length;){for(var B in j.filter)if((q=j.leftMatch[B].exec(f))!=null&&q[2]){var D=j.filter[B],C,x;x=q[1];w=false;q.splice(1,1);if(x.substr(x.length-1)!=="\\"){if(s===m)m=[];if(j.preFilter[B])if(q=j.preFilter[B](q,s,i,m,l,E)){if(q===true)continue}else w=C=true;if(q)for(var G=0;(x=s[G])!=null;G++)if(x){C=D(x,q,G,s);var H=
l^!!C;if(i&&C!=null)if(H)w=true;else s[G]=false;else if(H){m.push(x);w=true}}if(C!==undefined){i||(s=m);f=f.replace(j.match[B],"");if(!w)return[];break}}}if(f===n)if(w==null)o.error(f);else break;n=f}return s};o.error=function(f){throw"Syntax error, unrecognized expression: "+f;};var j=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(f){return f.getAttribute("href")}},relative:{"+":function(f,g){var i=typeof g==="string",l=i&&!/\W/.test(g);i=i&&!l;if(l)g=g.toLowerCase();l=0;for(var n=f.length,
m;l<n;l++)if(m=f[l]){for(;(m=m.previousSibling)&&m.nodeType!==1;);f[l]=i||m&&m.nodeName.toLowerCase()===g?m||false:m===g}i&&o.filter(g,f,true)},">":function(f,g){var i=typeof g==="string";if(i&&!/\W/.test(g)){g=g.toLowerCase();for(var l=0,n=f.length;l<n;l++){var m=f[l];if(m){i=m.parentNode;f[l]=i.nodeName.toLowerCase()===g?i:false}}}else{l=0;for(n=f.length;l<n;l++)if(m=f[l])f[l]=i?m.parentNode:m.parentNode===g;i&&o.filter(g,f,true)}},"":function(f,g,i){var l=e++,n=c;if(typeof g==="string"&&!/\W/.test(g)){var m=
g=g.toLowerCase();n=b}n("parentNode",g,l,f,m,i)},"~":function(f,g,i){var l=e++,n=c;if(typeof g==="string"&&!/\W/.test(g)){var m=g=g.toLowerCase();n=b}n("previousSibling",g,l,f,m,i)}},find:{ID:function(f,g,i){if(typeof g.getElementById!=="undefined"&&!i)return(f=g.getElementById(f[1]))?[f]:[]},NAME:function(f,g){if(typeof g.getElementsByName!=="undefined"){var i=[];g=g.getElementsByName(f[1]);for(var l=0,n=g.length;l<n;l++)g[l].getAttribute("name")===f[1]&&i.push(g[l]);return i.length===0?null:i}},
TAG:function(f,g){return g.getElementsByTagName(f[1])}},preFilter:{CLASS:function(f,g,i,l,n,m){f=" "+f[1].replace(/\\/g,"")+" ";if(m)return f;m=0;for(var s;(s=g[m])!=null;m++)if(s)if(n^(s.className&&(" "+s.className+" ").replace(/[\t\n]/g," ").indexOf(f)>=0))i||l.push(s);else if(i)g[m]=false;return false},ID:function(f){return f[1].replace(/\\/g,"")},TAG:function(f){return f[1].toLowerCase()},CHILD:function(f){if(f[1]==="nth"){var g=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(f[2]==="even"&&"2n"||f[2]==="odd"&&
"2n+1"||!/\D/.test(f[2])&&"0n+"+f[2]||f[2]);f[2]=g[1]+(g[2]||1)-0;f[3]=g[3]-0}f[0]=e++;return f},ATTR:function(f,g,i,l,n,m){g=f[1].replace(/\\/g,"");if(!m&&j.attrMap[g])f[1]=j.attrMap[g];if(f[2]==="~=")f[4]=" "+f[4]+" ";return f},PSEUDO:function(f,g,i,l,n){if(f[1]==="not")if((d.exec(f[3])||"").length>1||/^\w/.test(f[3]))f[3]=o(f[3],null,null,g);else{f=o.filter(f[3],g,i,true^n);i||l.push.apply(l,f);return false}else if(j.match.POS.test(f[0])||j.match.CHILD.test(f[0]))return true;return f},POS:function(f){f.unshift(true);
return f}},filters:{enabled:function(f){return f.disabled===false&&f.type!=="hidden"},disabled:function(f){return f.disabled===true},checked:function(f){return f.checked===true},selected:function(f){return f.selected===true},parent:function(f){return!!f.firstChild},empty:function(f){return!f.firstChild},has:function(f,g,i){return!!o(i[3],f).length},header:function(f){return/h\d/i.test(f.nodeName)},text:function(f){return"text"===f.type},radio:function(f){return"radio"===f.type},checkbox:function(f){return"checkbox"===
f.type},file:function(f){return"file"===f.type},password:function(f){return"password"===f.type},submit:function(f){return"submit"===f.type},image:function(f){return"image"===f.type},reset:function(f){return"reset"===f.type},button:function(f){return"button"===f.type||f.nodeName.toLowerCase()==="button"},input:function(f){return/input|select|textarea|button/i.test(f.nodeName)}},setFilters:{first:function(f,g){return g===0},last:function(f,g,i,l){return g===l.length-1},even:function(f,g){return g%2===
0},odd:function(f,g){return g%2===1},lt:function(f,g,i){return g<i[3]-0},gt:function(f,g,i){return g>i[3]-0},nth:function(f,g,i){return i[3]-0===g},eq:function(f,g,i){return i[3]-0===g}},filter:{PSEUDO:function(f,g,i,l){var n=g[1],m=j.filters[n];if(m)return m(f,i,g,l);else if(n==="contains")return(f.textContent||f.innerText||a([f])||"").indexOf(g[3])>=0;else if(n==="not"){g=g[3];i=0;for(l=g.length;i<l;i++)if(g[i]===f)return false;return true}else o.error("Syntax error, unrecognized expression: "+
n)},CHILD:function(f,g){var i=g[1],l=f;switch(i){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(i==="first")return true;l=f;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":i=g[2];var n=g[3];if(i===1&&n===0)return true;g=g[0];var m=f.parentNode;if(m&&(m.sizcache!==g||!f.nodeIndex)){var s=0;for(l=m.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++s;m.sizcache=g}f=f.nodeIndex-n;return i===0?f===0:f%i===0&&f/i>=
0}},ID:function(f,g){return f.nodeType===1&&f.getAttribute("id")===g},TAG:function(f,g){return g==="*"&&f.nodeType===1||f.nodeName.toLowerCase()===g},CLASS:function(f,g){return(" "+(f.className||f.getAttribute("class"))+" ").indexOf(g)>-1},ATTR:function(f,g){var i=g[1];f=j.attrHandle[i]?j.attrHandle[i](f):f[i]!=null?f[i]:f.getAttribute(i);i=f+"";var l=g[2];g=g[4];return f==null?l==="!=":l==="="?i===g:l==="*="?i.indexOf(g)>=0:l==="~="?(" "+i+" ").indexOf(g)>=0:!g?i&&f!==false:l==="!="?i!==g:l==="^="?
i.indexOf(g)===0:l==="$="?i.substr(i.length-g.length)===g:l==="|="?i===g||i.substr(0,g.length+1)===g+"-":false},POS:function(f,g,i,l){var n=j.setFilters[g[2]];if(n)return n(f,i,g,l)}}},t=j.match.POS;for(var r in j.match){j.match[r]=new RegExp(j.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source);j.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+j.match[r].source.replace(/\\(\d+)/g,function(f,g){return"\\"+(g-0+1)}))}var u=function(f,g){f=Array.prototype.slice.call(f,0);if(g){g.push.apply(g,f);return g}return f};
try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(y){u=function(f,g){g=g||[];if(h.call(f)==="[object Array]")Array.prototype.push.apply(g,f);else if(typeof f.length==="number")for(var i=0,l=f.length;i<l;i++)g.push(f[i]);else for(i=0;f[i];i++)g.push(f[i]);return g}}var v;if(document.documentElement.compareDocumentPosition)v=function(f,g){if(!f.compareDocumentPosition||!g.compareDocumentPosition){if(f==g)k=true;return f.compareDocumentPosition?-1:1}f=f.compareDocumentPosition(g)&
4?-1:f===g?0:1;if(f===0)k=true;return f};else if("sourceIndex"in document.documentElement)v=function(f,g){if(!f.sourceIndex||!g.sourceIndex){if(f==g)k=true;return f.sourceIndex?-1:1}f=f.sourceIndex-g.sourceIndex;if(f===0)k=true;return f};else if(document.createRange)v=function(f,g){if(!f.ownerDocument||!g.ownerDocument){if(f==g)k=true;return f.ownerDocument?-1:1}var i=f.ownerDocument.createRange(),l=g.ownerDocument.createRange();i.setStart(f,0);i.setEnd(f,0);l.setStart(g,0);l.setEnd(g,0);f=i.compareBoundaryPoints(Range.START_TO_END,
l);if(f===0)k=true;return f};(function(){var f=document.createElement("div"),g="script"+(new Date).getTime();f.innerHTML="<a name='"+g+"'/>";var i=document.documentElement;i.insertBefore(f,i.firstChild);if(document.getElementById(g)){j.find.ID=function(l,n,m){if(typeof n.getElementById!=="undefined"&&!m)return(n=n.getElementById(l[1]))?n.id===l[1]||typeof n.getAttributeNode!=="undefined"&&n.getAttributeNode("id").nodeValue===l[1]?[n]:undefined:[]};j.filter.ID=function(l,n){var m=typeof l.getAttributeNode!==
"undefined"&&l.getAttributeNode("id");return l.nodeType===1&&m&&m.nodeValue===n}}i.removeChild(f);i=f=null})();(function(){var f=document.createElement("div");f.appendChild(document.createComment(""));if(f.getElementsByTagName("*").length>0)j.find.TAG=function(g,i){i=i.getElementsByTagName(g[1]);if(g[1]==="*"){g=[];for(var l=0;i[l];l++)i[l].nodeType===1&&g.push(i[l]);i=g}return i};f.innerHTML="<a href='#'></a>";if(f.firstChild&&typeof f.firstChild.getAttribute!=="undefined"&&f.firstChild.getAttribute("href")!==
"#")j.attrHandle.href=function(g){return g.getAttribute("href",2)};f=null})();document.querySelectorAll&&function(){var f=o,g=document.createElement("div");g.innerHTML="<p class='TEST'></p>";if(!(g.querySelectorAll&&g.querySelectorAll(".TEST").length===0)){o=function(l,n,m,s){n=n||document;if(!s&&n.nodeType===9&&!A(n))try{return u(n.querySelectorAll(l),m)}catch(q){}return f(l,n,m,s)};for(var i in f)o[i]=f[i];g=null}}();(function(){var f=document.createElement("div");f.innerHTML="<div class='test e'></div><div class='test'></div>";
if(!(!f.getElementsByClassName||f.getElementsByClassName("e").length===0)){f.lastChild.className="e";if(f.getElementsByClassName("e").length!==1){j.order.splice(1,0,"CLASS");j.find.CLASS=function(g,i,l){if(typeof i.getElementsByClassName!=="undefined"&&!l)return i.getElementsByClassName(g[1])};f=null}}})();var z=document.compareDocumentPosition?function(f,g){return f.compareDocumentPosition(g)&16}:function(f,g){return f!==g&&(f.contains?f.contains(g):true)},A=function(f){return(f=(f?f.ownerDocument||
f:0).documentElement)?f.nodeName!=="HTML":false},F=function(f,g){var i=[],l="",n;for(g=g.nodeType?[g]:g;n=j.match.PSEUDO.exec(f);){l+=n[0];f=f.replace(j.match.PSEUDO,"")}f=j.relative[f]?f+"*":f;n=0;for(var m=g.length;n<m;n++)o(f,g[n],i);return o.filter(l,i)};SAPO.Dom.Selector={};SAPO.Dom.Selector.select=o;SAPO.Dom.Selector.matches=o.matches;SAPO.Dom.Selector.find=o.find})();!SAPO.Utility&&typeof SAPO.Utility=="undefined"&&SAPO.namespace("Utility");
SAPO.Utility.Cookie={get:function(){var a=document.cookie||false,b={};if(a){a=a.replace(new RegExp("; ","g"),";");a=a.split(";");var c=[];if(a.length>0)for(var d=0;d<a.length;d++){c=a[d].split("=");if(c.length==2)b[c[0]]=decodeURIComponent(c[1])}}return b},set:function(a,b,c,d,e,h){if(!a||b===false||typeof a=="undefined"||typeof b=="undefined")return false;else a=a+"="+encodeURIComponent(b);var k=b=false,p=false,o=false;if(c&&typeof c!="undefined"&&!isNaN(c)){c=parseInt(Number((new Date).valueOf()))+
Number(parseInt(c))*1E3;c=(new Date(c)).toGMTString();c=c.replace(/([^\s]+)(\s\d\d)\s(\w\w\w)\s(.*)/,"$1$2-$3-$4");b="expires="+c}else b=typeof c!="undefined"&&!isNaN(c)&&Number(parseInt(c))===0?"":"expires=Thu, 01-Jan-2037 00:00:01 GMT";k=d&&typeof d!="undefined"?"path="+d:"path=/";if(e&&typeof e!="undefined")p="domain="+e;else{p="domain="+window.location.host;p=p.replace(/:(.*)/,"")}o=h&&typeof h!="undefined"?h:false;document.cookie=a+"; "+b+"; "+k+"; "+p+"; "+o},remove:function(a,b,c){var d=false,
e=false;d=b&&typeof b!="undefined"?b:"/";e=c&&typeof c!="undefined"?c:window.location.host;this.set(a,"deleted",-999999999,d,e)},debug:function(){}};if(!SAPO.Widget||typeof SAPO.Widget=="undefined")SAPO.namespace("Widget");SAPO.Widget.ShareThis=function(a){this.exception=SAPO.Exception&&typeof SAPO.Exception!="undefined"?new SAPO.Exception("SAPO::Widget.ShareThis"):false;if(typeof SAPO.Communication=="undefined"){var b=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript";c.src="http://js.sapo.pt/SAPO/Communication/Syndication/";b.appendChild(c)}this.init(a)};
SAPO.Widget.ShareThis.prototype={init:function(){if(arguments.length>0){if(typeof arguments[0].language!="undefined"){var a=arguments[0].language.toLowerCase();this.language=typeof this._i18n[a]!="undefined"?a:"pt"}else this.language="pt";a={};if(typeof arguments[0].language_values=="object")a=arguments.language_values}else this.language="pt";this._i18n[this.language]=Object.extend(this._i18n[this.language],a);this.options=Object.extend({debug:true,target:false,url:false,mode:3,only:null,exclude:[],
clickOutClose:false,video:false,custom_services:null,tooltip_title:this._i18n[this.language].tooltip_title,email_tab_title:this._i18n[this.language].email_tab_title,email_link_text:this._i18n[this.language].email_link_text,pdf_tab_title:this._i18n[this.language].pdf_tab_title,pdf_link_text:this._i18n[this.language].pdf_link_text,web_tab_title:this._i18n[this.language].web_tab_title,pdf_json_url:"http://webthumbs.sapo.pt/pdfjson?url=_URL_&rand=_RANDOM_",email_url:"http://jsphp.sapo.pt/Widget/ShareThis/mail.php?jsonTag=_VAR_&language="+
this.language,pdf:true,email:true,max_retries:10,pageTitle:document.title||"",closeTitle:this._i18n[this.language].closeTitle,element_id:"wsharethis_"+Math.floor(Math.random()*999999),cssURI:"http://js.sapo.pt/Assets/Images/ShareThis/style.css",servicesCallback:false,pdfCallback:false,emailCallback:false,specificEmailTemplate:false},arguments[0]||{});if(this.options.specificEmailTemplate){this.options.email_url="http://jsphp.sapo.pt/Widget/ShareThis/mail.php?jsonTag=_VAR_&template="+this.options.specificEmailTemplate.name;
this.options.email_url+=typeof this.options.specificEmailTemplate.language?"&language="+this.options.specificEmailTemplate.language:"&language="+this.language}this.options.custom_services&&this.services.update(this.options.custom_services);this.urlToShare=this.options.url?this.options.url:location.href;this._countPDFVarChanged=0;this.filterServices();this.addCss();if(this.options.target){this.element=$(this.options.target);this.element.className="sapo_sharethis_container";if(this.options.mode==3)this.element.innerHTML=
'<a id="'+this.options.element_id+'" href="#" onclick="return false;">'+this.options.tooltip_title+"</a>"}else{this.options.mode==3?document.write('<div id="'+this.options.element_id+'"><a href="#" onclick="return false;">'+this.options.tooltip_title+"</a></div>"):document.write('<div id="'+this.options.element_id+'"></div>');this.element=$(this.options.element_id);this.element.className="sapo_sharethis_container"}if(this.options.mode==0){this.outputIconView();this.element.addClassName("sapo_sharethis_iconview")}else if(this.options.mode==
1){this.outputTextView();this.element.addClassName("sapo_sharethis_textview")}else if(this.options.mode==2){this.outputMixedView();this.element.addClassName("sapo_sharethis_mixedview").addClassName("clearfix")}else if(this.options.mode==3){this.outputTooltipView();this.element.childNodes[0].addClassName("sapo_sharethis_tooltipview").addClassName("clearfix")}this.setBehaviours()},_i18n:{pt:{email_name_from:"Nome do remetente",email_name_to:"Nome do destinat&aacute;rio",email_to:"Email do destinat&aacute;rio",
email_send:"Enviar",email_sending:"A enviar...",email_sending_error:"Erro! Tente novamente...",email_invalid:"Email inv\ufffd\ufffdlido",email_required:"Todos os campos s\ufffd\ufffdo obrigat\ufffd\ufffdrios.",email_share:"Partilhar por email",email_close:"fechar",pdf_download:"Download PDF&hellip;",pdf_error:"Erro! Clique para tentar de novo.",pdf_working:"A carregar...",closeTitle:"Fechar",tooltip_title:"Partilhar",email_tab_title:"Email",email_link_text:"Enviar email&hellip;",pdf_tab_title:"PDF",
pdf_link_text:"Gerar PDF",web_tab_title:"Internet"},en:{email_name_from:"Your name",email_name_to:"Your Friend's name",email_to:"Email to",email_send:"Send",email_sending:"Sending...",email_sending_error:"Error! Please try again...",email_invalid:"Invalid email",email_required:"All fields are required",email_share:"Share by email",email_close:"close",pdf_download:"Download PDF&hellip;",pdf_error:"Error! Press to try again.",pdf_working:"Loading...",closeTitle:"Close",tooltip_title:"Share This",email_tab_title:"Email",
email_link_text:"Send email&hellip;",pdf_tab_title:"PDF",pdf_link_text:"Generate PDF",web_tab_title:"Internet"},es:{email_name_from:"De",email_name_to:"Para",email_to:"E-mail del destinatario",email_send:"Enviar",email_sending:"Enviando...",email_sending_error:"\u00a1Error! Vuelva a intentar...",email_invalid:"E-mail inv\u00e1lido",email_required:"Todos los campos son obligatorios",email_share:"Compartir por e-mail",email_close:"Cerrar",pdf_download:"Descargar PDF&hellip;",pdf_error:"\u00a1Error! Haga clic para volver a intentar...",
pdf_working:"Cargando...",closeTitle:"Cerrar",tooltip_title:"Compartir",email_tab_title:"Email",email_link_text:"Enviar E-mail&hellip;",pdf_tab_title:"PDF",pdf_link_text:"Generate PDF",web_tab_title:"Internet"},fr:{email_name_from:"De",email_name_to:"\u00c0",email_to:"E-mai du destinataire",email_send:"Envoyer",email_sending:"Envoy en cours...",email_sending_error:"Erreur! Essayer encore une fois...",email_invalid:"E-mail invalide",email_required:"Tous les champs sont obligatoires",email_share:"Partager par e-mail",
email_close:"Fermer",pdf_download:"T\u00e9l\u00e9charger PDF&hellip;",pdf_error:"Erreur! Cliquer pour essayer encore une fois.",pdf_working:"T\u00e9l\u00e9charger en cours...",closeTitle:"Fermer",tooltip_title:"Partager",email_tab_title:"E-mail",email_link_text:"Envoyer e-mail&hellip;",pdf_tab_title:"PDF",pdf_link_text:"Sauver PDF",web_tab_title:"Internet"},de:{email_name_from:"Von",email_name_to:"An",email_to:"E-mail des Empf\u00e4ngers",email_send:"Senden",email_sending:"Wird gesendet...",email_sending_error:"Fehler! Versuchen Sie es nochmal...",
email_invalid:"Ung\u00fcltige E-Mail",email_required:"Alle Felder sind erforderlich",email_share:"durch E-Mail weiterleiten ",email_close:"Schlie\u00dfen",pdf_download:"PDF downloaden",pdf_error:"Fehler!  Clicken Sie bitte, um es nochmal zu versuchen\ufffd\ufffd\ufffd",pdf_working:"L\u00e4dt...",closeTitle:"Schlie\u00dfen",tooltip_title:"Weiterleiten",email_tab_title:"E-mail",email_link_text:"E-mail senden",pdf_tab_title:"PDF",pdf_link_text:"PDF speichern",web_tab_title:"Internet"},zh:{email_name_from:"\u7531",
email_name_to:"\u7ed9",email_to:"\u6536\u4ef6\u4eba\u7535\u5b50\u90ae\u7bb1",email_send:"\u53d1\u9001",email_sending:"\u53d1\u9001\u4e2d",email_sending_error:"\u9519\u8bef\uff01\u91cd\u8bd5...",email_invalid:"\u7535\u5b50\u90ae\u7bb1\u65e0\u6548",email_required:"\u5fc5\u987b\u586b\u5199\u6240\u6709\u7a7a\u683c",email_share:"\u7528\u7535\u90ae\u5206\u4eab",email_close:"\u5173\u95ed",pdf_download:"\u4e0b\u8f7dPDF\u6587\u4ef6",pdf_error:"\u9519\u8bef\uff01\u70b9\u51fb\u91cd\u8bd5",pdf_working:"\u8f7d\u5165\u4e2d\u2026",
closeTitle:"\u5173\u95ed",tooltip_title:"\u5206\u4eab",email_tab_title:"\u7535\u90ae",email_link_text:"\u53d1\u9001\u7535\u90ae",pdf_tab_title:"PDF\u683c\u5f0f",pdf_link_text:"\u4fdd\u5b58PDF\u6587\u4ef6",web_tab_title:"\u4e92\u8054\u7f51"},ru:{email_name_from:"\u041e\u0442",email_name_to:"\u041a\u043e\u043c\u0443",email_to:"\u0410\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f",
email_send:"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c",email_sending:"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430...",email_sending_error:"\u041e\u0448\u0438\u0431\u043a\u0430! \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437...",email_invalid:"\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b",
email_required:"\u0412\u0441\u0435 \u043f\u043e\u043b\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f",email_share:"\u041f\u0435\u0440\u0435\u0441\u043b\u0430\u0442\u044c \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435",email_close:"\u0437\u0430\u043a\u0440\u044b\u0442\u044c",pdf_download:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PDF\u2026",
pdf_error:"\u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0430\u0436\u043c\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u0440\u0430\u0437\u2026",pdf_working:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u2026",closeTitle:"\u0437\u0430\u043a\u0440\u044b\u0442\u044c",tooltip_title:"\u041f\u0435\u0440\u0435\u0441\u043b\u0430\u0442\u044c",email_tab_title:"\u041f\u0438\u0441\u044c\u043c\u043e",email_link_text:"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0438\u0441\u044c\u043c\u043e\u2026",
pdf_tab_title:"PDF",pdf_link_text:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PDF",web_tab_title:"\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442"},ar:{email_name_from:"\u0645\u0646",email_name_to:"\u0625\u0644\u0649",email_to:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0627\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0644\u0644\u0645\u0631\u0633\u0644 \u0627\u0644\u064a\u0647",
email_send:"\u0627\u0631\u0633\u0627\u0644",email_sending:"\u062c\u0627\u0631\u064a \u0627\u0644\u0627\u0631\u0633\u0627\u0644",email_sending_error:"\u062e\u0637\u0623! \u062d\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062e\u0631\u0649 ...",email_invalid:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0627\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u063a\u064a\u0631 \u0635\u062d\u064a\u062d",email_required:"\u062c\u0645\u064a\u0639 \u0627\u0644\u062d\u0642\u0648\u0644 \u0627\u062c\u0628\u0627\u0631\u064a\u0629",
email_share:"\u0627\u0644\u0645\u0634\u0627\u0631\u0643\u0629 \u0628\u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0627\u0644\u0643\u062a\u0631\u0648\u0646\u064a",email_close:"\u0627\u063a\u0644\u0627\u0642",pdf_download:"\u062a\u062d\u0645\u064a\u0644 \u0645\u0644\u0641 PDF",pdf_error:"\u062e\u0637\u0623! \u0627\u0646\u0642\u0631 \u0644\u0644\u0645\u062d\u0627\u0648\u0644\u0629 \u0645\u0646 \u062c\u062f\u064a\u062f ...",pdf_working:"\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u062d\u0645\u064a\u0644",
closeTitle:"\u0627\u063a\u0644\u0627\u0642",tooltip_title:"\u0645\u0634\u0627\u0631\u0643\u0629",email_tab_title:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0627\u0644\u0643\u062a\u0631\u0648\u0646\u064a",email_link_text:"\u0627\u0631\u0633\u0627\u0644 \u0628\u0631\u064a\u062f \u0627\u0644\u0643\u062a\u0631\u0648\u0646\u064a",pdf_tab_title:"\u0645\u0644\u0641 PDF",pdf_link_text:"\u062e\u0641\u0638 \u0645\u0644\u0641 PDF",web_tab_title:"\u0627\u0646\u062a\u0631\u0646\u062a"}},
outputIconView:function(){this.element.insert({bottom:this.container=new Element("div")});this.services.keys().each(function(b){this.container.insert({bottom:this.outputLink(this.services.get(b))})}.bind(this));if(this.options.video){var a;for(a in this.videoServices)this.videoServices.hasOwnProperty(a)&&this.container.appendChild(this.outputLink(this.videoServices[a]))}if(this.options.email)this.element.insert({top:this.email_link=(new Element("a")).writeAttribute("href","#").writeAttribute("onclick",
"return false;").update(this.options.email_tab_title)});if(this.options.pdf)this.element.insert({top:this.pdf_link=(new Element("a")).writeAttribute("href","#").writeAttribute("class","sapo_sharethis_generate_pdf").writeAttribute("onclick","return false;").update(this.options.pdf_tab_title)});this.element.insert({top:(new Element("span")).update(this.options.tooltip_title)})},outputTextView:function(){var a=[];this.services.keys().each(function(c){a.push(this.outputLink(this.services.get(c)))}.bind(this));
if(this.options.video){var b;for(b in this.videoServices)this.videoServices.hasOwnProperty(b)&&a.push(this.outputLink(this.videoServices[b]))}this.element.insert({bottom:this.container=new Element("div")});for(b=0;b<a.length;b++){this.container.insert({bottom:a[b]});b!=a.length-1&&this.container.insert({bottom:"&nbsp;|&nbsp;"})}if(this.options.email)this.element.insert({top:this.email_link=(new Element("a")).writeAttribute("href","#").writeAttribute("onclick","return false;").update(this.options.email_tab_title)});
if(this.options.pdf)this.element.insert({top:this.pdf_link=(new Element("a")).writeAttribute("class","sapo_sharethis_generate_pdf").writeAttribute("href","#").writeAttribute("onclick","return false;").update(this.options.pdf_tab_title)});this.element.insert({top:(new Element("span")).update(this.options.tooltip_title)})},outputMixedView:function(){this.element.insert({bottom:this.tabs=(new Element("div")).addClassName("sapo_sharethis_tab_row").addClassName("clearfix")}).insert({bottom:this.container=
(new Element("div")).addClassName("sapo_sharethis_tab_container").addClassName("clearfix")});var a=this.createTab(this.options.web_tab_title,true);this.services.keys().each(function(c){a.insert({bottom:this.outputLink(this.services.get(c))})}.bind(this));if(this.options.video){var b;for(b in this.videoServices)this.videoServices.hasOwnProperty(b)&&a.appendChild(this.outputLink(this.videoServices[b]))}if(this.options.pdf){a=this.createTab(this.options.pdf_tab_title,false);a.insert({bottom:this.pdf_link=
(new Element("a")).writeAttribute("href","#").writeAttribute("class","sapo_sharethis_generate_pdf").writeAttribute("onclick","return false;").update(this.options.pdf_link_text)})}if(this.options.email){a=this.createTab(this.options.email_tab_title,false);a.insert({bottom:this.createEmailForm()})}},outputTooltipView:function(){this.outputTooltipSkeleton();this.element.appendChild(this.overlay);this.overlay.className="sapo_sharethis_tooltip_container";this.overlay.insert({bottom:this.tabs=(new Element("div")).addClassName("sapo_sharethis_tab_row").addClassName("clearfix")}).insert({bottom:this.container=
(new Element("div")).addClassName("sapo_sharethis_tab_container").addClassName("clearfix")});var a=this.createTab(this.options.web_tab_title,true);this.services.keys().each(function(c){a.insert({bottom:this.outputLink(this.services.get(c))})}.bind(this));if(this.options.video){var b;for(b in this.videoServices)this.videoServices.hasOwnProperty(b)&&a.appendChild(this.outputLink(this.videoServices[b]))}if(this.options.pdf){a=this.createTab(this.options.pdf_tab_title,false);a.insert({bottom:this.pdf_link=
(new Element("a")).writeAttribute("class","sapo_sharethis_generate_pdf").writeAttribute("href","#").writeAttribute("onclick","return false;").update(this.options.pdf_link_text)})}if(this.options.email){a=this.createTab(this.options.email_tab_title,false);a.insert({bottom:this.createEmailForm()})}b=new Element("a");b.writeAttribute("href","#");b.addClassName("sapo_sharethis_tooltip_close");b.writeAttribute("onclick","return false;");b.innerHTML=this.options.closeTitle;this.tabs.appendChild(b);b.observe("click",
function(c){c.stop();this.overlay.style.display="none"}.bindAsEventListener(this));Event.observe(this.element.childNodes[0],"click",function(){this.element.childNodes[0].blur();this.overlay.toggle()}.bindAsEventListener(this))},outputTooltipSkeleton:function(){this.element.insert({after:this.overlay=(new Element("div")).setStyle({display:"none"})})},createTab:function(a,b){var c=null,d=null;this.tabs.insert({bottom:c=(new Element("a")).writeAttribute("href","#"+a).writeAttribute("onclick","return false;").update(a)});
this.container.insert({bottom:d=(new Element("div")).addClassName("sapo_sharethis_tab")});b?c.addClassName("sapo_sharethis_tab_selected"):d.setStyle({display:"none"});c.observe("click",function(e){this.tabs.select("a").each(function(h){h.removeClassName("sapo_sharethis_tab_selected")});c.addClassName("sapo_sharethis_tab_selected");this.container.select("div").each(function(h){h.hide()});d.show();e.stop()}.bindAsEventListener(this));return d},outputLink:function(a){var b=(new Element("a")).writeAttribute("href",
a.url.sub("_URL_",encodeURIComponent(this.urlToShare)).sub("_TITLE_",encodeURIComponent(this.options.pageTitle))).writeAttribute("target","_blank").writeAttribute("title",a.text);this.options.mode!=1&&b.insert({bottom:(new Element("img")).writeAttribute("src",a.icon).writeAttribute("alt",a.text)});this.options.mode!=0&&b.insert({bottom:a.text});this.options.servicesCallback&&typeof this.options.servicesCallback=="function"&&Element.observe(b,"click",function(){this.options.servicesCallback.call(window,
this.urlToShare,this.options.pageTitle)}.bind(this));return b},filterServices:function(){this.options.exclude.each(function(a){this.services.unset(a)}.bind(this));this.options.only&&this.services.keys().each(function(a){this.options.only.include(a)||this.services.unset(a)}.bind(this))},setBehaviours:function(){if(this.options.pdf){this.pdf_observe_cache=this.getPDF.bindAsEventListener(this);this.pdf_link.observe("click",this.pdf_observe_cache)}if(this.options.email&&this.options.mode<2){this.element.insert({bottom:this.floating_balloon=
this.createFloatingEmailBalloon().insert({bottom:this.createEmailForm()})});this.email_observe_cache=this.emailSendInPlace.bindAsEventListener(this);this.email_link.observe("click",this.email_observe_cache)}this.options.email&&this.options.clickOutClose&&this.options.mode<2&&Event.observe(document,"click",function(a){if(!(typeof this.floating_balloon=="undefined"||a.target==this.email_link)){for(a=a.target;a!=null&&a.nodeName.toLowerCase()!="body";){if(a.className==this.floating_balloon.className)return;
a=a.parentNode}this.floating_balloon.style.display="none"}}.bindAsEventListener(this));this.options.clickOutClose&&this.options.mode==3&&Event.observe(document,"click",function(a){for(a=a.target;a!=null&&a.nodeName.toLowerCase()!="body";){if(a.id==this.options.element_id||a.id==this.options.target&&this.options.target)return;a=a.parentNode}this.overlay.style.display="none"}.bindAsEventListener(this))},getPDF:function(a){a&&typeof a.stop=="function"&&a.stop();a={onLoading:function(){this.pdf_link.update(this._i18n[this.language].pdf_working)}.bind(this),
onComplete:this.observePDFVarChange.bind(this),onError:function(){this.pdf_link.update(this._i18n[this.language].pdf_error)}.bind(this),timeout:10};if(typeof this.syndication=="undefined")this.syndication=new SAPO.Communication.Syndication;this.pdf_synd_id&&this.syndication.remove(this.pdf_synd_id);this.pdf_synd_id=this.syndication.push(this.options.pdf_json_url.sub("_URL_",this.urlToShare).sub("_RANDOM_",Math.floor(Math.random()*999999)),a);this.syndication.run(this.pdf_synd_id)},observePDFVarChange:function(a){if(a.pdf[0].x==
"avail"){this.pdf_link.stopObserving("click",this.pdf_observe_cache);this.pdf_link.writeAttribute("href",a.pdf[0].i);this.pdf_link.writeAttribute("onclick","");this.pdf_link.update(this._i18n[this.language].pdf_download);this._countPDFVarChanged=0;this.options.pdfCallback&&typeof this.options.pdfCallback=="function"&&this.options.pdfCallback.call(window,this.urlToShare,this.options.pageTitle)}else if(this._countPDFVarChanged<10){setTimeout(this.getPDF.bindObj(this),500);this._countPDFVarChanged++}else{this._countPDFVarChanged=
0;this.pdf_link.update(this._i18n[this.language].pdf_error)}},emailSendInPlace:function(a){a.stop();this.floating_balloon.show()},createFloatingEmailBalloon:function(){return(new Element("div")).addClassName("sapo_sharethis_floating_balloon").setStyle({position:"absolute",display:"none"}).insert({bottom:(new Element("h1")).update(this._i18n[this.language].email_share)}).insert({bottom:(new Element("a")).addClassName("sapo_sharethis_close").writeAttribute("href","#").writeAttribute("onclick","return false;").update(this._i18n[this.language].email_close).observe("click",
function(a){a.stop();this.floating_balloon.hide()}.bindAsEventListener(this))})},createEmailForm:function(){var a=Math.floor(Math.random()*999999);do this.email_var="sapo_share_this_"+Math.floor(Math.random()*1E3);while(window[this.email_var]);this.urlemailJSON=this.options.email_url.sub("_VAR_",this.email_var);this.email_form=(new Element("form")).writeAttribute("method","get").writeAttribute("action",this.urlemailJSON).writeAttribute("onsubmit","return false;");var b=(new Element("label")).update(this._i18n[this.language].email_name_from);
labelDesc="from";b.setAttribute("for",labelDesc+a);this.inputName=(new Element("input")).writeAttribute("type","text").writeAttribute("size","25");this.inputName.name=labelDesc;this.inputName.setAttribute("id",labelDesc+a);var c=(new Element("label")).update(this._i18n[this.language].email_name_to);labelDesc="to";c.setAttribute("for",labelDesc+a);this.inputNameTo=(new Element("input")).writeAttribute("type","text").writeAttribute("size","25");this.inputNameTo.name=labelDesc;this.inputNameTo.setAttribute("id",
labelDesc+a);var d=(new Element("label")).update(this._i18n[this.language].email_to);labelDesc="mail";d.setAttribute("for",labelDesc+a);this.inputEmailTo=(new Element("input")).writeAttribute("type","text").writeAttribute("size","25");this.inputEmailTo.name=labelDesc;this.inputEmailTo.setAttribute("id",labelDesc+a);this.inputUrl=(new Element("input")).writeAttribute("type","hidden").writeAttribute("value",this.urlToShare);this.inputUrl.name="url";a=(new Element("input")).writeAttribute("type","submit").writeAttribute("value",
this._i18n[this.language].email_send);this.email_form.appendChild(b);this.email_form.appendChild(this.inputName);this.email_form.appendChild(c);this.email_form.appendChild(this.inputNameTo);this.email_form.appendChild(d);this.email_form.appendChild(this.inputEmailTo);this.email_form.appendChild(this.inputUrl);this.email_form.appendChild(a);this.email_form.onsubmit=this.emailFormSubmit.bindAsEventListener(this);return this.email_form},emailFormSubmit:function(){var a=this.inputName.value,b=this.inputNameTo.value,
c=this.inputEmailTo.value,d=this.inputUrl.value;if(a==""||b==""||c==""||d==""){alert(this._i18n[this.language].email_required);return false}if(!/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([\w]*-?[\w]*\.)+[a-z]{2,4}$/i.test(c)){alert(this._i18n[this.language].email_invalid);return false}this.email_script=document.createElement("SCRIPT");this.email_script.type="text/javascript";this.email_script.charset="utf-8";this.email_script.src=this.urlemailJSON+"&"+["from="+encodeURIComponent(a),"to="+encodeURIComponent(b),
"mail="+encodeURIComponent(c),"url="+encodeURIComponent(d),"title="+encodeURIComponent(this.options.pageTitle)].join("&");document.getElementsByTagName("HEAD")[0].appendChild(this.email_script);this.email_retries=0;if(this.email_form_indicator){this.email_form.removeChild(this.email_form_indicator);this.email_form_indicator=document.createElement("span");this.email_form_indicator.style.position="absolute";this.email_form_indicator.style.bottom="15px";this.email_form_indicator.style.right="10px";this.email_form_indicator.style.whiteSpace=
"nowrap";this.email_form_indicator.innerHTML=this._i18n[this.language].email_sending;this.email_form.insert({bottom:this.email_form_indicator})}else this.email_form.insert({bottom:this.email_form_indicator=(new Element("span")).writeAttribute("style","position: absolute; bottom: 15px; right: 10px;white-space:nowrap;").update(this._i18n[this.language].email_sending)});new PeriodicalExecuter(this.observeEMAILVarChange.bind(this),0.1);return false},observeEMAILVarChange:function(a){if(window[this.email_var]){a.stop();
this.email_form.removeChild(this.email_form_indicator);this.email_form_indicator=document.createElement("span");this.email_form_indicator.style.position="absolute";this.email_form_indicator.style.bottom="15px";this.email_form_indicator.style.right="10px";this.email_form_indicator.style.whiteSpace="nowrap";if(!window[this.email_var].error){this.inputName.value="";this.inputNameTo.value="";this.inputEmailTo.value=""}this.email_form_indicator.innerHTML=window[this.email_var].message;this.email_form.appendChild(this.email_form_indicator);
window[this.email_var]=null;this.options.emailCallback&&typeof this.options.emailCallback=="function"&&this.options.emailCallback.call(window,this.urlToShare,this.options.pageTitle)}if(this.email_retries>this.options.max_retries){a.stop();this.email_form.removeChild(this.email_form_indicator);this.email_form_indicator=document.createElement("span");this.email_form_indicator.style.position="absolute";this.email_form_indicator.style.bottom="15px";this.email_form_indicator.style.right="10px";this.email_form_indicator.style.whiteSpace=
"nowrap";this.email_form_indicator.innerHTML=this._i18n[this.language].email_send_error;this.email_form.insert({bottom:this.email_form_indicator});window[this.email_var]=null}this.email_retries++},addCss:function(){if(this.options.cssURI){var a=document.createElement("link");a.rel="stylesheet";a.href=this.options.cssURI;a.media="all";var b=document.getElementsByTagName("HEAD");b.length>0&&b[0].appendChild(a);if(SAPO.Browser.IE&&this.options.cssURI=="http://js.sapo.pt/Assets/Images/ShareThis/style.css"){a=
document.createElement("link");a.rel="stylesheet";a.href="http://js.sapo.pt/Assets/Images/ShareThis/style.ie_all.css";a.media="all";var c=document.createElement("link");c.rel="stylesheet";c.href=SAPO.Browser.version<7?"http://js.sapo.pt/Assets/Images/ShareThis/style.ie6.css":"http://js.sapo.pt/Assets/Images/ShareThis/style.ie7_8.css";c.media="all";b[0].appendChild(a);b[0].appendChild(c)}}},debug:function(a){if(this.options.debug)if(window.console!=undefined)console.log(a);else{if(!this.debug_container){this.debug_container=
new Element("textarea");this.debug_container.id=this.element.id+"_dbg";this.element.insert({after:this.debug_container})}this.debug_container.value+=a+"\n"}},services:$H({sapo:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/sapo.gif",url:"http://links.sapo.pt/post?v=3&url=_URL_&title=_TITLE_",text:"SAPO Links"},delicious:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/delicious.gif",url:"http://del.icio.us/post?url=_URL_&title=_TITLE_",text:"del.icio.us"},digg:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/digg.gif",
url:"http://digg.com/submit?phase=2&url=_URL_&title=_TITLE_",text:"Digg"},reddit:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/reddit.gif",url:"http://reddit.com/submit?url=_URL_&title=_TITLE_",text:"Reddit"},twitter:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/twitter.gif",url:"http://twitter.com/home/?status=_URL_+_TITLE_+via+%40SAPO+ShareThis",text:"Twitter"},sphere:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/sphere.gif",url:"http://www.sphere.com/search?q=sphereit:_URL_&title=_TITLE_",
text:"Sphere"},stumbleupon:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/stumbleupon.gif",url:"http://www.stumbleupon.com/submit?url=_URL_&title=_TITLE_",text:"StumbleUpon"},technorati:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/technorati.gif",url:"http://technorati.com/faves?add=_URL_",text:"Technorati"},connotea:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/connotea.gif",url:"http://www.connotea.org/addpopup?continue=confirm&uri=_URL_&title=_TITLE_",text:"Connotea"},furl:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/furl.gif",
url:"http://furl.net/storeIt.jsp?u=_URL_&t=_TITLE_",text:"Furl"},google:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/google.gif",url:"http://www.google.com/bookmarks/mark?op=edit&bkmk=_URL_&title=_TITLE_",text:"Google bookmarks"},blinklist:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/blinklist.gif",url:"http://blinklist.com/index.php?Action=Blink/addblink.php&Url=_URL_&Title=_TITLE_",text:"Blinklist"},live:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/live.gif",url:"https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=_URL_&title=_TITLE_&top=1",
text:"Windows Live"},newsvine:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/newsvine.gif",url:"http://www.newsvine.com/_wine/save?u=_URL_&h=_TITLE_",text:"Newsvine"},tailrank:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/tailrank.gif",url:"http://tailrank.com/share/?link_href=_URL_&title=_TITLE_",text:"Tailrank"},bebo:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/bebo.gif",url:"http://www.bebo.com/c/share?Url=_URL_&Title=_TITLE_&MID=8974376238&TUUID=fc7850b8-964c-47bd-8a91-db1d2a5cad3c",
text:"Bebo"},myspace:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/myspace.gif",url:"http://www.myspace.com/index.cfm?fuseaction=postto&t=_TITLE&c=&u=_URL_&l=",text:"MySpace"},facebook:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/facebook.gif",url:"http://www.facebook.com/share.php?u=_URL_&t=_TITLE_",text:"Facebook"}}),videoServices:{hi5:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/hi5.gif",url:"http://www.hi5.com/friend/checkViewedVideo.do?t=_TITLE&url=_URL_&embeddable=true&simple=true",
text:"Hi5"},orkut:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/orkut.gif",url:"http://www.orkut.com/FavoriteVideos.aspx?u=_URL_",text:"Orkut"},liveSpaces:{icon:"http://js.sapo.pt/Assets/Images/ShareThis/livespaces.gif",url:"http://spaces.live.com/BlogIt.aspx?Title=_TITLE_&SourceURL=_URL_",text:"Live Spaces"}}};if(!SAPO.Widget||typeof SAPO.Widget=="undefined")SAPO.namespace("Widget");SAPO.Widget.DiarioRepublicaFotos=function(a){this.init(a)};
SAPO.Widget.DiarioRepublicaFotos.prototype={actualPage:0,actualPhoto:0,elements:[],init:function(a){this.options=Object.extend({slideshowTime:6E3,thumbWidth:88,thumbHeight:66,maxWidth:260,maxHeight:195,thumbMarginWidth:1,numPageLoad:3,hrefSeeMore:"http://fotos.sapo.pt/",hrefLogo:"http://fotos.sapo.pt/",dummyImage:"",lazyThumbTime:1500,pageContainer:false,imageContainer:false,linksTarget:"_blank",widget:false,pageLength:8,filterAdultContent:true,enableAuthorName:true,photosObj:"imageNavigation",slideshowDescriptionHeight:40,
callback:false},a||{});this.widget=s$(this.options.widget);this.widget.className="";this.authorElement=s$(this.options.authorElement);this.zoomPhoto=this.authorElement.getElementsByTagName("a")[1];this.waitingForLoading=function(b){b.stop()}.bindObjEvent(this);SAPO.Dom.Event.observe(this.zoomPhoto,"click",this.waitingForLoading);this.breakPagination=false;this.loadImageList()},loadImageList:function(){new SAPO.Communication.Ajax(window[this.options.photosObj].ajaxEndpoint,{postBody:window[this.options.photosObj].postBody,
method:"post",evalJS:"force",onSuccess:this.doStartActions.bindObj(this)})},doStartActions:function(a){a.responseJSON=a.responseText.evalJSON(true);if(typeof a.responseJSON=="undefined"||!a.responseJSON)return false;else if(a.responseJSON.result!="OK")return false;this.photosObj=a.responseJSON[this.options.photosObj];a=document.createElement("ul");a.id="thumbnailsNavScript";a.style.display="none";this.firstRun=true;this.previousPage=s$("previousThumbnailsNav");this.nextPage=s$("nextThumbnailsNav");
this.nextPage.parentNode.insertBefore(a,this.nextPage);this.imageContainer=s$(this.options.imageContainer);this.pageContainer=s$("thumbnailsNavScript");this.isPaused=this.timeoutId=false;this.seeOptionsContainer=SAPO.Dom.Selector.select("#ver_mais ul")[0];this.seeOptionsContainer.className="";this.slideshowLink=SAPO.Dom.Selector.select(".slideshow_link")[0]||null;this.seeAllLink=SAPO.Dom.Selector.select(".todas_link")[0]||null;this.seePageLink=SAPO.Dom.Selector.select(".menos_link")[0]||null;a=function(c){SAPO.Dom.Event.stop(c);
this.enableSlideshow(true)}.bindObjEvent(this);var b=function(c){SAPO.Dom.Event.stop(c);this.enableSlideshow(false)}.bindObjEvent(this);this.slideshowLink!==null&&SAPO.Dom.Event.observe(this.slideshowLink,"click",a);SAPO.Dom.Event.observe(this.seeAllLink,"click",function(c){SAPO.Dom.Event.stop(c);this.forceThumbLoad();this.fullModeOn=true;this.widget.className="all";this.pageContainer.style.left="0px";SAPO.Dom.Css.addClassName(this.seeAllLink.parentNode,"hidden");SAPO.Dom.Css.removeClassName(this.seePageLink.parentNode,
"hidden");SAPO.Utility.Cookie.set("seeAllKamerafotos","1")}.bindObjEvent(this));SAPO.Dom.Event.observe(this.seePageLink,"click",function(c){SAPO.Dom.Event.stop(c);this.changePage(0);this.fullModeOn=false;this.widget.className="";SAPO.Dom.Css.addClassName(this.seePageLink.parentNode,"hidden");SAPO.Dom.Css.removeClassName(this.seeAllLink.parentNode,"hidden");SAPO.Utility.Cookie.set("seeAllKamerafotos","0")}.bindObjEvent(this));SAPO.Dom.Event.observe(this.previousPage,"click",this.handleNavPageClick.bindObjEvent(this,
-1));SAPO.Dom.Event.observe(this.nextPage,"click",this.handleNavPageClick.bindObjEvent(this,1));this.initialPhotoIndex=this.photosObj.selectedImageOffset;if(this.options.enableAuthorName){this.bodyElement=document.getElementsByTagName("body")[0];SAPO.Dom.Event.observe(this.zoomPhoto,"click",b);SAPO.Dom.Event.stopObserving(this.zoomPhoto,"click",this.waitingForLoading)}this.buildResult();this.windowChanged=false;a=SAPO.Utility.Cookie.get();if(this.elements.length>8&&typeof a.seeAllKamerafotos!="undefined"&&
a.seeAllKamerafotos=="1"){this.forceThumbLoad();this.fullModeOn=this.breakPagination=true;this.widget.className="all";this.pageContainer.style.left="0px";SAPO.Dom.Css.addClassName(this.seeAllLink.parentNode,"hidden");SAPO.Dom.Css.removeClassName(this.seePageLink.parentNode,"hidden")}this.viewportWidth=SAPO.Utility.Dimensions.viewportWidth();this.viewportHeight=SAPO.Utility.Dimensions.viewportHeight();SAPO.Dom.Event.observe(window,"resize",function(){var c=SAPO.Utility.Dimensions.viewportWidth(),d=
SAPO.Utility.Dimensions.viewportHeight();if(this.viewportWidth!=c||this.viewportHeight!=d){this.viewportWidth=c;this.viewportHeight=d;this.setZoomImage(true)}}.bindObjEvent(this))},setZoomImage:function(a){if(a===true)this.windowChanged=true;for(var b=this.elements[0].zoom,c=b.length-1,d=SAPO.Utility.Dimensions.viewportWidth()-10,e=SAPO.Utility.Dimensions.viewportHeight()-10-this.options.slideshowDescriptionHeight,h;c;){h=b[c];if(h.w<d&&h.h<e)break;c--}this.zoomImageIndex=c;if((h=s$("slideshow_total"))&&
a===true){a=document.getElementsByTagName("body")[0];a.style.width=d+10+"px";a.style.height=e+10+"px";a.style.overflow="hidden";d=this.elements[0];this.slideshow("do not change timeout");h.parentNode.style.zIndex="99999999";e=h.parentNode;a=SAPO.Utility.Dimensions.viewportHeight()-d.zoom[this.zoomImageIndex].h-this.options.slideshowDescriptionHeight-20;e.style.top=Math.floor((a>0?a:0)/2,0)+SAPO.Utility.Dimensions.scrollHeight()+"px";a=SAPO.Utility.Dimensions.viewportWidth()-d.zoom[this.zoomImageIndex].w;
e.style.left=Math.floor((a>0?a:0)/2,0)+"px";e.style.width=d.zoom[this.zoomImageIndex].w+"px";h.className="size_"+this.zoomImageIndex;h=SAPO.Dom.Selector.select(".sapo_widget_dialog_overlay");h[0].style.zIndex="99999999";h[0].style.width=SAPO.Utility.Dimensions.pageWidth()+"px";h[0].style.height=SAPO.Utility.Dimensions.pageHeight()+"px"}},buildResult:function(){for(var a=Math.floor(this.photosObj.selectedImageOffset/this.options.pageLength,0),b=this.photosObj.imageList,c=false,d=0,e=b.length;d<e;d++){c=
b[d];this.elements.push({href:c.l,title:c.f,author:c.a,thumb:c.g,image:"",zoom:c.z,description:c.d})}this.numElements=this.elements.length;b=Math.floor(this.numElements/this.options.pageLength,0);b==0&&SAPO.Dom.Css.addClassName(this.seeAllLink,"hidden");this.photosObj.page=window[this.options.photosObj].page;if(this.photosObj.page)a=parseInt(this.photosObj.page);if(a==0){this.prevIndexLoad=-1;this.nextIndexLoad=this.options.pageLength*this.options.numPageLoad}else if(b==a){this.prevIndexLoad=this.options.pageLength*
(b-this.options.numPageLoad);this.nextIndexLoad=this.numElements}else{this.prevIndexLoad=(a-Math.floor(this.options.numPageLoad/2))*this.options.pageLength;this.nextIndexLoad=(a+Math.floor(this.options.numPageLoad/2))*this.options.pageLength}this.allThumbsLoaded=false;this.createThumbs();this.setZoomImage(false);this.changePage(a)},createThumbs:function(){for(var a="",b=0,c=this.elements.length;b<c;b++){a+='<li><a href="'+this.elements[b].href+'"><img id="f'+b+'" '+(b==this.photosObj.selectedImageOffset?
'class="active_foto"':"")+" ";a+=this.prevIndexLoad<b&&b<this.nextIndexLoad?'src="'+this.elements[b].thumb+'" ':'src="'+this.options.dummyImage+'" ';a+='border="0" alt="'+this.elements[b].title+'" width="'+this.options.thumbWidth+'" height="'+this.options.thumbHeight+'" /><em></em></a></li>'}this.pageContainer.innerHTML=a;setTimeout(this.lazyThumbLoad.bindObj(this),this.options.lazyThumbTime)},lazyThumbLoad:function(){var a=false,b=false;if(this.prevIndexLoad>=0){setTimeout(function(c){for(c=c;c>=
0;c--)s$("f"+c).src=this.elements[c].thumb}.bindObj(this,this.prevIndexLoad),0);this.prevIndexLoaded-=this.options.pageLength}else a=true;if(this.nextIndexLoad<this.numElements){setTimeout(function(c){for(c=c;c<this.numElements;c++)s$("f"+c).src=this.elements[c].thumb}.bindObj(this,this.nextIndexLoad),0);this.nextIndexLoaded+=this.options.pageLength}else b=true;if(a&&b)this.allThumbsLoaded=true;else setTimeout(this.lazyThumbLoad.bindObj(this),this.options.lazyThumbTime)},forceThumbLoad:function(){if(!this.allThumbsLoaded){setTimeout(function(){for(var a=
this.prevIndexLoad;a>=0;a--)s$("f"+a).src=this.elements[a].thumb}.bindObj(this),0);setTimeout(function(){for(var a=this.nextIndexLoad;a<this.numElements;a++)s$("f"+a).src=this.elements[a].thumb}.bindObj(this),0)}},changePage:function(a){if(typeof this.currentPageSlide=="undefined")this.currentPageSlide=this.photosObj.page?parseInt(this.photosObj.page):0;var b=this.actualPage+a;if(!(b<0||b*this.options.pageLength>=this.elements.length)){this.actualPage=b;if(this.actualPage*this.options.pageLength>=
this.elements.length)b=this.actualPage=Math.floor((this.elements.length-1)/this.options.pageLength);this.previousPage.className=b==0?"prev disabled":"prev";this.nextPage.className=b*this.options.pageLength+this.options.pageLength>this.elements.length?"next disabled":"next";this.actualPage=b;b=this.currentPageSlide;var c=this.options.pageLength*this.actualPage*(this.options.thumbWidth+this.options.thumbMarginWidth);this.currentPageSlide=c;this.changePageEffect(-b,-c,a)}},changePageEffect:function(a,
b,c){(function d(e,h,k,p){if(this.breakPagination){this.breakPagination=false;if(this.firstRun){this.firstRun=false;k.parentNode.removeChild(s$("thumbnailsNav"));k.style.display="block"}}else if((Math.abs(h)-Math.abs(e))*p<=0.9){k.style.left=h+"px";if(this.firstRun){this.firstRun=false;k.parentNode.removeChild(s$("thumbnailsNav"));k.style.display="block"}}else{e=h+(Math.abs(h)-Math.abs(e))*0.5;k.style.left=e+"px";setTimeout(d.bindObj(this,e,h,k,p),25)}}).bindObj(this)(a,b,this.pageContainer,c)},enableSlideshow:function(a){this.isPaused=
a?false:true;this.actualPhoto=this.initialPhotoIndex;SAPO.Component.Dialog.info({message:'<div id="slideshow_total" class="size_'+this.zoomImageIndex+'"><div id="slideshow_total_photo" style="height:'+this.elements[this.actualPhoto].zoom[this.zoomImageIndex].h+'px"><img onload="try{this.parentNode.style.height=SAPO.Utility.Dimensions.elementHeight(this)+\'px\';}catch(e){}" src="'+this.elements[this.actualPhoto].zoom[this.zoomImageIndex].u+'"  /></div><div id="slideshow_total_navigation"><div class="buttons_container"><a href="#" id="slideshow_total_previous" title="Foto Anterior. Atalho: <-">PREVIOUS</a><a href="#" id="slideshow_total_control" title="Play/Pause. Atalho: Barra de espa&ccedil;o">PLAY/PAUSE</a><a href="#close" title="Fechar. Atalho: ESC" id="slideshow_total_close">CLOSE</a><a href="#next" id="slideshow_total_next" title="Pr&oacute;xima Foto. Atalho: ->">NEXT</a></div></div><div id="info_foto_slideshow"><a href="'+
this.elements[this.actualPhoto].href+'" class="open_photo">Ir para a foto</a><h3><em>'+this.elements[this.actualPhoto].title+"</em>"+(this.elements[this.actualPhoto].author!=""?' de <span class="fotoAuthor">'+this.elements[this.actualPhoto].author+"</span>":"")+'</h3><div class="clear"></div><p>'+this.elements[this.actualPhoto].description+"</p></div></div>",width:this.elements[this.actualPhoto].zoom[this.zoomImageIndex].w+"px",onComplete:function(){var b=this.elements[this.actualPhoto],c=document.getElementsByTagName("body")[0];
c.style.height=SAPO.Utility.Dimensions.viewportHeight()+"px";c.style.overflow="hidden";c=s$("slideshow_total").parentNode;var d=SAPO.Utility.Dimensions.viewportHeight()-b.zoom[this.zoomImageIndex].h-this.options.slideshowDescriptionHeight-20;c.style.top=Math.floor((d>0?d:0)/2,0)+SAPO.Utility.Dimensions.scrollHeight()+"px";b=SAPO.Utility.Dimensions.viewportWidth()-b.zoom[this.zoomImageIndex].w;c.style.left=Math.floor((b>0?b:0)/2,0)+"px";c.style.zIndex="99999999";b=SAPO.Dom.Selector.select(".sapo_widget_dialog_overlay");
b[0].style.zIndex="99999999";b[0].style.width=SAPO.Utility.Dimensions.viewportWidth()+"px";this.setZoomImage(true);this.slideshowImgContainer=s$("slideshow_total_photo");this.handleWrapper=this.handleSlideshowNavigation.bindObjEvent(this);SAPO.Dom.Event.observe(this.bodyElement,"click",this.handleWrapper);SAPO.Dom.Event.observe(document,"keyup",this.handleWrapper);b=s$("slideshow_total_control");if(this.isPaused){SAPO.Dom.Css.addClassName(b,"play");SAPO.Dom.Css.removeClassName(b,"pause")}else{SAPO.Dom.Css.addClassName(b,
"pause");SAPO.Dom.Css.removeClassName(b,"play");this.timeoutId=setTimeout(function(){this.actualPhoto=this.elements.length-1>this.actualPhoto?this.actualPhoto+1:0;this.slideshow()}.bindObj(this),this.options.slideshowTime)}}.bindObj(this)})},handleSlideshowNavigation:function(a){SAPO.Dom.Event.stop(a);var b=a.target||a.srcElement;if(a.type=="keyup")value=a.keyCode;else if(b.className=="open_photo")window.location=b.href;else if(b.tagName.toLowerCase()=="img"){b=b.parentNode;value=b.id||""}else if(b.tagName.toLowerCase()==
"a")value=b.id||"";else return;switch(value){case "slideshow_total_close":case 27:if(this.timeoutId){clearTimeout(this.timeoutId);this.timeoutId=false}a=document.getElementsByTagName("body")[0];a.style.width="";a.style.height="";a.style.overflow="auto";SAPO.Component.Dialog.removeLayer();SAPO.Dom.Event.stopObserving(this.bodyElement,"click",this.handleWrapper);SAPO.Dom.Event.stopObserving(document,"keyup",this.handleWrapper);return;case "slideshow_total_previous":case 37:if(this.timeoutId){clearTimeout(this.timeoutId);
this.timeoutId=false}this.actualPhoto=this.actualPhoto==0?this.elements.length-1:this.actualPhoto-1;break;case "slideshow_total_next":case "slideshow_total_photo":case 39:if(this.timeoutId){clearTimeout(this.timeoutId);this.timeoutId=false}this.actualPhoto=this.elements.length-1>this.actualPhoto?this.actualPhoto+1:0;break;case "slideshow_total_control":case 32:a=s$("slideshow_total_control");if(this.isPaused){SAPO.Dom.Css.addClassName(a,"pause");SAPO.Dom.Css.removeClassName(a,"play");this.isPaused=
false;this.actualPhoto=this.elements.length-1>this.actualPhoto?this.actualPhoto+1:0;this.slideshow()}else{SAPO.Dom.Css.addClassName(a,"play");SAPO.Dom.Css.removeClassName(a,"pause");if(this.timeoutId){clearTimeout(this.timeoutId);this.timeoutId=false}this.isPaused=true}default:return}this.slideshow()},slideshow:function(){this.options.callback&&setTimeout(this.options.callback,0);var a=this.elements[this.actualPhoto],b='<img onload="try{this.parentNode.style.height=SAPO.Utility.Dimensions.elementHeight(this)+\'px\';}catch(e){}" src="'+
a.zoom[this.zoomImageIndex].u+'" title="'+a.title+'" border="0" />';a='<a href="'+a.href+'" class="open_photo">Ir para a foto</a><h3><em>'+a.title+"</em>"+(a.author!=""?' de <span class="fotoAuthor">'+a.author+"</span>":"")+'</h3><div class="clear"></div><p>'+a.description+"</p></div>";this.slideshowImgContainer=s$("slideshow_total_photo");this.slideshowEffect(100,this.slideshowImgContainer,b,a);if(this.options.slideshowTime&&!this.isPaused){if(this.timeoutId){clearTimeout(this.timeoutId);this.timeoutId=
false}this.timeoutId=setTimeout(function(){this.actualPhoto=this.elements.length-1>this.actualPhoto?this.actualPhoto+1:0;this.slideshow()}.bindObj(this),this.options.slideshowTime)}},slideshowEffect:function(a,b,c,d){if(c)if(a)a-=10;else{b.innerHTML=c;s$("info_foto_slideshow").innerHTML=d;c=false}else{if(a==100)return true;a+=10}b.style.opacity=a/100;b.style.filter="alpha(opacity="+a+")";setTimeout(this.slideshowEffect.bindObj(this,a,b,c,d),25)},handleAuthor:function(a,b){SAPO.Dom.Event.stop(a);this.authorElement.style.display=
b?"block":"none"},reappendAuthor:function(){this.imageContainer.appendChild(this.authorElement)},handleThumbClick:function(a){SAPO.Dom.Event.stop(a);clearTimeout(this.timeoutId);this.timeoutId=false;this.actualPhoto=parseInt((a.target||a.srcElement).id);this.slideshow()},handleNavPageClick:function(a,b){SAPO.Dom.Event.stop(a);this.changePage(b)},debug:function(){}};SAPO.Widget.DiarioRepublicaHomeFotos=function(a){this.init(a)};
SAPO.Widget.DiarioRepublicaHomeFotos.prototype={elements:[],init:function(a){this.options=Object.extend({slideshowTime:6E3,imageContainer:false,photosObj:"highlightsList"},a||{});this.imageContainer=s$(this.options.imageContainer);this.buildImageList();if(this.options.slideshowTime&&this.elements.length>1){this.actualPhoto=window[this.options.photosObj].selectedImageOffset;this.timeoutId=setTimeout(this.slideshow.bindObj(this),this.options.slideshowTime)}},buildImageList:function(){this.elements=
window[this.options.photosObj].imageList},slideshow:function(){this.actualPhoto=this.elements.length-1>this.actualPhoto?this.actualPhoto+1:0;var a=this.elements[this.actualPhoto];this.slideshowEffect(100,'<a href="'+a.l+'" title="'+a.f+'"><img src="'+a.g+'" alt="'+a.f+'" border="0" /></a>');if(this.options.slideshowTime&&arguments.length==0)this.timeoutId=setTimeout(this.slideshow.bindObj(this),this.options.slideshowTime)},slideshowEffect:function(a,b){if(b)if(a)a-=10;else{this.imageContainer.innerHTML=
b;this.authorElement&&this.reappendAuthor();b=false}else{if(a==100)return true;a+=10}this.imageContainer.style.opacity=a/100;this.imageContainer.style.filter="alpha(opacity="+a+")";setTimeout(this.slideshowEffect.bindObj(this,a,b),25)}};if(!SAPO.Utility||typeof SAPO.Utility=="undefined")SAPO.namespace("Utility");
SAPO.Utility.handleFavorites=function(a){if(typeof ajaxInfo=="undefined")return false;this.options=Object.extend({myAlbum:false,callback:false},a||{});this.requestLocked=false;this.addBtnContainer=s$("addToFavorites");this.removeBtnContainer=s$("removeFromFavorites");this.adding=s$("addingToFavorites");this.removing=s$("removingFromFavorites");this.wrapClick=function(b){SAPO.Dom.Event.stop(b)}.bindObjEvent(this);this.isAdding=SAPO.Dom.Css.hasClassName(this.removeBtnContainer,"hidden");SAPO.Dom.Event.observe(this.addBtnContainer.getElementsByTagName("a")[0],
"click",this.handleClick.bindObjEvent(this,this.addBtnContainer));SAPO.Dom.Event.observe(this.removeBtnContainer.getElementsByTagName("a")[0],"click",this.handleClick.bindObjEvent(this,this.removeBtnContainer))};
SAPO.Utility.handleFavorites.prototype={makeRequest:function(a){new SAPO.Communication.Ajax(ajaxInfo.endpoint,{method:ajaxInfo.method,postBody:ajaxInfo.postBody,onCreate:function(b){SAPO.Dom.Css.addClassName(b,"hidden");SAPO.Dom.Css.removeClassName(this.isAdding?this.adding:this.removing,"hidden")}.bindObj(this,a),onComplete:function(b){if(!b.responseJSON)return this.requestLocked=false;if(b.responseJSON.result=="ADDED"){this.options.callback&&this.options.callback("ADDED",b.responseJSON.count);if(this.options.myAlbum){var c=
SAPO.Dom.Selector.select("#foto_list .active_foto");if(c.length){SAPO.Dom.Event.stopObserving(c[0].parentNode,"click",this.wrapClick);SAPO.Dom.Css.removeClassName(c[0].parentNode.parentNode,"removed")}}this.isAdding=false;this.toggleBtn()}if(b.responseJSON.result=="REMOVED"){this.options.callback&&this.options.callback("REMOVED",b.responseJSON.count);if(this.options.myAlbum){c=SAPO.Dom.Selector.select("#foto_list .active_foto");if(c.length){SAPO.Dom.Event.observe(c[0].parentNode,"click",this.wrapClick);
SAPO.Dom.Css.addClassName(c[0].parentNode.parentNode,"removed")}}this.isAdding=true;this.toggleBtn()}this.requestLocked=false}.bindObj(this)})},toggleBtn:function(){SAPO.Dom.Css.addClassName(this.removing,"hidden");SAPO.Dom.Css.addClassName(this.adding,"hidden");this.isAdding?SAPO.Dom.Css.removeClassName(this.addBtnContainer,"hidden"):SAPO.Dom.Css.removeClassName(this.removeBtnContainer,"hidden")},handleClick:function(a,b){SAPO.Dom.Event.stop(a);if(!this.requestLocked){this.requestLocked=true;this.makeRequest(b)}},
debug:function(){}};
