/** * This page is generated by Nibble 1.4 * The portal engine by Devidens. * Copyright (C) Devidens Ltd. 2006-2011 * http://devidens.hu/ */ if(!window.console||!console.firebug) {var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++) {ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;} var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);} function safe_add(x,y) {var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);} function bit_rol(num,cnt) {return(num<>>(32-cnt));} function str2binl(str) {var bin=Array();var mask=(1<>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;} function binl2str(bin) {var str="";var mask=(1<>5]>>>(i%32))&mask);return str;} function binl2hex(binarray) {var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i>2]>>((i%4)*8+4))&0xF)+ hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);} return str;} function binl2b64(binarray) {var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++) {if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}} return str;} JSFHaddEvent=function(o,e,f,s){var r=o[r="_"+(e="on"+e)]=o[r]||(o[e]?[[o[e],o]]:[]),a,c,d;r[r.length]=[f,s||o],o[e]=function(e){try{(e=e||(window.event?(arguments=[].slice.call(arguments)).unshift(e=event)||1&&e:{})).preventDefault||(e.preventDefault=function(){e.returnValue=false;});e.stopPropagation||(e.stopPropagation=function(){e.cancelBubble=true;});e.target||(e.target=e.srcElement||null);e.key=(e.which+1||e.keyCode+1)-1||0;}catch(f){} for(d=1,f=r.length;f;r[--f]&&(a=r[f][0],o=r[f][1],a.apply?c=a.apply(o,arguments):(o._=a,c=o._(e),o._=null),d&=c!==false));return e=null,!!d;}};JSFHremoveEvent=function(o,e,f,s){for(var i=(e=o["_on"+e]||[]).length;i;) if(e[--i]&&e[i][0]==f&&(s||o)==e[i][1]) return delete e[i];return false;};MaskInput=function(f,m){function mask(e){var patterns={"1":/[A-Z]/i,"2":/[0-9]/,"4":/[\xC0-\xFF]/i,"8":/./},rules={"a":3,"A":7,"9":2,"C":5,"c":1,"*":8};function accept(c,rule){for(var i=1,r=rules[rule]||0;i<=r;i<<=1) if(r&i&&patterns[i].test(c)) break;return i<=r||c==rule;} var k,mC,r,c=String.fromCharCode(k=e.key),l=f.value.length;(!k||k==8?1:(r=/^(.)\^(.*)$/.exec(m))&&(r[0]=r[2].indexOf(c)+1)+1?r[1]=="O"?r[0]:r[1]=="E"?!r[0]:accept(c,r[1])||r[0]:(l=(f.value+=m.substr(l,(r=/[A|9|C|\*]/i.exec(m.substr(l)))?r.index:l)).length)-1,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,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){if(window.HTMLElement&&window.HTMLElement.prototype) return true;if(window.Element&&window.Element.prototype) return true;})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=='undefined') return true;var div=document.createElement('div');if(div['__proto__']&&div['__proto__']!==document.createElement('form')['__proto__']){return true;} return false;})()},ScriptFragment:']*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions=false;var Abstract={};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}} return result;} function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});} function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this);} function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);} function strip(){return this.replace(/^\s+/,'').replace(/\s+$/,'');} function stripTags(){return this.replace(/<\/?[^>]+>/gi,'');} function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');} function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});} function evalScripts(){return this.extractScripts().map(function(script){return eval(script)});} function escapeHTML(){escapeHTML.text.data=this;return escapeHTML.div.innerHTML;} function unescapeHTML(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';} function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);} else hash[key]=value;} return hash;});} function toArray(){return this.split('');} function succ(){return this.slice(0,this.length-1)+ String.fromCharCode(this.charCodeAt(this.length-1)+1);} function times(count){return count<1?'':new Array(count+1).join(this);} function camelize(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i-1;} function startsWith(pattern){return this.indexOf(pattern)===0;} function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;} function empty(){return this=='';} function blank(){return/^\s*$/.test(this);} function interpolate(object,pattern){return new Template(this,pattern).evaluate(object);} return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate};})());Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);if('<\n>'.escapeHTML()!=='<\n>'){String.prototype.escapeHTML=function(){return this.replace(/&/g,'&').replace(//g,'>');}} if('<\n>'.unescapeHTML()!=='<\n>'){String.prototype.unescapeHTML=function(){return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');}} var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements)) object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);} return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function each(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;} return this;} function eachSlice(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)=result) result=value;});return result;} function min(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||valueb?1:0;}).pluck('value');} function toArray(){return this.map();} function zip(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last())) iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});} function size(){return this.toArray().length;} function inspect(){return'#';} return{each:each,eachSlice:eachSlice,all:all,every:all,any:any,some:any,collect:collect,map:collect,detect:detect,findAll:findAll,select:findAll,filter:findAll,grep:grep,include:include,member:include,inGroupsOf:inGroupsOf,inject:inject,invoke:invoke,max:max,min:min,partition:partition,pluck:pluck,reject:reject,sortBy:sortBy,toArray:toArray,entries:toArray,zip:zip,size:size,inspect:inspect,find:detect};})();function $A(iterable){if(!iterable)return[];if('toArray'in iterable)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;} function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];} Array.from=$A;(function(){var arrayProto=Array.prototype,slice=arrayProto.slice,_each=arrayProto.forEach;function each(iterator){for(var i=0,length=this.length;i';} function toJSON(){return Object.toJSON(this.toObject());} function clone(){return new Hash(this);} return{initialize:initialize,_each:_each,set:set,get:get,unset:unset,toObject:toObject,toTemplateReplacements:toObject,keys:keys,values:values,index:index,merge:merge,update:update,toQueryString:toQueryString,inspect:inspect,toJSON:toJSON,clone:clone};})());Hash.from=$H;Object.extend(Number.prototype,(function(){function toColorPart(){return this.toPaddedString(2,16);} function succ(){return this+1;} function times(iterator,context){$R(0,this,true).each(iterator,context);return this;} function toPaddedString(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;} function toJSON(){return isFinite(this)?this.toString():'null';} function abs(){return Math.abs(this);} function round(){return Math.round(this);} function ceil(){return Math.ceil(this);} function floor(){return Math.floor(this);} return{toColorPart:toColorPart,succ:succ,times:times,toPaddedString:toPaddedString,toJSON:toJSON,abs:abs,round:round,ceil:ceil,floor:floor};})());function $R(start,end,exclusive){return new ObjectRange(start,end,exclusive);} var ObjectRange=Class.create(Enumerable,(function(){function initialize(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;} function _each(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}} function include(value){if(value1&&!((readyState==4)&&this._complete)) this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['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) headers['Connection']='close';} if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push)) for(var i=0,length=extras.length;i=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);} var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) this.evalResponse();} try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);} if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protocol,domain:document.domain,port:location.port?':'+location.port:''}));},getHeader:function(name){try{return this.transport.getResponseHeader(name)||null;}catch(e){return null;}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();} if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank()) return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);} else options.insertion(receiver,responseText);} else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;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(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.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 $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);} if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(global.Element,element||{});if(element)global.Element.prototype=element.prototype;})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:(function(){var SELECT_ELEMENT_INNERHTML_BUGGY=(function(){var el=document.createElement("select"),isBuggy=true;el.innerHTML="";if(el.options&&el.options[0]){isBuggy=el.options[0].nodeName.toUpperCase()!=="OPTION";} el=null;return isBuggy;})();var TABLE_ELEMENT_INNERHTML_BUGGY=(function(){try{var el=document.createElement("table");if(el&&el.tBodies){el.innerHTML="test";var isBuggy=typeof el.tBodies[0]=="undefined";el=null;return isBuggy;}}catch(e){return true;}})();var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING=(function(){var s=document.createElement("script"),isBuggy=false;try{s.appendChild(document.createTextNode(""));isBuggy=!s.firstChild||s.firstChild&&s.firstChild.nodeType!==3;}catch(e){isBuggy=true;} s=null;return isBuggy;})();function update(element,content){element=$(element);if(content&&content.toElement) content=content.toElement();if(Object.isElement(content)) return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName==='SCRIPT'&&SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING){element.text=content;return element;} if(SELECT_ELEMENT_INNERHTML_BUGGY||TABLE_ELEMENT_INNERHTML_BUGGY){if(tagName in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node);});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});} else{element.innerHTML=content.stripScripts();}} else{element.innerHTML=content.stripScripts();} content.evalScripts.bind(content).defer();return element;} return update;})(),replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());} element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML))) insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;} content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();} return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper)) $(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode) element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property]) if(element.nodeType==1) elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return Element.select(element,"*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector)) selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id');if(id)return id;do{id='anonymous_element_'+Element.idCounter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:(function(){var iframeGetAttributeThrowsError=(function(){var el=document.createElement('iframe'),isBuggy=false;document.documentElement.appendChild(el);try{el.getAttribute('type',2);}catch(e){isBuggy=true;} document.documentElement.removeChild(el);el=null;return isBuggy;})();return function(element,name){element=$(element);if(iframeGetAttributeThrowsError&&name==='type'&&element.tagName.toUpperCase()=='IFRAME'){return element.getAttribute('type');} if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}} return element.getAttribute(name);}})(),writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null) element.removeAttribute(name);else if(value===true) element.setAttribute(name,name);else element.setAttribute(name,value);} return element;},getHeight:function(element){return $(element).getDimensions().height;},getWidth:function(element){return $(element).getDimensions().width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className)) element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue)) element.removeChild(node);node=nextNode;} return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition) return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains) return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode) if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;} if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;} for(var property in styles) if(property=='opacity')element.setOpacity(styles[property]);else elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null) return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';if(originalPosition!='fixed') els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}} return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';} return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden') element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body) if(Element.getStyle(element,'position')!='static') return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();} if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;} if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()]) return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];} else{properties=['border-left-width','padding-left','padding-right','border-right-width'];} return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});} else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent} catch(e){return $(document.body)} var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent} catch(e){return Element._returnOffset(0,0)} var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed') offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent} catch(e){return Element._returnOffset(0,0)} return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/)) if(value[1])return parseFloat(value[1])/100;return 1.0;} if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none')) return element['offset'+style.capitalize()]+'px';return null;} return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');} element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal')) element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations=(function(){var classProp='className';var forProp='for';var el=document.createElement('div');el.setAttribute(classProp,'x');if(el.className!=='x'){el.setAttribute('class','x');if(el.className==='x'){classProp='class';}} el=null;el=document.createElement('label');el.setAttribute(forProp,'x');if(el.htmlFor!=='x'){el.setAttribute('htmlFor','x');if(el.htmlFor==='x'){forProp='htmlFor';}} el=null;return{read:{names:{'class':classProp,'className':classProp,'for':forProp,'htmlFor':forProp},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:(function(){var el=document.createElement('div');el.onclick=Prototype.emptyFunction;var value=el.getAttribute('onclick');var f;if(String(value).indexOf('{')>-1){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;attribute=attribute.toString();attribute=attribute.split('{')[1];attribute=attribute.split('}')[0];return attribute.strip();}} else if(value===''){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;return attribute.strip();}} el=null;return f;})(),_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function _descendants(element){var nodes=element.getElementsByTagName('*'),results=[];for(var i=0,node;node=nodes[i];i++) if(node.tagName!=="!") results.push(node);return results;} Element.Methods.down=function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?_descendants(element)[expression]:Element.select(element,expression)[index||0];}})();}} else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};} else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1) if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){} return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body) if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};} if('outerHTML'in document.documentElement){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;} content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling) fragments.each(function(node){parent.insertBefore(node,nextSibling)});else fragments.each(function(node){parent.appendChild(node)});} else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};} Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.nextSibling);},tags:{TABLE:['','
',1],TBODY:['','
',2],TR:['','
',3],TD:['
','
',4],SELECT:['',1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD});}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(div){if(!Prototype.BrowserFeatures.ElementExtensions&&div['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=div['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;} div=null;})(document.createElement('div')) Element.extend=(function(){function checkDeficiency(tagName){if(typeof window.Element!='undefined'){var proto=window.Element.prototype;if(proto){var id='_'+(Math.random()+'').slice(2);var el=document.createElement(tagName);proto[id]='x';var isBuggy=(el[id]!=='x');delete proto[id];el=null;return isBuggy;}} return false;} function extendElementWith(element,methods){for(var property in methods){var value=methods[property];if(Object.isFunction(value)&&!(property in element)) element[property]=value.methodize();}} var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY=checkDeficiency('object');var HTMLAPPLETELEMENT_PROTOTYPE_BUGGY=checkDeficiency('applet');if(Prototype.BrowserFeatures.SpecificElementExtensions){if(HTMLOBJECTELEMENT_PROTOTYPE_BUGGY&&HTMLAPPLETELEMENT_PROTOTYPE_BUGGY){return function(element){if(element&&element.tagName){var tagName=element.tagName.toUpperCase();if(tagName==='OBJECT'||tagName==='APPLET'){extendElementWith(element,Element.Methods);if(tagName==='OBJECT'){extendElementWith(element,Element.Methods.ByTag.OBJECT)} else if(tagName==='APPLET'){extendElementWith(element,Element.Methods.ByTag.APPLET)}}} return element;}} return Prototype.K;} var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||typeof element._extendedByPrototype!='undefined'||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase();if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);extendElementWith(element,methods);element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){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 tagName=methods;methods=arguments[1];} if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);} function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName]) Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);} function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination)) destination[property]=value.methodize();}} function findDOMClass(tagName){var klass;var trans={"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(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];var element=document.createElement(tagName);var proto=element['__proto__']||element.constructor.prototype;element=null;return proto;} var elementPrototype=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(F.ElementExtensions){copy(Element.Methods,elementPrototype);copy(Element.Methods.Simulated,elementPrototype,true);} if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}} Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()};},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};(function(viewport){var B=Prototype.Browser,doc=document,element,property={};function getRootElement(){if(B.WebKit&&!doc.evaluate) return document;if(B.Opera&&window.parseFloat(window.opera.version())<9.5) return document.body;return document.documentElement;} function define(D){if(!element)element=getRootElement();property[D]='client'+D;viewport['get'+D]=function(){return element[property[D]]};return viewport['get'+D]();} viewport.getWidth=define.curry('Width');viewport.getHeight=define.curry('Height');})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(element){if(!(element=$(element)))return;var uid;if(element===window){uid=0;}else{if(typeof element._prototypeUID==="undefined") element._prototypeUID=[Element.Storage.UID++];uid=element._prototypeUID[0];} if(!Element.Storage[uid]) Element.Storage[uid]=$H();return Element.Storage[uid];},store:function(element,key,value){if(!(element=$(element)))return;if(arguments.length===2){element.getStorage().update(key);}else{element.getStorage().set(key,value);} return element;},retrieve:function(element,key,defaultValue){if(!(element=$(element)))return;var hash=Element.getStorage(element),value=hash.get(key);if(Object.isUndefined(value)){hash.set(key,defaultValue);value=defaultValue;} return value;},clone:function(element,deep){if(!(element=$(element)))return;var clone=element.cloneNode(deep);clone._prototypeUID=void 0;if(deep){var descendants=Element.select(clone,'*'),i=descendants.length;while(i--){descendants[i]._prototypeUID=void 0;}} return Element.extend(clone);}});var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:(function(){var IS_DESCENDANT_SELECTOR_BUGGY=(function(){var isBuggy=false;if(document.evaluate&&window.XPathResult){var el=document.createElement('div');el.innerHTML='
';var xpath=".//*[local-name()='ul' or local-name()='UL']"+"//*[local-name()='li' or local-name()='LI']";var result=document.evaluate(xpath,el,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);isBuggy=(result.snapshotLength!==2);el=null;} return isBuggy;})();return function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty"))) return false;if((/(\[[\w-]*?:|:checked)/).test(e)) return false;if(IS_DESCENDANT_SELECTOR_BUGGY)return false;return true;}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;} return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;} this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i";}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==='BackCompat'){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var div=document.createElement('div'),span=document.createElement('span');div.id="prototype_test_id";span.className='Test';div.appendChild(span);var isIgnored=(div.querySelector('#prototype_test_id .test')!==null);div=span=null;return isIgnored;})();} Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);},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)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v,len=p.length,name;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,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); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:'laterSibling',re:/^\s*~\s*/},{name:'child',re:/^\s*>\s*/},{name:'adjacent',re:/^\s*\+\s*/},{name:'descendant',re:/^\s/},{name:'tagName',re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:'id',re:/^#([\w\-\*]+)(\b|$)/},{name:'className',re:/^\.([\w\-\*]+)(\b|$)/},{name:'pseudo',re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:'attrPresence',re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:'attr',re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++) a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++) node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++) node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++) if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}} if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++) if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++) if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;} return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++) if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++) node.removeAttribute('_countedByPrototype');return nodes;}});} function $$(){return Selector.findChildElements(document,$A(arguments));} var Form={reset:function(form){form=$(form);form.reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);} else result[key]=value;}} return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){var elements=$(form).getElementsByTagName('*'),element,arr=[],serializers=Form.Element.Serializers;for(var i=0;element=elements[i];i++){arr.push(element);} return arr.inject([],function(elements,child){if(serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child));return elements;})},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);} if(form.hasAttribute('method')&&!options.method) options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}} return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type))) element.select();}catch(e){} return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value)) return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i=this.offset[1]&&y=this.offset[0]&&x=this.offset[1]&&this.ycomp=this.offset[0]&&this.xcomp0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Object.extend(document,{on:Event.observe}) Object.extend(Array.prototype,{pluck:function(property){var results=[];this.each(function(value){results.push(eval("value."+property));});return results;}});Element.addMethods({on:Event.observe,delegate:function(element,selector,event,handler){element.on(event,function(ev){if(element.$$(selector).include(ev.target)){return handler.apply(ev.target,arguments);}else{if(Nibble.debug){}}});},attr:Element.readAttribute,$$:function(element,selector){return element.getElementsBySelector(selector);},tags:function(element,tagName){return $A(element.getElementsByTagName(tagName));},highLightOk:function(element){new Effect.Highlight(element,{startcolor:"#00c000"});},insertAfter:function(thisNode,afterNode){var parent=afterNode.parentNode;if(parent.lastChild==afterNode){return parent.appendChild(thisNode);}else{return parent.insertBefore(thisNode,afterNode.nextSibling);}},showIf:function(element,condition){element=$(element);Element[condition?'show':'hide'](element);return element;},addClassNameIf:function(element,klass,condition){element=$(element);Element[condition?'addClassName':'removeClassName'](element,klass);return element;},zebra:function(element){var counter=0;$A(element.getElementsByTagName("tr")).each(function(tr){if(tr.visible()){counter++;if(counter%2==1){tr.addClassName("odd");tr.removeClassName("even");}else{tr.removeClassName("odd");tr.addClassName("even");}}});return element;},setOptions:function(id,options){var i=options.length;if(!(select=$(id)))return false;select.options.length=0;var innerHTM="";for(var i=0;i tbody > tr").addClassName("error");}else{Element.wrap(wrapThis,new Element("div",{className:"error"}));} var afterE=e.up("div.taxnumber")||e.up("div.layout_group")||e;afterE.insert({after:new Element("strong").update(message).addClassName("message")});}},removeError:function(e){var c=e.up(".error");if(c){c.removeClassName("error");var message=c.down(".message");if(message){message.remove();}}},toggle:function(e){if(e.hasClassName("opened")){e.$$(".x-hide").invoke("removeClassName","x-hide").invoke("addClassName","hide");}else{e.$$(".hide").invoke("removeClassName","hide").invoke("addClassName","x-hide");} e.toggleClassName("opened");}});Element.addMethods("input",{spinEdit:function(e,o){return new Nibble.SpinEdit(e,o);},mask:function(e,o){MaskInput(e,o);},ro:function(e,ro){return e.readOnly=!!ro;},initCalendar:function(input,index){var id=input.getAttribute("id");if(!id){var id="date_"+index;input.setAttribute("id",id);} var imgId=id+"-calendar";var icon=new Element("img",{"id":imgId,"src":"/images/icons/calendar.png","width":16,"height":16,"class":"icon_calendar"});switch(input.getAttribute("type")){case"datetime":case"datetime-local":var showsTime=true;var ifFormat="%Y-%m-%d %H:%M:%S";break;case"date":var showsTime=false;var ifFormat="%Y-%m-%d";break;} var div=new Element("div",{"class":"date"});div.appendChild(icon.cloneNode(true));input.wrap(div);Calendar.setup({inputField:id,ifFormat:ifFormat,showsTime:showsTime,button:imgId,singleClick:true,step:1,timeFormat:24,showOthers:true});},upload:function(e,o){if(e.type!="file")return;var oldName=e.name;e.name="file";Nibble.ajaxIndicator(true);var id="__uploadiframe";var formId=id+"_form";var form=$(formId)||e.wrap("form",{method:"POST",id:formId,action:"/-/",target:id,enctype:"multipart/form-data"});o["_upload"]="nibble";["tags","parser","_upload","table_name","table_id"].each(function(p){form.insert(new Element("input",{type:"hidden",name:p,value:o[p]}));});var ifr=e.parentNode.appendChild(new Element("iframe",{id:id,name:id,className:"hide"}));ifr.on("load",function(ev){var response=ev.currentTarget.contentDocument.body.textContent;console.info("File uploaded... fileId = "+response+"onLoad...") if(/^\d+$/.test(response)){o.onComplete(response);}else{var onError=o.onError||function(){}} form.reset();Nibble.ajaxIndicator(false);Element.remove.delay(0.001,ifr);});form.submit();}});Element.addMethods("form",{enterToTab:function(e){e.observe("keypress",function(ev){if(ev.target.tagName=="INPUT"&&ev.keyCode==13){if(ev.target.attr("type")=="submit"){ev.target.up("form").submit();} if(ev.target.up("thead")){return;} var prev;var inputs=e.$$("input:not([readonly]):not([type=checkbox]):not([type=radio]):not([disabled]):not([type=hidden])");var next=inputs.find(function(i){if(prev==ev.target){return true;}else{prev=i;return false;}});if(next){try{next.setAttribute("autocomplete","off");next.focus();next.select();}catch(e){}} ev.stop();}});},hasError:function(e){return e.$$(".error").length>0;}});Element.addMethods("img",{iconName:function(e){if(typeof(e.src)=="string"){var re=new RegExp("icons\/(.+).png","ig");var t=re.exec(e.src);if(t){return t[1];}}}});Object.extend(Array.prototype,{onclick:function(handler){this.each(function(input){input.observe("click",handler);});}});(function(){var origConstructor=Ajax.Request.prototype.initialize;if(origConstructor.bind){Ajax.Request.prototype.initialize=function(url,options){origConstructor.bind(this)(url,Object.extend(options,{onException:function(_,exp){throw exp}}));}}})();Array.prototype.without=function(){var values=$A(arguments).flatten();return this.select(function(value){return!values.include(value);});} Array.prototype.xor=function(b){return this.without(b).concat(b.without(this));} Function.prototype.benchmark=function(id){var __method=this,id=id||Math.random();return function(){__method.apply(__method,arguments);console.timeEnd(id)}.bind(__method);} Function.prototype.indicate=function(e){if(!e){return this;} var __method=this;return function(){var html=e.innerHTML;(function(){e.update(new Element("img",{src:"/images/ajax-load.gif"}));}).defer();__method.apply(this,arguments);(function(){e.update(html);}).defer();};} Array.prototype.cartesianProduct=function(){var a=this;if(a.length==0){return[];} if(a.length==1){var tmp=[];for(var i=0;i2)?a.shift().cartesianProduct():a[1];var tmp=[];for(var i=0;i=i+3){bits=(decStr.charCodeAt(i++)&0xff)<<16|(decStr.charCodeAt(i++)&0xff)<<8|decStr.charCodeAt(i++)&0xff;encOut+=base64s.charAt((bits&0x00fc0000)>>18)+ base64s.charAt((bits&0x0003f000)>>12)+ base64s.charAt((bits&0x00000fc0)>>6)+ base64s.charAt((bits&0x0000003f));} if(decStr.length-i>0&&decStr.length-i<3){dual=Boolean(decStr.length-i-1);bits=((decStr.charCodeAt(i++)&0xff)<<16)|(dual?(decStr.charCodeAt(i)&0xff)<<8:0);encOut+=base64s.charAt((bits&0x00fc0000)>>18)+ base64s.charAt((bits&0x0003f000)>>12)+ (dual?base64s.charAt((bits&0x00000fc0)>>6):'=')+'=';} return encOut} String.prototype.base64Decode=function(){var encStr=this;if(atob){return atob(encStr);} var base64s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var bits,decOut='',i=0;for(;i>16,(bits&0xff00)>>8,bits&0xff);} if(encStr.charCodeAt(i-2)==61) undecOut=decOut.substring(0,decOut.length-2);else if(encStr.charCodeAt(i-1)==61) undecOut=decOut.substring(0,decOut.length-1);else undecOut=decOut;return unescape(undecOut);} Array.prototype.sum=function(){for(var i=0,sum=0;i0){event.initEvent("dataavailable",true,true);}else{switch(createEvent){case"MouseEvents":event.initMouseEvent(eventName,true,true,window,0,0,0,0,0,false,false,false,false,0,null);break;default:event.initEvent(eventName,true,true);break;}}}else{var event=document.createEventObject();event.eventType="ondataavailable";} event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);} return event;}});var CookieJar=Class.create();CookieJar.prototype={appendString:"__CJ_",initialize:function(options){this.options={expires:3600,path:'',domain:'',secure:''};Object.extend(this.options,options||{});if(this.options.expires!=''){var date=new Date();date=new Date(date.getTime()+(this.options.expires*1000));this.options.expires='; expires='+date.toGMTString();} if(this.options.path!=''){this.options.path='; path='+escape(this.options.path);} if(this.options.domain!=''){this.options.domain='; domain='+escape(this.options.domain);} if(this.options.secure=='secure'){this.options.secure='; secure';}else{this.options.secure='';}},put:function(name,value){name=this.appendString+name;cookie=this.options;var type=typeof value;switch(type){case'undefined':case'function':case'unknown':return false;case'boolean':case'string':case'number':value=String(value.toString());} var cookie_str=name+"="+escape(Object.toJSON(value));try{document.cookie=cookie_str+cookie.expires+cookie.path+cookie.domain+cookie.secure;}catch(e){return false;} return true;},remove:function(name){name=this.appendString+name;cookie=this.options;try{var date=new Date();date.setTime(date.getTime()-(3600*1000));var expires='; expires='+date.toGMTString();document.cookie=name+"="+expires+cookie.path+cookie.domain+cookie.secure;}catch(e){return false;} return true;},get:function(name){name=this.appendString+name;var cookies=document.cookie.match(name+'=(.*?)(;|$)');if(cookies){return(unescape(cookies[1])).evalJSON();}else{return null;}},empty:function(){keys=this.getKeys();size=keys.size();for(i=0;i=this.options.overflowLength&&this.options.overflowLength>0)?(typeof(this.options.overflowString)=='function'?this.options.overflowString(label):this.options.overflowString):label;},getValueForExtraOption:function(){return this.checkboxes.inject([],function(values,checkbox){if(checkbox.checked) values.push(checkbox.value);return values;}).join(this.options.valueSeparator);},addExtraOption:function(){this.removeExtraOption();this.hasExtraOption=true;this.select.options[this.select.options.length]=new Option(this.getLabelForExtraOption(),this.getValueForExtraOption());this.select.options.selectedIndex=this.select.options.length-1;},removeExtraOption:function(){if(this.hasExtraOption){this.select.remove(this.select.options.length-1);this.hasExtraOption=false;}},notify:function(event_name){try{if(this.options[event_name]) return[this.options[event_name].apply(this.options[event_name],$A(arguments).slice(1))];}catch(e){if(e!=$break) throw e;else return false;}}});if(typeof(Object.Event)!='undefined') Object.Event.extend(Control.SelectMultiple);Number.prototype.format=function(decimalPoints,thousandsSep,decimalSep){var val=this+'',re=/^(-?)(\d+)/,x,y;if(decimalPoints!=null)val=this.toFixed(decimalPoints);if(thousandsSep&&(x=re.exec(val))){for(var a=x[2].split(''),i=a.length-3;i>0;i-=3)a.splice(i,0,thousandsSep);val=val.replace(re,x[1]+a.join(''));} if(decimalSep)val=val.replace(/\./,decimalSep);return val;} if(typeof Number.prototype.toFixed!='function'||(.9).toFixed()=='0'||(.007).toFixed(2)=='0.00')Number.prototype.toFixed=function(f){if(isNaN(f*=1)||f<0||f>20)f=0;var s='',x=this.valueOf(),m='';if(this<0){s='-';x*=-1;} if(x>=Math.pow(10,21))m=x.toString();else{m=Math.round(Math.pow(10,f)*x).toString();if(f!=0){var k=m.length;if(k<=f){var z='00000000000000000000'.substring(0,f+1-k);m=z+m;k=f+1;} var a=m.substring(0,k-f);var b=m.substring(k-f);m=a+'.'+b;}} if(m=='0')s='';return s+m;} var Scriptaculous={Version:'1.8.0',require:function(libraryName){document.write('<'+'script type="text/javascript" src="'+libraryName+'"><\/script>');},REQUIRED_PROTOTYPE:'1.6.0',load:function(){function convertVersionString(versionString){var r=versionString.split('.');return parseInt(r[0])*100000+parseInt(r[1])*1000+parseInt(r[2]);} if((typeof Prototype=='undefined')||(typeof Element=='undefined')||(typeof Element.Methods=='undefined')||(convertVersionString(Prototype.Version)= "+ Scriptaculous.REQUIRED_PROTOTYPE);$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z,]*)/);(includes?includes[1]:'builder,effects,dragdrop,controls,slider,sound').split(',').each(function(include){Scriptaculous.require(path+include+'.js')});});}} Scriptaculous.load();String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}} return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;},pulse:function(pos,pulses){pulses=pulses||5;return(((pos%(1/pulses))*pulses).round()==0?((pos*pulses*2)-(pos*pulses*2).floor()):1-((pos*pulses*2)-(pos*pulses*2).floor()));},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length)) elements=element;else elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;} effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;} var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync) Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this) if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box') this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode)) this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims) this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize) this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}} this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;} this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});} if(!this.options.endcolor) this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor) this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset(),max=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1]>max?max:elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round())});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element)},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}})}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}})}})}})}})}})}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;} return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options))}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;} return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos,options.pulses))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':')) this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});}}} this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16)});} this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;} var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))))});},update:function(position){var style={},transform,i=this.transforms.length;while(i--) style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+ (Math.round(transform.originalValue[0]+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+ (Math.round(transform.originalValue[1]+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+ (Math.round(transform.originalValue[2]+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+ (transform.targetValue-transform.originalValue)*position).toFixed(3)+ (transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit) style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='
';style=String.__parseStyleElement.childNodes[0].style;} Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity')) styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(hash,property){hash.set(property,css[property]);return hash;});if(!styles.opacity)styles.set('opacity',element.getOpacity());return styles;};};Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element) var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;}});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);var fileLoadingImage="/images/loading.gif";var fileBottomNavCloseImage="/images/closelabel.gif";var resizeSpeed=7;var borderSize=10;var imageArray=new Array;var activeImage;if(resizeSpeed>10){resizeSpeed=10;} if(resizeSpeed<1){resizeSpeed=1;} resizeDuration=(11-resizeSpeed)*0.15;Object.extend(Element,{getWidth:function(element){element=$(element);return element.offsetWidth;},setWidth:function(element,w){element=$(element);element.style.width=w+"px";},setHeight:function(element,h){element=$(element);element.style.height=h+"px";},setTop:function(element,t){element=$(element);element.style.top=t+"px";},setSrc:function(element,src){element=$(element);element.src=src;},setHref:function(element,href){element=$(element);element.href=href;},setInnerHTML:function(element,content){$(element).update(content);}});Array.prototype.removeDuplicates=function(){for(i=1;i1){Element.show('numberDisplay');Element.setInnerHTML('numberDisplay',eval(activeImage+1)+" / "+imageArray.length);} new Effect.Parallel([new Effect.SlideDown('imageDataContainer',{sync:true,duration:resizeDuration+0.25,from:0.0,to:1.0}),new Effect.Appear('imageDataContainer',{sync:true,duration:1.0})],{duration:0.65,afterFinish:function(){myLightbox.updateNav();}});},updateNav:function(){Element.show('hoverNav');if(activeImage!=0){Element.show('prevLink');document.getElementById('prevLink').onclick=function(){myLightbox.changeImage(activeImage-1);return false;}} if(activeImage!=(imageArray.length-1)){Element.show('nextLink');document.getElementById('nextLink').onclick=function(){myLightbox.changeImage(activeImage+1);return false;}} this.enableKeyboardNav();},enableKeyboardNav:function(){document.onkeydown=this.keyboardAction;},disableKeyboardNav:function(){document.onkeydown='';},keyboardAction:function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;} key=String.fromCharCode(keycode).toLowerCase();if((key=='x')||(key=='o')||(key=='c')){myLightbox.end();}else if(key=='p'){if(activeImage!=0){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage-1);}}else if(key=='n'){if(activeImage!=(imageArray.length-1)){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage+1);}}},preloadNeighborImages:function(){if((imageArray.length-1)>activeImage){preloadNextImage=new Image();preloadNextImage.src=imageArray[activeImage+1][0];} if(activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=imageArray[activeImage-1][0];}},end:function(){this.disableKeyboardNav();Element.hide('lightbox');new Effect.Fade('overlay',{duration:0.2});showSelectBoxes();}} function getPageScroll(){var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;} arrayPageScroll=new Array('',yScroll) return arrayPageScroll;} function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;} var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;} if(yScrollexitTime) return;}} function initLightbox(){myLightbox=new Lightbox();} if(typeof Effect=='undefined') throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={} Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element) this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions) this.setOptions(options);else this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});} Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string') this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n')) this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keypress',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'');this.iefix=$(this.update.id+'_iefix');} if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active) switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(Prototype.Browser.WebKit)Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(Prototype.Browser.WebKit)Event.stop(event);return;} else if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex) {this.index=element.autocompleteIndex;this.render();} Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i0)this.index-- else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index0)value=Element.collectTextNodes(nodes[0],this.options.select);}else value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace) newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;} this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement) this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){choices=eval(choices);this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();} this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;indexprevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp"+elem.substr(0,entry.length)+""+ elem.substr(entry.length)+"");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("
  • "+elem.substr(0,foundPos)+""+ elem.substr(foundPos,entry.length)+""+elem.substr(foundPos+entry.length)+"
  • ");break;}} foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}} if(partial.length) ret=ret.concat(partial.slice(0,instance.options.choices-ret.length)) return"
      "+ret.join('')+"
    ";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);} Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId)) this.options.formId='';} if(this.options.externalControl) this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl) this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode) this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode) this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode) btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses) link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;} fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur) fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL) this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase()) this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization) this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML) this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl) this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL) this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName) this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML;},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params)) params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);} if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl) this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName) this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags) text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc) $(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly) this.element.observe(pair.key,listener);if(this.options.externalControl) this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly) this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl) this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL) this.loadCollection();else this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js)) throw'Server returned an invalid collection representation.';this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;} tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL) this.loadExternalText();else this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect) ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});var html=$(document.getElementsByTagName("html")[0]);var head=$(document.getElementsByTagName("head")[0]);var IE6=!!(document.protocol&&!window.XMLHttpRequest&&document.createComment);var body=$(document.getElementsByTagName("body")[0]);var Nibble={init:function(){this.IE=Class.create();this.IE={initialize:function(){this.ie=!!document.protocol;this.version=this.setVersion();},setVersion:function(){if(!this.ie){return 0;} switch(true){case!!window.XMLHttpRequest:return 7;case!!document.createComment:return 6;case!!window.createPopup:return 5.5;case!!window.clipboardData:return 5;case!!window.showModalDialog:return 4;}}};this.ResizableTextArea=Class.create();this.ResizableTextArea.prototype={initialize:function(t){this.t=t;this._startDrag=this.startDrag.bindAsEventListener(this);this._performDrag=this.performDrag.bindAsEventListener(this);this._endDrag=this.endDrag.bindAsEventListener(this);this.t.wrap(new Element('div',{"class":"resizable-textarea"}));this.t.parentNode.appendChild(new Element("div",{"class":"grippie"})).observe('mousedown',this._startDrag);},startDrag:function(e){this.staticOffset=this.t.getHeight()-Event.pointerY(e);this.t.setStyle({opacity:0.5});html.observe('mousemove',this._performDrag);html.observe('mouseup',this._endDrag);},performDrag:function(e){this.t.setStyle({height:Math.max(32,this.staticOffset+Event.pointerY(e))+'px'});return false;},endDrag:function(e){html.stopObserving('mousemove',this._performDrag);html.stopObserving('mouseup',this._endDrag);this.t.setStyle({opacity:1});}} this.Form=Class.create();this.Form={FCKConfig:{StylesXmlPath:'/fckstyles.xml',EditorAreaCSS:'/fckstyles.css'},initialize:function(){this.setError();this.initForms();if(!document.implementation.hasFeature("WebForms","2.0")&&Nibble.needWidget("jscalendar")){Nibble.includeCSS("/css/jscalendar/calendar-blue2.css");Nibble.includeJS("/js/jscalendar/calendar.js",function(){Nibble.includeJS("/js/jscalendar/lang/calendar-hu-utf8.js",function(){Nibble.includeJS("/js/jscalendar/calendar-setup_stripped.js",function(){$$("input[type*=date]").invoke("initCalendar");});});});} if(Nibble.needWidget("ipe")){this.initIPE.whenLoaded("Ajax.InPlaceEditor",this);} this.initResizableTextAreas.ifExists("textarea.resizable",this);this.initRegExpValidator();this.initSelects();this.negativeCaptcha();if(!document.implementation.hasFeature("WebForms","2.0")){$$("input[type=number]").invoke("spinEdit");} this.initAjaxFileUploads();this.initAutoFocus();this.initMultipleCheckboxes();this.initTaxNumbers();this.initDefaultValues();this.initZipcodes.ifNeedWidget("zipcode");this.checkAutoLoadFCKeditors();},initLiveValidation:function(){Form.validationElements=new Array();Form.validationElementsIndex=0;$$("[validate]").each(function(element){var id=element.getAttribute("id");if(!id)return;var validateString="Validate."+element.getAttribute("validate");var validateParams=element.getAttribute("validateparams");if(validateParams)validateString+=", {"+validateParams+"}";Form.validationElements[Form.validationElementsIndex]=new LiveValidation(id,{onlyOnBlur:true});var ev="Form.validationElements[Form.validationElementsIndex].add("+validateString+");";eval(ev);Form.validationElementsIndex++;});},autoSubmit:function(ev){var ev=ev||window.event;var q=$F(ev.target);if(q[0]=="?"){document.location.search=q;}else{document.location.search="?"+ev.target.name+"="+q;}},initResizableTextAreas:function(textareas){if(!textareas.each){textareas=[textareas];} textareas.each(function(t){new Nibble.ResizableTextArea(t);});},initForms:function(){$$("form.ajax").each(function(form){form.observe("submit",this.ajaxDoSubmit.bind(this));}.bind(this));if($("_captcha")){var form=$("_captcha").up("form");if(form){form.observe("submit",function(ev){if($F("_captcha").length!=6){alert("Érvénytelen ellenőrző kód!");ev.stop();}});$("recaptcha").on("click",function(ev){var img=ev.target.up(".captcha").down("img");img.setAttribute("src",img.attr("src").replace(/\?.*/,'?'+Math.random()));});var img=$("_captcha").up("div.captcha").down("img");img.setAttribute("src",img.attr("src").replace(/\?.*/,'?'+Math.random()));}} $$("form[confirm]").each(function(form){form.on("submit",function(ev){if(!confirm(form.attr("confirm"))){ev.stop()}});});},ajaxDoSubmit:function(event){var form=Event.element(event);if(!this.checkRequiredFields(form)){return Event.stop(event);} var target=form.getAttribute("onsubmit");var container=$("main");switch(target){case"this":container=form;break;case"parent":container=form.parentNode;break;} this.ajaxSubmit(form,event,container);},ajaxSubmit:function(form,event,container){var container=container||form;var fields=escape(form.serialize());Event.stop(event);form.disable();ajax("nibble","ajaxSubmit",[form.getAttribute("action"),fields],function(response){container.update(response);Nibble.init();var errors=Element.getElementsByClassName(container,"error");if(errors.length>0){errors.first().scrollTo();}else{container.scrollTo();}}.bind(this));},isRequired:function(element){return $(element).hasClassName("required");},isFilled:function(element){switch(element.tagName){case"EM":return true;break;case"FIELDSET":var tmp=$A(element.getElementsByTagName("input")).pluck("checked").any();break;default:var tmp=$F(element);break;} return tmp;},checkRequiredFields:function(form){if(!html.hasClassName("admin")){return true;} var tmp=!form.$$(".required").find(function(element){if(this.isRequired(element)&&(!this.isFilled(element))){var prev=element.previous()?element.previous():element;prev.scrollTo();element.focus();Nibble.ajaxMessage("Ez a kötelező mező nincs kitöltve!","fail");return true;}}.bind(this));return tmp;},initIPE:function(){var ipes=$$("span[ipe]");ipes.each(function(element){new Ajax.InPlaceEditor(element,'/-/',{clickToEditText:"Klikk ide",callback:function(form,value){return"controller=nibble" +"&method=ipe" +"¶meters="+value.toJSON()}});});},initFCKeditor:function(){var textareas=$$("textarea[wysiwyg=fckeditor]");window.oFCKeditors=new Array();textareas.each(function(textarea){var name=textarea.getAttribute("name");var id=textarea.getAttribute("id");textarea.setAttribute("id",name);window.oFCKeditors[id]=new FCKeditor(name,"100%",textarea.getAttribute("wysiwyg_height"));window.oFCKeditors[id].ToolbarSet=textarea.getAttribute("wysiwyg_toolbar")||"Basic";var myConfig=$H(Nibble.Form.FCKConfig).merge(Project.FCKConfig)||new Hash();myConfig.each(function(pair){window.oFCKeditors[id].Config[pair.key]=pair.value;});window.oFCKeditors[id].ReplaceTextarea();textarea.setAttribute("id",id);});},checkAutoLoadFCKeditors:function(){if(!nibble||!nibble.FCKeditors)return;var c=new CookieJar();for(var i=0;i" +($$("label[for="+this.element.id+"]")[0]).outerHTML +this.element.outerHTML +""+this.message+"";}}},initRegExpValidator:function(){$$("input[accept=number]").each(function(i){i.mask("9^.");});return false;$$("input[accept]").each(function(input){input.observe("change",function(){var m=new RegExp(input.getAttribute("accept")).test(input.value);if(m){input.setStyle({border:"1px solid green"});}else{input.setStyle({border:"1px solid red"});}});});},initSelects:function(){$$("select[addnew]").each(function(select){var addNew=function(){if(this.selectedIndex+1==this.options.length){var i=0;while(this.options[i].disabled){i++;} this.selectedIndex=i;var newOption=prompt($A(this.options).last().text);if(newOption){var index=select.hasOption(newOption);if(index>-1){select.options[index].selected=true;}else{ajax("nibble","addNew",[this.getAttribute("addnew"),newOption],function(newId){if(newId){$$("select[addnew="+this.getAttribute("addnew")+"]").each(function(s){var option=s.addOption(newOption,newId);if(s==this){option.selected=true;}}.bind(this));}else{alert("Error!");}}.bind(this));}}}} select.observe("change",addNew.bind(select));select.observe("focus",function(){if(this.options.length==2&&this.selectedIndex==1){addNew.bind(this)();}});if(document.addEventListener){document.addEventListener('added',function(ev){$(ev.element).$$("select[addnew]").each(function(s){s.observe("change",addNew);s.observe("focus",function(){if(this.options.length==2&&this.selectedIndex==1){addNew.bind(s)();}});});},false);}});$$("select.select-tab").each(function(select){var showTab=function(select){var tabs=$$("*[id^=select-tab]");tabs.invoke("hide");tabs.invoke("removeClassName","hide");var tab=$("select-tab-"+$F(select));if(tab){tab.show();}} showTab(select);select.observe("change",function(e){showTab(e.target);});});},negativeCaptcha:function(){$$(".negcap").invoke("remove");},initAjaxFileUploads:function(){Event.observe(document,"controllers:inited",function(ev){$$("input[onselect]").each(function(i){i.on("change",eval(i.readAttribute("onselect"))||Prototype.emptyFunction);});});},initAutoFocus:function(){var first=$$("input[autofocus]").first();if(first)first.focus();},initMultipleCheckboxes:function(){var first=true;$$("fieldset.checkbox div.multiple").each(function(multiple){multiple.insert({after:new Element("div",{className:"help"})});var setHelp=function(m){if(first){first=false;return;} var checkeds=m.$$("input:checked");if(checkeds[0]&&checkeds[0].up("label").down("span").innerHTML=="Összes megye"){checkeds=checkeds.slice(1);} m.next(".help").update(checkeds.invoke("up","label").invoke("down","span").pluck("innerHTML").join(", "));} var selector=document.protocol?"span":"input";multiple.delegate(selector,"click",function(ev){var input=ev.target.parentNode.firstChild;if(ev.target.tagName=="SPAN"&&!ev.target.up("label").hasClassName("first")){input.checked=!input.checked;} ev.target.up("label").addClassNameIf("selected",input.checked);setHelp(ev.target.up("div"));});multiple.on("input:checked",function(ev){ev.target.$$("input:checked").invoke("up","label").invoke("addClassName","selected");setHelp(ev.target);});multiple.fire("input:checked");});},initTaxNumbers:function(){$$("div.taxnumber").each(function(div){var inputs=div.$$("input");inputs.each(function(i,index){i.mask("9^");i.on("keypress",function(ev){if(ev.keyCode==13){ev.target.up("form").submit();} if($F(ev.target).length==$N(ev.target.attr("maxlength"))-1&&ev.keyCode==0){var next=ev.target.next("input");if(next)next.focus();} if(($F(ev.target).length==1||$F(ev.target).length==0)&&ev.keyCode==8){var prev=ev.target.previous("input");if(prev)prev.focus();}});i.on("keydown",function(ev){if($F(ev.target).length==$N(ev.target.attr("maxlength"))&&ev.keyCode==0){var next=ev.target.next("input");if(next)next.focus();}});});});},initDefaultValues:function(){$$("input[i18n_default_value]").each(function(i){if(!$F(i)){i.setValue(i.i18n("default_value"));} i.on("focus",function(ev){var t=ev.target;if($F(t)==t.i18n("default_value")){t.setValue("");}});i.on("blur",function(ev){var t=ev.target;if($F(t)==""){t.setValue(t.i18n("default_value"));}});});},initZipcodes:function(){$$("input[name*=zipcode]:not(.noinit)").each(function(i){i.mask("9^");i.on("change",function(ev){if($F(ev.target).match(/^\d{4}$/)){ajax("addresses","GetCityByZipcode",[$F(ev.target),ev.target.hasClassName("noerror")],function(city){if(city){var s="input[name*=city]";var iCity=ev.target.next(s)||ev.target.up("tr")?ev.target.up("tr").next("tr").down(s):false||ev.target.up("form").down(s);if(iCity){iCity.setValue(city);}}});}});});},doSubmit:function(ev){var form=ev.target;var tmp=Nibble.Form.checkRequiredFields(form);if(!tmp){ev.stop();}},multiinputAddRow:function(element){var row=$(element).up("div",0);var row_id=parseInt(row.getAttribute("row"),10);if(row.next("div",0)){row.next("div",0).style.display="block";$(element).style.visibility="hidden";if($(element).next("img",0))$(element).next("img",0).style.visibility="hidden";}},multiinputDeleteRow:function(element){var row=$(element).up("div",0);var row_id=parseInt(row.getAttribute("row"),10);if(row.previous("div",0)){this.multiinputEraseRow($(element));row.style.display="none";row.previous("div",0).down("img",0).next("img",0).style.visibility="visible";if(row_id>2)row.previous("div",0).down("img",0).next("img",1).style.visibility="visible";}},multiinputEraseRow:function(element){var row=$(element).up("div",0);row.$$("input").each(function(element2){element2.value="";});row.$$("select").each(function(element2){element2.value="NULL";});},toggleRequired:function(element){element.getElementsBySelector("input").each(function(e){if(e.getAttribute("required")=="required"){e.removeAttribute("required");e.writeAttribute("required_hide");} else if(e.getAttribute("required_hide")=="required_hide"){e.removeAttribute("required_hide");e.writeAttribute("required");}});},multiinputNavigate:function(event){var element=Event.element(event);var row=element.up("div",0);var rowNum=row.getAttribute("row");if(event.keyCode==38&&rowNum>1){if(row.previous("div",0).down('input',0))row.previous("div",0).down('input',0).focus();if(row.previous("div",0).down('input',0))row.previous("div",0).down('input',0).select();} if(event.keyCode==40&&row.next("div",0)){this.multiinputAddRow(row.down("img",0).next("img",0));if(row.next("div",0).down('input',0))row.next("div",0).down('input',0).focus();if(row.next("div",0).down('input',0))row.next("div",0).down('input',0).select();}}} this.Form.initialize();if((typeof(RepetitionElement)!="undefined")&&(typeof(RepetitionElement._init_document)!="undefined")){RepetitionElement._init_document();} if(typeof(Lightbox)!="undefined"&&this.needWidget("lightbox")){initLightbox();} if(typeof(this.FileUpload)!="undefined"){this.fileUpload=new this.FileUpload();} if(Nibble.needWidget("antispam")){this.antiSpam();} this.initAjaxEvents();if(Nibble.needWidget("external")){this.external();} if(typeof(Project)!==Control.Tabs){$$(".tabs").invoke("tabs");} if(typeof(Project)!=="undefined"){Project.init();} this.initErrorReporter.ifExists("#centered #error",this);$$("ul.collapsed").invoke("expandTree");if(!document.protocol||true){var iAutoCompleters=$$("input[autocompleter]");iAutoCompleters.each(function(e){e.on("focus",function(ev){ev.target.doAutoCompleter(ev.target);});});if(iAutoCompleters.length){Event.observe(window,"beforeunload",function(ev){iAutoCompleters.each(function(e){e.setAttribute("autocomplete","on");});});}} document.observe("added",this.doAdded.bindAsEventListener());document.observe("removed",this.doRemoved.bindAsEventListener());document.observe("moved",this.doMoved.bindAsEventListener());html.on("submit",this.Form.doSubmit.bindAsEventListener());this.saveLister.ifExists("#savelister",this);this.initWidgets();this.setHoverOnHash();this.highlightedCellElement=null;html.fire("nibble:inited");},initErrorReporter:function(){var reportButton=$('report-error').appendChild(new Element("input",{type:"button",value:"Jelentem a hibát"})).observe('click',function(){reportButton.disabled=true;reportButton.blur();ajax("error","report",[{url:document.location.href,referer:document.referrer}],function(){reportButton.value="Köszönjük, hogy segíti munkánkat!";});});},saveLister:function(e){e.on("click",function(ev){var name;if(name=prompt("Kérnék egy megnevezést!")){ajax("nibble","savelister",[name,document.location.pathname,document.location.search.base64Encode()],function(id){if(id){var s=$("saved_lists");if(s&&s.tagName=="SELECT"){s.addOption(name,document.location.search,1,true);new Effect.Highlight(s,{startcolor:"#00c000"});}}});} ev.stop();});},ajaxMessage:function(r,klass,_alert){if(r[0]=="@")return;if(Nibble.disableAjaxIndicator){return;} var r=r||"OK!";var klass=klass||"ok";var id="nibble-ajax-message";var e=$(id)||body.appendChild(new Element("div",{id:id}));Nibble.lastAjaxMessage=r;e.show();e.update(r).className="";e.addClassName(klass);Effect.Fade.delay(2,e);if(_alert)alert(r);},external:function(){$$("a[rel=external]").each(function(a){a.setAttribute("target","_blank");});},needWidget:function(name){if(document.getElementById("_widgets")){return(document.getElementById("_widgets").getAttribute("content").indexOf(name)>=0);}},delegate:function(listener){return function(type,args,selector){var event=args[0];var src=Event.element(event);if(selector&&$$(selector).indexOf(src)+1){src.observe(type,function(event){Event.stop(event);return listener.bind(src)(event);});return listener.bind(src)(event);}}},doAdded:function(ev){if(ev.element.tagName=="TR"){ev.element.up("tbody").zebra();} var container=$(ev.target.readAttribute("container"))||ev.target.up("div");container.$$("input[autocompleter]").invoke("doAutoCompleter");},doRemoved:function(ev){if(ev.target.tagName=="TR"){var tbody=ev.target.up("tbody");tbody.zebra();}},doMoved:function(ev){if(ev.element.tagName=="TR"){ev.element.up("tbody").zebra();}},antiSpam:function(){$$("a.email").each(function(a){a.setAttribute("href",a.getAttribute("href").replace(/\.kukac\./g,"@"));a.innerHTML=a.innerHTML.replace(/\.kukac\./g,"@");});},ajax:function(controller,method,parameters,callback){parameters=parameters||[];var options={asynchronous:false,method:"post",parameters:"controller="+controller +"&method="+method +"¶meters="+encodeURIComponent(parameters.toJSON())};Nibble.ajaxIndicator(true);if(callback){options.asynchronous=true;options.onSuccess=function(xmlhttp){Nibble.ajaxIndicator(false);var response=eval(xmlhttp.responseText);var am;if(am=xmlhttp.getResponseHeader("X-Ajax-Message")){am=eval(am);var alert=(am[0][0]=="!");if(alert){am[0]=am[0].substr(1);} Nibble.ajaxMessage(am[0],am[1],alert);Nibble.lastAjaxMessage=am[0];} callback(response);} options.onFailure=function(xmlhttp){Nibble.ajaxIndicator(false);var response=eval(xmlhttp.responseText);callback();}} var myAjax=new Ajax.Request("/-/",options);if(callback){return true;} var tmp=myAjax.responseIsSuccess()?eval(myAjax.transport.responseText):"";Nibble.ajaxIndicator(false);Nibble.ajaxCache[hash]=tmp;return tmp;},ajaxIndicator:function(status){if(Nibble.disableAjaxIndicator)return;status=status||false;var indicatorId="ajax_indicator";var indicator=$(indicatorId);if(indicator){if(status==false){Element.hide(indicator);}else{Element.show(indicator);}}else{var _html="
    ";($("body")||html.firstChild).insert({top:_html});var indicator=$("ajax_indicator");if(arguments.length==0){indicator.hide();} return indicator;}},initAjaxEvents:function(){var _delete=function(module,method,args){if(confirm("Biztos?")){ajax(module,method,args,function(response){if(response){var e=this.up(".delete")||this.up("tr");if(e.tagName=="TR"){var tbody=this.up("tbody");e.remove();tbody.zebra();var ev=e.fire("rowdelete");if(e=$("listercount")){e.update($N($("listercount").innerHTML)-1);}}else{e.remove();}}else{alert("Sajnos nem tudtam törölni!");}}.bind(this));}}.delegateAsAjaxEvent("img[event*=elete]");},deleteListerTr:function(element){var e=element.up(".delete")||element.up("tr");if(e.tagName=="TR"){var tbody=this.up("tbody");e.remove();tbody.zebra();var ev=e.fire("rowdelete");if(e=$("listercount")){e.update($N($("listercount").innerHTML)-1);}}else{e.remove();}},loadControllers:function(){for(var i in this){if(typeof(this[i].initialize)=="function"){var prototype=this[i];this[i]=Class.create();this[i].prototype=prototype;this[i]=new this[i]();}} document.fire("controllers:inited");},includeJS:function(src,callback){var node=document.createElement("script");node.setAttribute("type","text/javascript");node.setAttribute("src",src);if(document.protocol){node.onreadystatechange=function(){if(node.readyState=='loaded'||node.readyState=='complete'){callback();}}}else{node.onload=function(){if(callback){callback();}}} document.getElementsByTagName("head")[0].appendChild(node);},includeCSS:function(src){var node=document.createElement("link");node.setAttribute("rel","stylesheet");node.setAttribute("type","text/css");node.setAttribute("media","screen");node.setAttribute("href",src);document.getElementsByTagName("head")[0].appendChild(node);},initWidgets:function(){Event.observe(document,"click",function(ev){var widget=ev.target.readAttribute("widget");if(widget){new Nibble.Widget[widget](ev.target);};});},initKeepAlive:function(){new PeriodicalExecuter(function(pe){ajax("nibble","KeepAlive",[],function(){});},180);},backButton:function(a){$(a.parentNode).removeClassName("hide");a.on("click",function(ev){ev.stop();history.back();});},lz:function(number){return($N(number)<10)?"0"+number:number;},setHoverOnHash:function(){if(document.location.hash){var el=document.getElementById(document.location.hash.substr(1));if(el){$(el).addClassName("hover");}}},popOut:function(e){var html=e.next(".html");html.hide();var p=new Nibble.Popup();p.centered("http://index.hu",html.getWidth(),html.getHeight());p.update},setField:function(select,encode){if($F(select)!="0"&&confirm("Biztos?")){ajax("nibble","SetField",[$F(select),encode],function(response){});}},reload:function(){window.location.reload();},autoSubmit:function(event){Event.extend(event).target.up("form").submit();},uploadExcel:function(o){var ev=o.event;var fs=ev.target.up("fieldset");if(!fs)return false;if(/.xls$/i.test($F(ev.target))){var productId=document.location.href.split("/")[5];ev.target.upload(o);}else{var err=fs.down("div.error")||fs.appendChild(new Element("div",{className:"error"}));err.update("Nem excel!").show();Effect.Fade.delay(2,err);}},doArrows:function(event){var element=Event.element(event);if(event.ctrlKey==true&&event.keyCode==38){var arr=element.up("tr",0).immediateDescendants();for(x=0;arr[x];x++)if(arr[x]==element.up("td",0))break;var i=0;while(element.up("tr",0).previous("tr",i)){var y=x-1;var quit=false;while(element.up("tr",0).previous("tr",i).down("td",0).next("td",y)){if(element.up("tr",0).previous("tr",i).down("td",0).next("td",y).down("input",0)){element.up("tr",0).previous("tr",i).down("td",0).next("td",y).down("input",0).focus();var quit=true;break;} y++;} i++;if(quit)break;}} if(event.ctrlKey==true&&event.keyCode==40){var arr=element.up("tr",0).immediateDescendants();for(x=0;arr[x];x++)if(arr[x]==element.up("td",0))break;var i=0;while(element.up("tr",0).next("tr",i)){var y=x-1;var quit=false;while(element.up("tr",0).next("tr",i).down("td",0).next("td",y)){if(element.up("tr",0).next("tr",i).down("td",0).next("td",y).down("input",0)){element.up("tr",0).next("tr",i).down("td",0).next("td",y).down("input",0).focus();var quit=true;break;} y++;} i++;if(quit)break;}} if(event.ctrlKey==true&&event.keyCode==37){var i=0;while(element.up("td",0).previous("td",i)){if(element.up("td",0).previous("td",i).down("input",0)){element.up("td",0).previous("td",i).down("input",0).focus();break;} i++;}} if(event.ctrlKey==true&&event.keyCode==39){var i=0;while(element.up("td",0).next("td",i)){if(element.up("td",0).next("td",i).down("input",0)){element.up("td",0).next("td",i).down("input",0).focus();break;} i++;}}},highlightTable:function(event){var element=Event.element(event);if(element!=Nibble.highlightedCellElement){Nibble.highlightedCellElement=element;if(element.localName=="TD"&&!element.hasClassName("no_highlight")){var table=Event.element(event).up("table",0);if(!table)return;table.getElementsBySelector("td").each(function(element2){if(!element2.hasClassName("no_highlight")){element2.removeClassName("highlight");element2.removeClassName("highlight_cell");}});element.up("tr").getElementsBySelector("td").each(function(element2){if(!element2.hasClassName("no_highlight"))element2.addClassName("highlight");});for(i=0;element.previous("td",i);i++);table.getElementsBySelector("tr").each(function(element2){if(element2.down("td",i))if(!element2.down("td",i).hasClassName("no_highlight"))element2.down("td",i).addClassName("highlight");});element.addClassName("highlight_cell");}}},editI18N:function(id,ev){var span=Event.element(ev);Event.stop(ev);var message=prompt("Írd be a szöveget:",span.innerHTML);if(!message)return;ajax("nibble","saveI18N",[id,message],function(response){span.innerHTML=message;});},deleteFromSavedLister:function(element,id){element.up('li',0).squish();ajax("nibble","DeleteFromSavedLister",[id],function(response){});}};if(false&&Nibble.needWidget("jscalendar")&&!document.implementation.hasFeature("WebForms","2.0")){Nibble.includeJS("/jscalendar/calendar.js");Nibble.includeJS("/jscalendar/lang/calendar-hu-utf8.js");Nibble.includeJS("/jscalendar/calendar-setup.js",Nibble.Form.initDates);Nibble.includeCSS("/jscalendar/calendar-blue2.css");} if($("jsconfig")){Nibble.config=$("jsconfig").readAttribute("content").base64Decode().evalJSON();} if(Nibble.needWidget("ipe")){Nibble.includeJS("/js/scriptaculous/src/effects.js");Nibble.includeJS("/js/scriptaculous/src/controls.js");} if(Nibble.needWidget("sortable")){Nibble.includeJS("/js/scriptaculous/src/dragdrop.js",function(){document.fire("dnd:loaded");});} if(Nibble.needWidget("sound")){Nibble.includeJS("/js/external/soundmanager2.js",function(){soundManager.onload=function(){document.fire("sound:loaded");}});} ajax=Nibble.ajax;a=ajax;Function.prototype.ajaxEvent=function(){var handler=this;return function(event){var src=Event.element(event);var params=src.getAttribute("event").split(" ");return handler.apply(src,[params[0],params[1],params.slice(2)]);}} Function.prototype.delegateAsAjaxEvent=function(selector){html.on("click",function(ev){Nibble.delegate(this.ajaxEvent())('click',[ev],selector);}.bind(this));} Function.prototype.ifExists=function(selector,scope){var result=$$(selector);if(result.length>0){if(result.length==1){result=result.shift();} return this.apply(scope,[result]);}} Function.prototype.ifNeedWidget=function(widget){if(Nibble.needWidget(widget)){return this();}} Function.prototype.whenLoaded=function(object,scope){var time=0.05;var tries=0;var method=this;new PeriodicalExecuter(function(pe){if(tries++>time*1000){pe.stop();} if(typeof(eval(object))!="undefined"){pe.stop();return method.apply(scope);}},time);} function $N(value,nan,decimal){var nan=nan||0;var decimal=decimal||0;if(typeof(value)=="string"){value=value.replace(",",".");} if((value===0)||(value==="0"))return 0;var tmp=(tmp=parseFloat(value,10))?tmp:nan;if(decimal){tmp=tmp.format(decimal);} tmp=parseFloat(tmp,10);return tmp;} String.prototype.numberFormat=function(_String){_String=this!=window?this:_String;if(_String=='')return'';var begin=_String.length%3;var nIndex=0;var tmp="";if(_String.length>3){for(var i=begin;i<_String.length;i++){if(!nIndex)tmp+=' ';tmp+=_String.charAt(i);nIndex=nIndex==2?0:nIndex+1;} _String=_String.substr(0,begin)+tmp;if(_String.indexOf(',')==0)_String=_String.substr(1,_String.length)} return _String;} Nibble.Widget=Class.create({initialize:function(e,o){this.id=Math.random();this.o=o||{};this.e=$(e);this.t=$$("div."+this.name)[0];this.e.observe("focus",this.doFocus.bindAsEventListener(this));this.e.observe("blur",this.doBlur.bindAsEventListener(this));this.doFocus();this.attached=false;},doGlobalClick:function(ev){if(ev.target.descendantOf(this.wc)){this.preventBlur=true;return true;} this.preventBlur=Position.within(this.wc,Event.pointerX(ev),Event.pointerY(ev))||Position.within(this.w,Event.pointerX(ev),Event.pointerY(ev)) if(!this.preventBlur){this.doBlur();}},attachWidget:function(){if(this.attached)return;this.attached=true;this.wc=new Element("div",{className:"widget-container"});this.e.wrap(this.wc);this.w=this.t.cloneNode(true).removeClassName("widget-template").addClassName("widget");this.w.$$("input, select").invoke("addClassName","widget");this.wc.style.visibility="hidden";this.e.parentNode.appendChild(this.w);this.setPosition(this.o.position);this.wc.style.visibility="visible";html.observe("mousedown",this.doGlobalClick.bindAsEventListener(this));},doFocus:function(ev){this.e.focus();if(!this.w){this.attachWidget();} this.showWidget();if(ev)ev.stop();},doBlur:function(ev){if(this.preventBlur){return Event.stop(ev);} if(this.w.displayed()){this.hideWidget();}},showWidget:function(){if(this.w.displayed())return;this.w.style.display="block";},hideWidget:function(){this.w.hide();},enableWidget:function(){this.w.$$("input").invoke("enable");this.w.$$("select").invoke("enable");},disableWidget:function(){this.w.$$("input").invoke("disable");this.w.$$("select").invoke("disable");},setValue:function(ret){this.ret=ret||this.ret;if(this.ret&&this.ret!=""){this.e.value=this.ret;this.e.fire("change");this.e.focus();}},setPosition:function(position){switch(position){case"top":this.w.style.marginTop=-(this.w.getHeight()+this.wc.getHeight())+"px";break;}}});Nibble.ExpandTree=Class.create();Nibble.ExpandTree.prototype={initialize:function(e,o){this.e=e;this.o=Object.extend({},o);this.e.on("click",function(ev){var stop=true;if(ev.target.tagName=="A"){stop=false;li=$(ev.target).up("li");}else{li=$(ev.target);} this.doClick.bind(this)(li);if(stop){ev.stop();}}.bind(this));this.cookie=new CookieJar({expires:3600,path:"/"});this.nodes=[].concat(this.cookie.get("nodes")).compact();this.nodes.each(function(id){this.doOpen($("node"+id));}.bind(this));},preLoadImages:function(){new Image().src=this.o.imgOpen;new Image().src=this.o.imgClose;},doClick:function(li){this["do"+(li.hasClassName("close")?"Close":"Open")].bind(this)(li);},doOpen:function(li){li.$$("ul").findAll(function(e){return(e.parentNode==this);}.bind(li)).invoke("setStyle",{display:"block"});li.removeClassName("open").addClassName("close");this.nodes.push(li.id.replace("node",""));this.save();},doClose:function(li){li.$$("ul").findAll(function(e){return(e.parentNode==this);}.bind(li)).invoke("hide");li.removeClassName("close").addClassName("open");this.nodes=this.nodes.without(li.id.replace("node",""));this.save();},save:function(){this.nodes=this.nodes.uniq();this.cookie.put("nodes",this.nodes);}} Nibble.SpinEdit=Class.create();Nibble.SpinEdit.prototype={initialize:function(e,o){this.e=e;this.o=Object.extend({defaultValue:0,onClick:eval(e.readAttribute("onclick"))||Prototype.emptyFunction,min:parseInt(e.readAttribute("min")),max:parseInt(e.readAttribute("max"))},o);this.up=new Element("button").update(decodeURIComponent("%e2%96%b2")).observe("click",this.doUp.bindAsEventListener(this));this.down=new Element("button").update(decodeURIComponent("%e2%96%bc")).observe("click",this.doDown.bindAsEventListener(this));;this.e.wrap("div").addClassName("spinedit").setStyle({display:this.e.getStyle("display")}).insert({bottom:this.up}).insert({bottom:this.down});this.up.addClassName("sipn_up_arrow");this.down.addClassName("sipn_down_arrow");this.up.setAttribute("type","button");this.down.setAttribute("type","button");var v=$F(this.e);if(!v){this.e.setValue(this.o.defaultValue);}else{if(vthis.o.max){this.e.setValue(this.o.max);}}},doUp:function(ev){var v=$N($F(this.e));if(vthis.o.min){this.e.setValue(v-1);this.o.onClick(ev.target);} ev.stop();}} Nibble.Marquee=Class.create();Nibble.Marquee.prototype={initialize:function(element){if(!(this.element=$(element)))return false;this.indent=0;this.scroll=true;this.separator="";this.inner=$(document.createElement("span"));this.inner.innerHTML=this.element.innerHTML.strip()+this.separator;this.outer=$(document.createElement("div"));this.element.innerHTML="";this.outer.appendChild(this.inner);this.element.appendChild(this.outer);this.fullWidth=this.element.getDimensions().width;this.innerWidth=this.inner.getDimensions().width;this.repeat=$N(this.fullWidth/this.innerWidth)+1;this.element.appendChild(this.outer);this.element.observe("mouseover",this.doMouse.bindAsEventListener(this));this.element.observe("mouseout",this.doMouse.bindAsEventListener(this));this.interval=setInterval(this.doScroll.bind(this),50);},doScroll:function(){if(!this.scroll)return;this.indent+=3;this.outer.style.marginLeft="-"+this.indent+"px";if(this.indent>this.innerWidth+this.fullWidth){this.indent=0;}},doMouse:function(){this.scroll=!this.scroll;}} var Project={init:function(){Nibble.loadControllers.bind(this)();this.markers=1;this.Marker=new Array();this.gMap();},gMap:function(){google_map.setUIToDefault();google_map_geo=new GClientGeocoder();google_map_geo.getLocations("2310 Szigetszentmiklós, Viola út 1",Project.getPositionCoordinates1);google_map_geo.getLocations("2314 Halásztelek, Rákóczi út 17",Project.getPositionCoordinates2);google_map_geo.getLocations("2310 Szigetszentmiklós, Csokonai út 6-14",Project.getPositionCoordinates3);google_map_geo.getLocations("2310 Szigetszentmiklós, Csonka János út 5",Project.getPositionCoordinates4);google_map_geo.getLocations("2300 Ráckeve, Kossuth Lajos út 14",Project.getPositionCoordinates5);google_map_geo.getLocations("2330 Dunaharaszti, Gyárköz út 1",Project.getPositionCoordinates6);google_map_geo.getLocations("2338 Áporka, Petőfi Sándor út 87",Project.getPositionCoordinates7);},getPosCoord:function(response,index){if(!response||response.Status.code!=200){alert("Nem találom a címet!");return;} else{place=response.Placemark[0];lat=place.Point.coordinates[1];lng=place.Point.coordinates[0];} Project.showPosition(lat,lng,index);},getPositionCoordinates1:function(response){Project.getPosCoord(response,1);},getPositionCoordinates2:function(response){Project.getPosCoord(response,2);},getPositionCoordinates3:function(response){Project.getPosCoord(response,3);},getPositionCoordinates4:function(response){Project.getPosCoord(response,4);},getPositionCoordinates5:function(response){Project.getPosCoord(response,5);},getPositionCoordinates6:function(response){Project.getPosCoord(response,6);},getPositionCoordinates7:function(response){Project.getPosCoord(response,7);},showPosition:function(lat,lng,index){var point=new GPoint(lng,lat);var ownIcon=new GIcon(G_DEFAULT_ICON);ownIcon.image="http://gmaps-samples.googlecode.com/svn/trunk/markers/red/marker"+index+".png";Project.Marker[Project.markers]=new GMarker(point,{icon:ownIcon});google_map.addOverlay(Project.Marker[Project.markers]);Project.Marker[Project.markers].bindInfoWindowHtml($("google_map_popup_"+index).innerHTML);Project.markers++;}} Event.observe(document,"dom:loaded",Nibble.init.bind(Nibble));var I18N={"FOO":{'hu':"foo-hu",'en':"foo-en"},"BAR":{'hu':"bar-hu",'en':"bar-en"}};function FCKeditor_OnComplete(editorInstance){editorInstance.Events.AttachEvent('OnSelectionChange',AutoLinkURL);} function AutoLinkURL(editorInstance){var origData=editorInstance.GetData();var newData=autolink(origData);if(origData!=newData){editorInstance.SetData(newData);editorInstance.Focus();}} function autolink(s){var hlink=/(\s|\;)(http(s?):\/\/(([A-Za-z0-9\-_]+\.)+)([A-Za-z0-9\.\/%&=\?\-_])+)(\s)/g;return(s.replace(hlink,function($0,$1,$2,$3){s=$2;return" "+s.link(s);}));} Project.Content={initialize:function(){this.initPreview.ifExists("#content_preview",this);if(Nibble.needWidget("contentipe")){this.initIpe();}},initPreview:function(submit){this.width="960";this.bg=this.createBlackGround();this.preview=this.createPreview();this.iframe=this.createIframe();submit.observe("click",this.doPreview.bind(this));submit.up("form").observe("submit",function(ev){if(ev.target.getAttribute("_action")){ev.target.setAttribute("action",ev.target.getAttribute("_action"));ev.target.setAttribute("target","");}});},getToken:function(){var tmp=this.iframe.contentWindow.document.getElementById('token');if(tmp)tmp=tmp.getAttribute("content");return tmp;},doPreview:function(event){this.form=Event.element(event).up("form");if(!this.form.getAttribute("_preview_action")){this.form.setAttribute("_action",this.form.getAttribute("action"));this.form.setAttribute("_preview_action",this.form.getAttribute("action")+"preview/");} this.form.setAttribute("action",this.form.getAttribute("_preview_action"));this.form.setAttribute("target","if_preview");this.form.submit();new Effect.MoveBy(this.preview,0,this.width,{duration:0.3,beforeStart:function(){this.bg.show();this.preview.show();}.bind(this)});Event.stop(event);},hidePreview:function(event){Nibble.Form.updateToken(this.getToken());new Effect.MoveBy(this.preview,0,-this.width,{duration:0.3,afterFinish:function(){this.bg.hide();this.preview.hide();this.iframe.src="";}.bind(this)});},createBlackGround:function(){var bg=$(document.createElement("div"));bg.id="blackground";bg.hide();document.documentElement.appendChild(bg);return bg;},createIframe:function(){var iframe=$(document.createElement("iframe"));iframe.name="if_preview";iframe.id=iframe.name;this.preview.appendChild(iframe);var button1=$(document.createElement("button"));var button2=$(document.createElement("button"));button1.update("Szerkeszt");button1.observe("click",function(){this.hidePreview();}.bind(this));button2.update("Ment");button2.observe("click",function(){this.save();}.bind(this));this.preview.appendChild(button1);this.preview.appendChild(button2);return iframe;},createPreview:function(){var preview=$(document.createElement("div"));preview.id="content_preview_container";preview.setStyle({left:"-"+this.width+"px",width:this.width+"px"});html.appendChild(preview);return preview;},save:function(){Nibble.Form.updateToken(this.getToken());this.form.setAttribute("action",this.form.getAttribute("_action"));this.form.setAttribute("target","");this.form.submit();},initIpe:function(){html.delegate("p","click",function(ev){});},renameUploadedFile:function(element){var tmp=element.previous("input",0).name.split("_");var file_id=parseInt(tmp[1],10);var file_name=element.previous("input",0).value;if(file_name==""){alert("Hibás fájlnév");return;} if(file_id>0){ajax("nibble","renameUploadedFile",[file_id,file_name],function(id){if(id){element.previous("a",0).innerHTML=file_name;}});}},saveUploadedFileComment:function(element){var tmp=element.previous("input",0).name.split("_");var file_id=parseInt(tmp[1],10);var comment=element.previous("input",0).value;if(file_id>0){ajax("nibble","SaveUploadedFileComment",[file_id,comment],function(id){if(id){alert('sikeres mentés!');}});}}}