//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, , MIT Style License. var MooTools={version:'1.12'};function $defined(obj){return(obj!=undefined);};function $type(obj){if(!$defined(obj))return false;if(obj.htmlElement)return'element';var type=typeof obj;if(type=='object'&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}} if(type=='object'||type=='function'){switch(obj.constructor){case Array:return'array';case RegExp:return'regexp';case Class:return'class';} if(typeof obj.length=='number'){if(obj.item)return'collection';if(obj.callee)return'arguments';}} return type;};function $merge(){var mix={};for(var i=0;i-1:this.indexOf(string)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,'\\$1');}});Array.extend({rgbToHex:function(array){if(this.length<3)return false;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);} return array?hex:'#'+hex.join('');},hexToRgb:function(array){if(this.length!=3)return false;var rgb=[];for(var i=0;i<3;i++){rgb.push(parseInt((this[i].length==1)?this[i]+this[i]:this[i],16));} return array?rgb:'rgb('+rgb.join(',')+')';}});Function.extend({create:function(options){var fn=this;options=$merge({'bind':fn,'event':false,'arguments':null,'delay':false,'periodical':false,'attempt':false},options);if($chk(options.arguments)&&$type(options.arguments)!='array')options.arguments=[options.arguments];return function(event){var args;if(options.event){event=event||window.event;args=[(options.event===true)?event:new options.event(event)];if(options.arguments)args.extend(options.arguments);} else args=options.arguments||arguments;var returns=function(){return fn.apply($pick(options.bind,fn),args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)try{return returns();}catch(err){return false;};return returns();};},pass:function(args,bind){return this.create({'arguments':args,'bind':bind});},attempt:function(args,bind){return this.create({'arguments':args,'bind':bind,'attempt':true})();},bind:function(bind,args){return this.create({'bind':bind,'arguments':args});},bindAsEventListener:function(bind,args){return this.create({'bind':bind,'event':true,'arguments':args});},delay:function(delay,bind,args){return this.create({'delay':delay,'bind':bind,'arguments':args})();},periodical:function(interval,bind,args){return this.create({'periodical':interval,'bind':bind,'arguments':args})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn){for(var i=0;i';} el=document.createElement(el);} el=$(el);return(!props||!el)?el:el.set(props);}});var Elements=new Class({initialize:function(elements){return(elements)?$extend(elements,this):this;}});Elements.extend=function(props){for(var prop in props){this.prototype[prop]=props[prop];this[prop]=$native.generic(prop);}};function $(el){if(!el)return null;if(el.htmlElement)return Garbage.collect(el);if([window,document].contains(el))return el;var type=$type(el);if(type=='string'){el=document.getElementById(el);type=(el)?'element':false;} if(type!='element')return null;if(el.htmlElement)return Garbage.collect(el);if(['object','embed'].contains(el.tagName.toLowerCase()))return el;$extend(el,Element.prototype);el.htmlElement=function(){};return Garbage.collect(el);};document.getElementsBySelector=document.getElementsByTagName;function $$(){var elements=[];for(var i=0,j=arguments.length;i0&&fKey<13)this.key='f'+fKey;} this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else if(this.type.test(/(click|mouse|menu)/)){this.page={'x':event.pageX||event.clientX+document.documentElement.scrollLeft,'y':event.pageY||event.clientY+document.documentElement.scrollTop};this.client={'x':event.pageX?event.pageX-window.pageXOffset:event.clientX,'y':event.pageY?event.pageY-window.pageYOffset:event.clientY};this.rightClick=(event.which==3)||(event.button==2);switch(this.type){case'mouseover':this.relatedTarget=event.relatedTarget||event.fromElement;break;case'mouseout':this.relatedTarget=event.relatedTarget||event.toElement;} this.fixRelatedTarget();} return this;},stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3)this.relatedTarget=this.relatedTarget.parentNode;},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);}catch(e){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Element.Methods.Events={addEvent:function(type,fn){this.$events=this.$events||{};this.$events[type]=this.$events[type]||{'keys':[],'values':[]};if(this.$events[type].keys.contains(fn))return this;this.$events[type].keys.push(fn);var realType=type;var custom=Element.Events[type];if(custom){if(custom.add)custom.add.call(this,fn);if(custom.map)fn=custom.map;if(custom.type)realType=custom.type;} if(!this.addEventListener)fn=fn.create({'bind':this,'event':true});this.$events[type].values.push(fn);return(Element.NativeEvents.contains(realType))?this.addListener(realType,fn):this;},removeEvent:function(type,fn){if(!this.$events||!this.$events[type])return this;var pos=this.$events[type].keys.indexOf(fn);if(pos==-1)return this;var key=this.$events[type].keys.splice(pos,1)[0];var value=this.$events[type].values.splice(pos,1)[0];var custom=Element.Events[type];if(custom){if(custom.remove)custom.remove.call(this,fn);if(custom.type)type=custom.type;} return(Element.NativeEvents.contains(type))?this.removeListener(type,value):this;},addEvents:function(source){return Element.setMany(this,'addEvent',source);},removeEvents:function(type){if(!this.$events)return this;if(!type){for(var evType in this.$events)this.removeEvents(evType);this.$events=null;}else if(this.$events[type]){this.$events[type].keys.each(function(fn){this.removeEvent(type,fn);},this);this.$events[type]=null;} return this;},fireEvent:function(type,args,delay){if(this.$events&&this.$events[type]){this.$events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);} return this;},cloneEvents:function(from,type){if(!from.$events)return this;if(!type){for(var evType in from.$events)this.cloneEvents(from,evType);}else if(from.$events[type]){from.$events[type].keys.each(function(fn){this.addEvent(type,fn);},this);} return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({'mouseenter':{type:'mouseover',map:function(event){event=new Event(event);if(event.relatedTarget!=this&&!this.hasChild(event.relatedTarget))this.fireEvent('mouseenter',event);}},'mouseleave':{type:'mouseout',map:function(event){event=new Event(event);if(event.relatedTarget!=this&&!this.hasChild(event.relatedTarget))this.fireEvent('mouseleave',event);}},'mousewheel':{type:(window.gecko)?'DOMMouseScroll':'mousewheel'}});Element.NativeEvents=['click','dblclick','mouseup','mousedown','mousewheel','DOMMouseScroll','mouseover','mouseout','mousemove','keydown','keypress','keyup','load','unload','beforeunload','resize','move','focus','blur','change','submit','reset','select','error','abort','contextmenu','scroll'];Function.extend({bindWithEvent:function(bind,args){return this.create({'bind':bind,'arguments':args,'event':Event});}});Elements.extend({filterByTag:function(tag){return new Elements(this.filter(function(el){return(Element.getTag(el)==tag);}));},filterByClass:function(className,nocash){var elements=this.filter(function(el){return(el.className&&el.className.contains(className,' '));});return(nocash)?elements:new Elements(elements);},filterById:function(id,nocash){var elements=this.filter(function(el){return(el.id==id);});return(nocash)?elements:new Elements(elements);},filterByAttribute:function(name,operator,value,nocash){var elements=this.filter(function(el){var current=Element.getProperty(el,name);if(!current)return false;if(!operator)return true;switch(operator){case'=':return(current==value);case'*=':return(current.contains(value));case'^=':return(current.substr(0,value.length)==value);case'$=':return(current.substr(current.length-value.length)==value);case'!=':return(current!=value);case'~=':return current.contains(value,' ');} return false;});return(nocash)?elements:new Elements(elements);}});function $E(selector,filter){return($(filter)||document).getElement(selector);};function $ES(selector,filter){return($(filter)||document).getElementsBySelector(selector);};$$.shared={'regexp':/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,'xpath':{getParam:function(items,context,param,i){var temp=[context.namespaceURI?'xhtml:':'',param[1]];if(param[2])temp.push('[@id="',param[2],'"]');if(param[3])temp.push('[contains(concat(" ", @class, " "), " ',param[3],' ")]');if(param[4]){if(param[5]&¶m[6]){switch(param[5]){case'*=':temp.push('[contains(@',param[4],', "',param[6],'")]');break;case'^=':temp.push('[starts-with(@',param[4],', "',param[6],'")]');break;case'$=':temp.push('[substring(@',param[4],', string-length(@',param[4],') - ',param[6].length,' + 1) = "',param[6],'"]');break;case'=':temp.push('[@',param[4],'="',param[6],'"]');break;case'!=':temp.push('[@',param[4],'!="',param[6],'"]');}}else{temp.push('[@',param[4],']');}} items.push(temp.join(''));return items;},getItems:function(items,context,nocash){var elements=[];var xpath=document.evaluate('.//'+items.join('//'),context,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,j=xpath.snapshotLength;i<\/script>');$('ie_ready').onreadystatechange=function(){if(this.readyState=='complete')domReady();};}}else{window.addListener("load",domReady);document.addListener("DOMContentLoaded",domReady);}}};window.onDomReady=function(fn){return this.addEvent('domready',fn);};window.extend({getWidth:function(){if(this.webkit419)return this.innerWidth;if(this.opera)return document.body.clientWidth;return document.documentElement.clientWidth;},getHeight:function(){if(this.webkit419)return this.innerHeight;if(this.opera)return document.body.clientHeight;return document.documentElement.clientHeight;},getScrollWidth:function(){if(this.ie)return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth);if(this.webkit)return document.body.scrollWidth;return document.documentElement.scrollWidth;},getScrollHeight:function(){if(this.ie)return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight);if(this.webkit)return document.body.scrollHeight;return document.documentElement.scrollHeight;},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getSize:function(){return{'size':{'x':this.getWidth(),'y':this.getHeight()},'scrollSize':{'x':this.getScrollWidth(),'y':this.getScrollHeight()},'scroll':{'x':this.getScrollLeft(),'y':this.getScrollTop()}};},getPosition:function(){return{'x':0,'y':0};}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(p){return-(Math.cos(Math.PI*p)-1)/2;},duration:500,unit:'px',wait:true,fps:50},initialize:function(options){this.element=this.element||null;this.setOptions(options);if(this.options.initialize)this.options.initialize.call(this);},step:function(){var time=$time();if(time=(7-4*a)/11){value=-Math.pow((11-6*a-11*p)/4,2)+b*b;break;}} return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});Fx.Transitions.compat(transition);});var Drag={};Drag.Base=new Class({options:{handle:false,unit:'px',onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:'left',y:'top'},grid:false,snap:6},initialize:function(el,options){this.setOptions(options);this.element=$(el);this.handle=$(this.options.handle)||this.element;this.mouse={'now':{},'pos':{}};this.value={'start':{},'now':{}};this.bound={'start':this.start.bindWithEvent(this),'check':this.check.bindWithEvent(this),'drag':this.drag.bindWithEvent(this),'stop':this.stop.bind(this)};this.attach();if(this.options.initialize)this.options.initialize.call(this);},attach:function(){this.handle.addEvent('mousedown',this.bound.start);return this;},detach:function(){this.handle.removeEvent('mousedown',this.bound.start);return this;},start:function(event){this.fireEvent('onBeforeStart',this.element);this.mouse.start=event.page;var limit=this.options.limit;this.limit={'x':[],'y':[]};for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.element.getStyle(this.options.modifiers[z]).toInt();this.mouse.pos[z]=event.page[z]-this.value.now[z];if(limit&&limit[z]){for(var i=0;i<2;i++){if($chk(limit[z][i]))this.limit[z][i]=($type(limit[z][i])=='function')?limit[z][i]():limit[z][i];}}} if($type(this.options.grid)=='number')this.options.grid={'x':this.options.grid,'y':this.options.grid};document.addListener('mousemove',this.bound.check);document.addListener('mouseup',this.bound.stop);this.fireEvent('onStart',this.element);event.stop();},check:function(event){var distance=Math.round(Math.sqrt(Math.pow(event.page.x-this.mouse.start.x,2)+Math.pow(event.page.y-this.mouse.start.y,2)));if(distance>this.options.snap){document.removeListener('mousemove',this.bound.check);document.addListener('mousemove',this.bound.drag);this.drag(event);this.fireEvent('onSnap',this.element);} event.stop();},drag:function(event){this.out=false;this.mouse.now=event.page;for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.mouse.now[z]-this.mouse.pos[z];if(this.limit[z]){if($chk(this.limit[z][1])&&(this.value.now[z]>this.limit[z][1])){this.value.now[z]=this.limit[z][1];this.out=true;}else if($chk(this.limit[z][0])&&(this.value.now[z]el.left&&now.xel.top);},stop:function(){if(this.overed&&!this.out)this.overed.fireEvent('drop',[this.element,this]);else this.element.fireEvent('emptydrop',this);this.parent();return this;}});Element.extend({makeDraggable:function(options){return new Drag.Move(this,options);}});var XHR=new Class({options:{method:'post',async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:'utf-8',autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject('Microsoft.XMLHTTP'):false);return this;},initialize:function(options){this.setTransport().setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.setHeader('Content-type','application/x-www-form-urlencoded'+encoding);} if(this.options.initialize)this.options.initialize.call(this);},onStateChange:function(){if(this.transport.readyState!=4||!this.running)return;this.running=false;var status=0;try{status=this.transport.status;}catch(e){};if(this.options.isSuccess.call(this,status))this.onSuccess();else this.onFailure();this.transport.onreadystatechange=Class.empty;},isSuccess:function(status){return((status>=200)&&(status<300));},onSuccess:function(){this.response={'text':this.transport.responseText,'xml':this.transport.responseXML};this.fireEvent('onSuccess',[this.response.text,this.response.xml]);this.callChain();},onFailure:function(){this.fireEvent('onFailure',this.transport);},setHeader:function(name,value){this.headers[name]=value;return this;},send:function(url,data){if(this.options.autoCancel)this.cancel();else if(this.running)return this;this.running=true;if(data&&this.options.method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;} this.transport.open(this.options.method.toUpperCase(),url,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=='post')&&this.transport.overrideMimeType)this.setHeader('Connection','close');$extend(this.headers,this.options.headers);for(var type in this.headers)try{this.transport.setRequestHeader(type,this.headers[type]);}catch(e){};this.fireEvent('onRequest');this.transport.send($pick(data,null));return this;},cancel:function(){if(!this.running)return this;this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent('onCancel');return this;}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(url,options){this.addEvent('onSuccess',this.onComplete);this.setOptions(options);this.options.data=this.options.data||this.options.postBody;if(!['post','get'].contains(this.options.method)){this._method='_method='+this.options.method;this.options.method='post';} this.parent();this.setHeader('X-Requested-With','XMLHttpRequest');this.setHeader('Accept','text/javascript, text/html, application/xml, text/xml, */*');this.url=url;},onComplete:function(){if(this.options.update)$(this.options.update).empty().setHTML(this.response.text);if(this.options.evalScripts||this.options.evalResponse)this.evalScripts();this.fireEvent('onComplete',[this.response.text,this.response.xml],20);},request:function(data){data=data||this.options.data;switch($type(data)){case'element':data=$(data).toQueryString();break;case'object':data=Object.toQueryString(data);} if(this._method)data=(data)?[this._method,data].join('&'):this._method;return this.send(this.url,data);},evalScripts:function(){var script,scripts;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))scripts=this.response.text;else{scripts=[];var regexp=/]*>([\s\S]*?)<\/script>/gi;while((script=regexp.exec(this.response.text)))scripts.push(script[1]);scripts=scripts.join('\n');} if(scripts)(window.execScript)?window.execScript(scripts):window.setTimeout(scripts,0);},getHeader:function(name){try{return this.transport.getResponseHeader(name);}catch(e){};return null;}});Object.toQueryString=function(source){var queryString=[];for(var property in source)queryString.push(encodeURIComponent(property)+'='+encodeURIComponent(source[property]));return queryString.join('&');};Element.extend({send:function(options){return new Ajax(this.getProperty('action'),$merge({data:this.toQueryString()},options,{method:'post'})).request();}});var Cookie=new Abstract({options:{domain:false,path:false,duration:false,secure:false},set:function(key,value,options){options=$merge(this.options,options);value=encodeURIComponent(value);if(options.domain)value+='; domain='+options.domain;if(options.path)value+='; path='+options.path;if(options.duration){var date=new Date();date.setTime(date.getTime()+options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();} if(options.secure)value+='; secure';document.cookie=key+'='+value;return $extend(options,{'key':key,'value':value});},get:function(key){var value=document.cookie.match('(?:^|;)\\s*'+key.escapeRegExp()+'=([^;]*)');return value?decodeURIComponent(value[1]):false;},remove:function(cookie,options){if($type(cookie)=='object')this.set(cookie.key,'',$merge(cookie,{duration:-1}));else this.set(cookie,'',$merge(options,{duration:-1}));}});var Json={toString:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/(["\\])/g,'\\$1')+'"';case'array':return'['+obj.map(Json.toString).join(',')+']';case'object':var string=[];for(var property in obj)string.push(Json.toString(property)+':'+Json.toString(obj[property]));return'{'+string.join(',')+'}';case'number':if(isFinite(obj))break;case false:return'null';} return String(obj);},evaluate:function(str,secure){return(($type(str)!='string')||(secure&&!str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/)))?null:eval('('+str+')');}};Json.Remote=XHR.extend({initialize:function(url,options){this.url=url;this.addEvent('onSuccess',this.onComplete);this.parent(options);this.setHeader('X-Request','JSON');},send:function(obj){return this.parent(this.url,'json='+Json.toString(obj));},onComplete:function(){this.fireEvent('onComplete',[Json.evaluate(this.response.text,this.options.secure)]);}});var Asset=new Abstract({javascript:function(source,properties){properties=$merge({'onload':Class.empty},properties);var script=new Element('script',{'src':source}).addEvents({'load':properties.onload,'readystatechange':function(){if(this.readyState=='complete')this.fireEvent('load');}});delete properties.onload;return script.setProperties(properties).inject(document.head);},css:function(source,properties){return new Element('link',$merge({'rel':'stylesheet','media':'screen','type':'text/css','href':source},properties)).inject(document.head);},image:function(source,properties){properties=$merge({'onload':Class.empty,'onabort':Class.empty,'onerror':Class.empty},properties);var image=new Image();image.src=source;var element=new Element('img',{'src':source});['load','abort','error'].each(function(type){var event=properties['on'+type];delete properties['on'+type];element.addEvent(type,function(){this.removeEvent(type,arguments.callee);event.call(this);});});if(image.width&&image.height)element.fireEvent('load',element,1);return element.setProperties(properties);},images:function(sources,options){options=$merge({onComplete:Class.empty,onProgress:Class.empty},options);if(!sources.push)sources=[sources];var images=[];var counter=0;sources.each(function(source){var img=new Asset.image(source,{'onload':function(){options.onProgress.call(this,counter);counter++;if(counter==sources.length)options.onComplete();}});images.push(img);});return new Elements(images);}});var Hash=new Class({length:0,initialize:function(object){this.obj=object||{};this.setLength();},get:function(key){return(this.hasKey(key))?this.obj[key]:null;},hasKey:function(key){return(key in this.obj);},set:function(key,value){if(!this.hasKey(key))this.length++;this.obj[key]=value;return this;},setLength:function(){this.length=0;for(var p in this.obj)this.length++;return this;},remove:function(key){if(this.hasKey(key)){delete this.obj[key];this.length--;} return this;},each:function(fn,bind){$each(this.obj,fn,bind);},extend:function(obj){$extend(this.obj,obj);return this.setLength();},merge:function(){this.obj=$merge.apply(null,[this.obj].extend(arguments));return this.setLength();},empty:function(){this.obj={};this.length=0;return this;},keys:function(){var keys=[];for(var property in this.obj)keys.push(property);return keys;},values:function(){var values=[];for(var property in this.obj)values.push(this.obj[property]);return values;}});function $H(obj){return new Hash(obj);};Hash.Cookie=Hash.extend({initialize:function(name,options){this.name=name;this.options=$extend({'autoSave':true},options||{});this.load();},save:function(){if(this.length==0){Cookie.remove(this.name,this.options);return true;} var str=Json.toString(this.obj);if(str.length>4096)return false;Cookie.set(this.name,str,this.options);return true;},load:function(){this.obj=Json.evaluate(Cookie.get(this.name),true)||{};this.setLength();}});Hash.Cookie.Methods={};['extend','set','merge','empty','remove'].each(function(method){Hash.Cookie.Methods[method]=function(){Hash.prototype[method].apply(this,arguments);if(this.options.autoSave)this.save();return this;};});Hash.Cookie.implement(Hash.Cookie.Methods);var Color=new Class({initialize:function(color,type){type=type||(color.push?'rgb':'hex');var rgb,hsb;switch(type){case'rgb':rgb=color;hsb=rgb.rgbToHsb();break;case'hsb':rgb=color.hsbToRgb();hsb=color;break;default:rgb=color.hexToRgb(true);hsb=rgb.rgbToHsb();} rgb.hsb=hsb;rgb.hex=rgb.rgbToHex();return $extend(rgb,Color.prototype);},mix:function(){var colors=$A(arguments);var alpha=($type(colors[colors.length-1])=='number')?colors.pop():50;var rgb=this.copy();colors.each(function(color){color=new Color(color);for(var i=0;i<3;i++)rgb[i]=Math.round((rgb[i]/100*(100-alpha))+(color[i]/100*alpha));});return new Color(rgb,'rgb');},invert:function(){return new Color(this.map(function(value){return 255-value;}));},setHue:function(value){return new Color([value,this.hsb[1],this.hsb[2]],'hsb');},setSaturation:function(percent){return new Color([this.hsb[0],percent,this.hsb[2]],'hsb');},setBrightness:function(percent){return new Color([this.hsb[0],this.hsb[1],percent],'hsb');}});function $RGB(r,g,b){return new Color([r,g,b],'rgb');};function $HSB(h,s,b){return new Color([h,s,b],'hsb');};Array.extend({rgbToHsb:function(){var red=this[0],green=this[1],blue=this[2];var hue,saturation,brightness;var max=Math.max(red,green,blue),min=Math.min(red,green,blue);var delta=max-min;brightness=max/255;saturation=(max!=0)?delta/max:0;if(saturation==0){hue=0;}else{var rr=(max-red)/delta;var gr=(max-green)/delta;var br=(max-blue)/delta;if(red==max)hue=br-gr;else if(green==max)hue=2+rr-br;else hue=4+gr-rr;hue/=6;if(hue<0)hue++;} return[Math.round(hue*360),Math.round(saturation*100),Math.round(brightness*100)];},hsbToRgb:function(){var br=Math.round(this[2]/100*255);if(this[1]==0){return[br,br,br];}else{var hue=this[0]%360;var f=hue%60;var p=Math.round((this[2]*(100-this[1]))/10000*255);var q=Math.round((this[2]*(6000-this[1]*f))/600000*255);var t=Math.round((this[2]*(6000-this[1]*(60-f)))/600000*255);switch(Math.floor(hue/60)){case 0:return[br,t,p];case 1:return[q,br,p];case 2:return[p,br,t];case 3:return[p,q,br];case 4:return[t,p,br];case 5:return[br,p,q];}} return false;}});var Scroller=new Class({options:{area:20,velocity:1,onChange:function(x,y){this.element.scrollTo(x,y);}},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.mousemover=([window,document].contains(element))?$(document.body):this.element;},start:function(){this.coord=this.getCoords.bindWithEvent(this);this.mousemover.addListener('mousemove',this.coord);},stop:function(){this.mousemover.removeListener('mousemove',this.coord);this.timer=$clear(this.timer);},getCoords:function(event){this.page=(this.element==window)?event.client:event.page;if(!this.timer)this.timer=this.scroll.periodical(50,this);},scroll:function(){var el=this.element.getSize();var pos=this.element.getPosition();var change={'x':0,'y':0};for(var z in this.page){if(this.page[z]<(this.options.area+pos[z])&&el.scroll[z]!=0) change[z]=(this.page[z]-this.options.area-pos[z])*this.options.velocity;else if(this.page[z]+this.options.area>(el.size[z]+pos[z])&&el.scroll[z]+el.size[z]!=el.scrollSize[z]) change[z]=(this.page[z]-el.size[z]+this.options.area-pos[z])*this.options.velocity;} if(change.y||change.x)this.fireEvent('onChange',[el.scroll.x+change.x,el.scroll.y+change.y]);}});Scroller.implement(new Events,new Options);var Slider=new Class({options:{onChange:Class.empty,onComplete:Class.empty,onTick:function(pos){this.knob.setStyle(this.p,pos);},mode:'horizontal',steps:100,offset:0},initialize:function(el,knob,options){this.element=$(el);this.knob=$(knob);this.setOptions(options);this.previousChange=-1;this.previousEnd=-1;this.step=-1;this.element.addEvent('mousedown',this.clickedElement.bindWithEvent(this));var mod,offset;switch(this.options.mode){case'horizontal':this.z='x';this.p='left';mod={'x':'left','y':false};offset='offsetWidth';break;case'vertical':this.z='y';this.p='top';mod={'x':false,'y':'top'};offset='offsetHeight';} this.max=this.element[offset]-this.knob[offset]+(this.options.offset*2);this.half=this.knob[offset]/2;this.getPos=this.element['get'+this.p.capitalize()].bind(this.element);this.knob.setStyle('position','relative').setStyle(this.p,-this.options.offset);var lim={};lim[this.z]=[-this.options.offset,this.max-this.options.offset];this.drag=new Drag.Base(this.knob,{limit:lim,modifiers:mod,snap:0,onStart:function(){this.draggedKnob();}.bind(this),onDrag:function(){this.draggedKnob();}.bind(this),onComplete:function(){this.draggedKnob();this.end();}.bind(this)});if(this.options.initialize)this.options.initialize.call(this);},set:function(step){this.step=step.limit(0,this.options.steps);this.checkStep();this.end();this.fireEvent('onTick',this.toPosition(this.step));return this;},clickedElement:function(event){var position=event.page[this.z]-this.getPos()-this.half;position=position.limit(-this.options.offset,this.max-this.options.offset);this.step=this.toStep(position);this.checkStep();this.end();this.fireEvent('onTick',position);},draggedKnob:function(){this.step=this.toStep(this.drag.value.now[this.z]);this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent('onChange',this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent('onComplete',this.step+'');}},toStep:function(position){return Math.round((position+this.options.offset)/this.max*this.options.steps);},toPosition:function(step){return this.max*step/this.options.steps;}});Slider.implement(new Events);Slider.implement(new Options);var SmoothScroll=Fx.Scroll.extend({initialize:function(options){this.parent(window,options);this.links=(this.options.links)?$$(this.options.links):$$(document.links);var location=window.location.href.match(/^[^#]*/)[0]+'#';this.links.each(function(link){if(link.href.indexOf(location)!=0)return;var anchor=link.href.substr(location.length);if(anchor&&$(anchor))this.useLink(link,anchor);},this);if(!window.webkit419)this.addEvent('onComplete',function(){window.location.hash=this.anchor;});},useLink:function(link,anchor){link.addEvent('click',function(event){this.anchor=anchor;this.toElement(anchor);event.stop();}.bindWithEvent(this));}});var Sortables=new Class({options:{handles:false,onStart:Class.empty,onComplete:Class.empty,ghost:true,snap:3,onDragStart:function(element,ghost){ghost.setStyle('opacity',0.7);element.setStyle('opacity',0.7);},onDragComplete:function(element,ghost){element.setStyle('opacity',1);ghost.remove();this.trash.remove();}},initialize:function(list,options){this.setOptions(options);this.list=$(list);this.elements=this.list.getChildren();this.handles=(this.options.handles)?$$(this.options.handles):this.elements;this.bound={'start':[],'moveGhost':this.moveGhost.bindWithEvent(this)};for(var i=0,l=this.handles.length;i0);var prev=this.active.getPrevious();var next=this.active.getNext();if(prev&&up&&nownext.getCoordinates().top)this.active.injectAfter(next);this.previous=now;},serialize:function(converter){return this.list.getChildren().map(converter||function(el){return this.elements.indexOf(el);},this);},end:function(){this.previous=null;document.removeListener('mousemove',this.bound.move);document.removeListener('mouseup',this.bound.end);if(this.options.ghost){document.removeListener('mousemove',this.bound.moveGhost);this.fireEvent('onDragComplete',[this.active,this.ghost]);} this.fireEvent('onComplete',this.active);}});Sortables.implement(new Events,new Options);var Tips=new Class({options:{onShow:function(tip){tip.setStyle('visibility','visible');},onHide:function(tip){tip.setStyle('visibility','hidden');},maxTitleChars:30,showDelay:100,hideDelay:100,className:'tool',offsets:{'x':16,'y':16},fixed:false},initialize:function(elements,options){this.setOptions(options);this.toolTip=new Element('div',{'class':this.options.className+'-tip','styles':{'position':'absolute','top':'0','left':'0','visibility':'hidden'}}).inject(document.body);this.wrapper=new Element('div').inject(this.toolTip);$$(elements).each(this.build,this);if(this.options.initialize)this.options.initialize.call(this);},build:function(el){el.$tmp.myTitle=(el.href&&el.getTag()=='a')?el.href.replace('http://',''):(el.rel||false);if(el.title){var dual=el.title.split('::');if(dual.length>1){el.$tmp.myTitle=dual[0].trim();el.$tmp.myText=dual[1].trim();}else{el.$tmp.myText=el.title;} el.removeAttribute('title');}else{el.$tmp.myText=false;} if(el.$tmp.myTitle&&el.$tmp.myTitle.length>this.options.maxTitleChars)el.$tmp.myTitle=el.$tmp.myTitle.substr(0,this.options.maxTitleChars-1)+"…";el.addEvent('mouseenter',function(event){this.start(el);if(!this.options.fixed)this.locate(event);else this.position(el);}.bind(this));if(!this.options.fixed)el.addEvent('mousemove',this.locate.bindWithEvent(this));var end=this.end.bind(this);el.addEvent('mouseleave',end);el.addEvent('trash',end);},start:function(el){this.wrapper.empty();if(el.$tmp.myTitle){this.title=new Element('span').inject(new Element('div',{'class':this.options.className+'-title'}).inject(this.wrapper)).setHTML(el.$tmp.myTitle);} if(el.$tmp.myText){this.text=new Element('span').inject(new Element('div',{'class':this.options.className+'-text'}).inject(this.wrapper)).setHTML(el.$tmp.myText);} $clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);},end:function(event){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},position:function(element){var pos=element.getPosition();this.toolTip.setStyles({'left':pos.x+this.options.offsets.x,'top':pos.y+this.options.offsets.y});},locate:function(event){var win={'x':window.getWidth(),'y':window.getHeight()};var scroll={'x':window.getScrollLeft(),'y':window.getScrollTop()};var tip={'x':this.toolTip.offsetWidth,'y':this.toolTip.offsetHeight};var prop={'x':'left','y':'top'};for(var z in prop){var pos=event.page[z]+this.options.offsets[z];if((pos+tip[z]-scroll[z])>win[z])pos=event.page[z]-this.options.offsets[z]-tip[z];this.toolTip.setStyle(prop[z],pos);};},show:function(){if(this.options.timeout)this.timer=this.hide.delay(this.options.timeout,this);this.fireEvent('onShow',[this.toolTip]);},hide:function(){this.fireEvent('onHide',[this.toolTip]);}});Tips.implement(new Events,new Options);var Group=new Class({initialize:function(){this.instances=$A(arguments);this.events={};this.checker={};},addEvent:function(type,fn){this.checker[type]=this.checker[type]||{};this.events[type]=this.events[type]||[];if(this.events[type].contains(fn))return false;else this.events[type].push(fn);this.instances.each(function(instance,i){instance.addEvent(type,this.check.bind(this,[type,instance,i]));},this);return this;},check:function(type,instance,i){this.checker[type][i]=true;var every=this.instances.every(function(current,j){return this.checker[type][j]||false;},this);if(!every)return;this.checker[type]={};this.events[type].each(function(event){event.call(this,this.instances,instance);},this);}});var Accordion=Fx.Elements.extend({options:{onActive:Class.empty,onBackground:Class.empty,display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var options,togglers,elements,container;$each(arguments,function(argument,i){switch($type(argument)){case'object':options=argument;break;case'element':container=$(argument);break;default:var temp=$$(argument);if(!togglers)togglers=temp;else elements=temp;}});this.togglers=togglers||[];this.elements=elements||[];this.container=$(container);this.setOptions(options);this.previous=-1;if(this.options.alwaysHide)this.options.wait=true;if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;} if(this.options.start){this.options.display=false;this.options.show=false;} this.effects={};if(this.options.opacity)this.effects.opacity='fullOpacity';if(this.options.width)this.effects.width=this.options.fixedWidth?'fullWidth':'offsetWidth';if(this.options.height)this.effects.height=this.options.fixedHeight?'fullHeight':'scrollHeight';for(var i=0,l=this.togglers.length;i0));this.fireEvent(hide?'onBackground':'onActive',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]];},this);return this.start(obj);},showThisHideOpen:function(index){return this.display(index);}});Fx.Accordion=Accordion;/** * @version $Id: caption.js 5263 2006-10-02 01:25:24Z webImagery $ * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ /** * JCaption javascript behavior * * Used for displaying image captions * * @package Joomla * @since 1.5 * @version 1.0 */ var JCaption = new Class({ initialize: function(selector) { this.selector = selector; var images = $$(selector); images.each(function(image){ this.createCaption(image); }, this); }, createCaption: function(element) { var caption = document.createTextNode(element.title); var container = document.createElement("div"); var text = document.createElement("p"); var width = element.getAttribute("width"); var align = element.getAttribute("align"); if(!width) { width = element.width; } //Windows fix if (!align) align = element.getStyle("float"); // Rest of the world fix if (!align) // IE DOM Fix align = element.style.styleFloat; if (align=="") { align="none"; } text.appendChild(caption); text.className = this.selector.replace('.', '_'); element.parentNode.insertBefore(container, element); container.appendChild(element); if ( element.title != "" ) { container.appendChild(text); } container.className = this.selector.replace('.', '_'); container.className = container.className + " " + align; container.setAttribute("style","float:"+align); container.style.width = width + "px"; } }); document.caption = null; window.addEvent('load', function() { var caption = new JCaption('img.caption') document.caption = caption }); var TINY={}; function T$(i){return document.getElementById(i)} TINY.box=function(){ var p,m,b,fn,ic,iu,iw,ih,ia,f=0; return{ show:function(c,u,w,h,a){ if(!f){ p=document.createElement('div'); p.id='tinybox'; m=document.createElement('div'); m.id='tinymask'; b=document.createElement('div'); b.id='tinycontent'; document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b); window.onresize=TINY.box.resize; f=1 } if(!a&&!u){ p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto'; p.style.backgroundImage='none'; b.innerHTML=c }else{ b.style.display='none'; p.style.width=p.style.height='100px' } this.mask(); ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3); setTimeout(function(){TINY.box.hide()},1000*20) }, fill:function(c,u,w,h,a){ if(u){ p.style.backgroundImage=''; var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP'); x.onreadystatechange=function(){ if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)} }; x.open('GET',c,1); x.send(null) }else{ this.psh(c,w,h,a) } }, psh:function(c,w,h,a){ if(a){ if(!w||!h){ var x=p.style.width, y=p.style.height; b.innerHTML=c; p.style.width=w?w+'px':''; p.style.height=h?h+'px':''; b.style.display=''; w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight); b.style.display='none'; p.style.width=x; p.style.height=y; }else{ b.innerHTML=c } this.size(p,w,h,4) }else{ p.style.backgroundImage='none' } }, hide:function(){ TINY.box.alpha(p,-1,0,3) }, resize:function(){ TINY.box.pos(); TINY.box.mask() }, mask:function(){ m.style.height=TINY.page.theight()+'px'; m.style.width=''; m.style.width=TINY.page.twidth()+'px' }, pos:function(){ var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t; p.style.top=(t+TINY.page.top())+'px'; p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px' }, alpha:function(e,d,a,s){ clearInterval(e.ai); if(d==1){ e.style.opacity=0; e.style.filter='alpha(opacity=0)'; e.style.display='block'; this.pos() } e.ai=setInterval(function(){TINY.box.twalpha(e,a,d,s)},20) }, twalpha:function(e,a,d,s){ var o=Math.round(e.style.opacity*100); if(o==a){ clearInterval(e.ai); if(d==-1){ e.style.display='none'; e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage='' }else{ e==m?this.alpha(p,1,100,5):TINY.box.fill(ic,iu,iw,ih,ia) } }else{ var n=o+Math.ceil(Math.abs(a-o)/s)*d; e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')' } }, size:function(e,w,h,s){ e=typeof e=='object'?e:T$(e); clearInterval(e.si); var ow=e.offsetWidth, oh=e.offsetHeight, wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height); var wd=ow-wo>w?-1:1, hd=(oh-ho>h)?-1:1; e.si=setInterval(function(){TINY.box.twsize(e,w,wo,wd,h,ho,hd,s)},20) }, twsize:function(e,w,wo,wd,h,ho,hd,s){ var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho; if(ow==w&&oh==h){ clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block' }else{ if(ow!=w){e.style.width=ow+(Math.ceil(Math.abs(w-ow)/s)*wd)+'px'} if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'} this.pos() } } } }(); TINY.page=function(){ return{ top:function(){return document.body.scrollTop||document.documentElement.scrollTop}, width:function(){return self.innerWidth||document.documentElement.clientWidth}, height:function(){return self.innerHeight||document.documentElement.clientHeight}, theight:function(){ var d=document, b=d.body, e=d.documentElement; return Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)) }, twidth:function(){ var d=document, b=d.body, e=d.documentElement; return Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth)) } } }();/** * HistoryManager * * Observes back/forward button usage and saves states * for registered modules into the hash. This allows to * bookmark specific states for an application. * * @version 1.0rc2 * * @see Events, Options * * @license MIT License * @author Harald Kirschner * @copyright 2007 Author */ var HistoryManager = { /** * Default options - Can be overridden with setOptions * * observeDelay: Duration for checking the state, default 100ms * stateSeparator: Seperator for module-state join, default ';' * iframeSrc: Scr for IE6/7 iframe, must exist on server! * onStart: Fires on start * onRegister: Fires on register * onUnregister: Fires on unregister * onUpdate: Fires when state changes from ... * onStateChange: ... module changes * onObserverChange: ... history change */ options: { observeDelay: 100, stateSeparator: ';', iframeSrc: 'blank.html', onStart: Class.empty, onRegister: Class.empty, onUnregister: Class.empty, onStart: Class.empty, onUpdate: Class.empty, onStateChange: Class.empty, onObserverChange: Class.empty }, /** * Default options for register * * defaults: Default values array, initially empty. * regexpParams: When regexp is a String, this is the second argument for new RegExp. * skipDefaultMatch: default true; When true onGenerate is not called when current values are similar to the default values. */ dataOptions: { skipDefaultMatch: true, defaults: [], regexpParams: '' }, /** * Constructur - Class.initialize * * Options: * - observeDelay: duration in ms, default 100 - BackBuddy observe the hash for changes periodical * - stateSeparator: char, default ';' - Separator for multiple module-states in the hash * - iframeSrc: string, default 'blank.html' - File for the iframe (IE6/7), must exist on the server! * - Events: onStart, onRegister, onStart, onUpdate, onStateChange, onObserverChange * * @return this * * @param {Object} options */ initialize: function(options) { if (this.modules) return this; this.setOptions(options); this.modules = $H({}); this.count = history.length; this.states = []; this.states[this.count] = this.getHash(); this.state = null; return this; }, /** * Start - Check hash and start observer * * Call start after registering ALL modules. This start the observer, * reads the state from the hash and calls onMatch for effected modules. * * @return this * */ start: function() { this.observe.periodical(this.options.observeDelay, this); this.started = true; this.observe(); this.update(); this.fireEvent('onStart', [this.state]); return this; }, /** * Registers a module * * @return {Object} Object with shortcuts for setValues, setValue, generate and unregister * * @param {String} Module key * @param {Array} default values, the input values given to onMatch and onGenerate will be complemented with these * @param {Function} Will be called when the regexp matches, with the new values as argument. * @param {Function} Should return the string for the state string, values are first argument * @param {RegExp}/{String} Regular expression that matches the string updated from onGenerate * @param {Object} (optional) options */ register: function(key, defaults, onMatch, onGenerate, regexp, options) { if (!this.modules) this.initialize(); var data = $merge(this.dataOptions, options || {}, { defaults: defaults, onMatch: onMatch, onGenerate: onGenerate, regexp: regexp }); data.regexp = data.regexp || key + '-([\\w_-]*)'; if (typeof data.regexp == 'string') data.regexp = new RegExp(data.regexp, data.regexpParams); data.onGenerate = data.onGenerate || function(values) { return key + '-' + values[0]; }; data.values = data.defaults.copy(); this.modules.set(key, data); this.fireEvent('onUnregister', [key, data]); return { setValues: function(values) { return this.setValues(key, values); }.bind(this), setValue: function(index, value) { return this.setValue(key, index, value); }.bind(this), generate: function(values) { return this.generate(key, values); }.bind(this), unregister: function() { return this.unregister(key); }.bind(this) }; }, /** * unregister - Removes an module from the * * @param {String} Module key */ unregister: function(key) { this.fireEvent('onRegister', [key]); this.modules.remove(key); }, /** * setValues - Set all values new, updates new state * * @param {String} Module key * @param {Object} Complete values */ setValues: function(key, values) { var data = this.modules.get(key); if (!data || data.values.isSimilar(values)) return this; data.values = values; this.update(); return this; }, /** * setValue - Set one value, updates new state * * @param {String} Module key * @param {Number} Value index * @param {Object} Value */ setValue: function(key, index, value) { var data = this.modules.get(key); if (!data || data.values[index] == value) return this; data.values[index] = value; this.update(); return this; }, /** * generate - Generates a hash from the given * * @param {String} Module key * @param {Number} Value index * @param {Object} Value */ generate: function(key, values) { var data = this.modules.get(key); var current = data.values.copy(); data.values = values; var state = this.generateState(); data.values = current; return '#' + state; }, observe: function() { if (this.timeout) return; var state = this.getState(); if (this.state == state) return; if ((window.ie || window.webkit419) && (this.state !== null)) this.setState(state, true); else this.state = state; this.modules.each(function(data, key) { var bits = state.match(data.regexp); if (bits) { bits.splice(0, 1); bits.complement(data.defaults); if (!bits.isSimilar(data.defaults)) data.values = bits; } else data.values = data.defaults.copy(); data.onMatch(data.values, data.defaults); }); this.fireEvent('onStateChange', [state]).fireEvent('onObserverChange', [state]); }, generateState: function() { var state = []; this.modules.each(function(data, key) { if (data.skipDefaultMatch && data.values.isSimilar(data.defaults)) return; state.push(data.onGenerate(data.values)); }); return state.join(this.options.stateSeparator); }, update: function() { if (!this.started) return this; var state = this.generateState(); if ((!this.state && !state) || (this.state == state)) return this; this.setState(state); this.fireEvent('onStateChange', [state]).fireEvent('onUpdate', [state]); return this; }, observeTimeout: function() { if (this.timeout) this.timeout = $clear(this.timeout); else this.timeout = this.observeTimeout.delay(200, this); }, getHash: function() { var href = top.location.href; var pos = href.indexOf('#') + 1; return (pos) ? href.substr(pos) : ''; }, getState: function() { var state = this.getHash(); if (this.iframe) { var doc = this.iframe.contentWindow.document; if (doc && doc.body.id == 'state') { var istate = doc.body.innerText; if (this.state == state) return istate; this.istateOld = true; } else return this.istate; } if (window.webkit419 && history.length != this.count) { this.count = history.length; return $pick(this.states[this.count - 1], state); } return state; }, setState: function(state, fix) { state = $pick(state, ''); if (window.webkit419) { if (!this.form) this.form = new Element('form', {method: 'get'}).injectInside(document.body); this.count = history.length; this.states[this.count] = state; this.observeTimeout(); this.form.setProperty('action', '#' + state).submit(); } else top.location.hash = state || '#'; if (window.ie && (!fix || this.istateOld)) { if (!this.iframe) { this.iframe = new Element('iframe', { src: this.options.iframeSrc, styles: 'visibility: hidden;' }).injectInside(document.body); this.istate = this.state; } try { var doc = this.iframe.contentWindow.document; doc.open(); doc.write('' + state + ''); doc.close(); this.istateOld = false; } catch(e) {}; } this.state = state; }, extend: $extend }; HistoryManager.extend(Events.prototype); HistoryManager.extend(Options.prototype); /** * Extends Array with 2 helpers: isSimilar(array) and complement(array) * */ Array.extend({ /** * isSimilar - Returns true for similar arrays, type-insensitive * * @example * [1].isSimilar(['1']) == true * [1, 2].isSimilar([1, false]) == false * * @return {Boolean} * @param {Object} Array */ isSimilar: function(array) { return (this.toString() == array.toString()); }, /** * complement - Fills up empty array values from another array, length is the same * * @example * [1, null].complement([3, 4]) == [1, 4] * [undefined, '1'].complement([2, 3, 4]) == [2, '1'] * @return {Array} this * @param {Object} Array */ complement: function(array) { for (var i = 0, j = this.length; i < j; i++) this[i] = $pick(this[i], array[i] || null); return this; } });var JOSC_http = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); var JOSC_operaBrowser = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); var JOSC_rsearchphrase_selection="any"; /* in case of modify */ var JOSC_userName = ''; var JOSC_userEmail = ''; var JOSC_userWebsite = ''; var JOSC_userNotify = ''; /* ***************** */ var JOSC_XmlErrorAlert = false; /* will be redefined by setting */ var JOSC_AjaxDebug = false; /* will be redefined by setting */ var JOSC_AjaxDebugLevel = 2; /* will be redefined by setting */ var JOSC_postREFRESH=false; var JOSC_clientPC = navigator.userAgent.toLowerCase(); var JOSC_clientVer = parseInt(navigator.appVersion); var JOSC_is_ie = ((JOSC_clientPC.indexOf("msie") != -1) && (JOSC_clientPC.indexOf("opera") == -1)); var JOSC_is_nav = ((JOSC_clientPC.indexOf('mozilla')!=-1) && (JOSC_clientPC.indexOf('spoofer')==-1) && (JOSC_clientPC.indexOf('compatible') == -1) && (JOSC_clientPC.indexOf('opera')==-1) && (JOSC_clientPC.indexOf('webtv')==-1) && (JOSC_clientPC.indexOf('hotjava')==-1)); var JOSC_is_moz = 0; var JOSC_is_win = ((JOSC_clientPC.indexOf("win")!=-1) || (JOSC_clientPC.indexOf("16bit") != -1)); var JOSC_is_mac = (JOSC_clientPC.indexOf("mac")!=-1); var JOSC_scrollTopPos = 0; var JOSC_scrollLeftPos = 0; function JOSC_insertAdjacentElement( object, where, parsedNode ) { if (!object.JOSCinsertAdjacentElement) object.insertAdjacentElement(where, parsedNode); else object.JOSCinsertAdjacentElement(where, parsedNode); } function JOSC_insertAdjacentHTML( object, where, htmlStr ) { if (!object.JOSCinsertAdjacentHTML) object.insertAdjacentHTML(where, htmlStr); else object.JOSCinsertAdjacentHTML(where, htmlStr); } if (typeof HTMLElement != "undefined" && ! HTMLElement.prototype.JOSCinsertAdjacentElement) { HTMLElement.prototype.JOSCinsertAdjacentElement = function (where, parsedNode) { switch (where) { case 'beforeBegin': this.parentNode.insertBefore(parsedNode, this) break; case 'afterBegin': this.insertBefore(parsedNode, this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) this.parentNode.insertBefore(parsedNode, this.nextSibling); else this.parentNode.appendChild(parsedNode); break; } } HTMLElement.prototype.JOSCinsertAdjacentHTML = function (where, htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.JOSCinsertAdjacentElement(where, parsedHTML) } /* HTMLElement.prototype.JOSCinsertAdjacentText = function (where, txtStr) { var parsedText = document.createTextNode(txtStr) this.JOSCinsertAdjacentElement(where, parsedText) } */ } /*************************** * F U N C T I O N S ***************************/ function JOSC_HTTPParam() { } JOSC_HTTPParam.prototype.create = function(josctask, id) { this.result = 'option=com_comment'; this.insert('no_html', 1); var form = document.joomlacommentform; this.insert('component', form.component.value); this.insert('joscsectionid', form.joscsectionid.value); this.insert('josctask', josctask); this.insert('comment_id', id); return this.result; } JOSC_HTTPParam.prototype.insert = function(name, value) { this.result += '&' + name + '=' + value; return this.result; } JOSC_HTTPParam.prototype.encode = function(name, value) { return this.insert(name, encodeURIComponent(value)); } function JOSC_BusyImage() { } JOSC_BusyImage.prototype.create = function(id) { // var form = document.joomlacommentform; var image = document.createElement('img'); image.setAttribute('src', JOSC_template + '/images/busy.gif'); image.setAttribute('id', id+"Image"); var element = document.getElementById(id); if (!element.innerHTML) element.appendChild(image); JOSC_ajaxNotActive = false; } JOSC_BusyImage.prototype.destroy = function(id) { var image = document.getElementById(id+"Image"); image.parentNode.removeChild(image); JOSC_ajaxNotActive = true; } var JOSC_ajaxNotActive = true; /* will be set in create/destroy BusyImage */ var JOSC_busyImage = new JOSC_BusyImage(); function JOSC_ajaxSend(data, onReadyStateChange) { document.joomlacommentform.bsend.disabled = true; JOSC_busyImage.create('JOSC_busypage'); JOSC_busyImage.create('JOSC_busy'); var URL = JOSC_ConfigLiveSite+'index.php'; JOSC_http.open("POST", URL , true); JOSC_http.onreadystatechange = onReadyStateChange; JOSC_http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); if (JOSC_AjaxDebug) alert('###AJAXSEND:\n##URL=' + URL + ' ?' + data + '\n##onReadyStateChange=' + onReadyStateChange); JOSC_http.send(data); } function JOSC_ajaxReady() { if (JOSC_http.readyState == 4) { /* received */ JOSC_busyImage.destroy('JOSC_busy'); JOSC_busyImage.destroy('JOSC_busypage'); document.joomlacommentform.bsend.disabled = false; JOSC_addNew(); if (JOSC_http.status == 200) { /* response is ok */ if (JOSC_AjaxDebug) alert('AJAXREADY: OK !' ); return true; } else { if (JOSC_AjaxDebug) alert('AJAXREADY: KO ! Status=' + JOSC_http.status ); return false; } } return false; } function JOSC_goToAnchor(name) { clearTimeout(self.timer); action = function() { var url = window.location.toString(); var index = url.indexOf('#'); if (index == -1) { window.location = url + '#' + name; } else { window.location = url.substring(0, index) + '#' + name; } if (JOSC_operaBrowser) window.location = '##'; } if (JOSC_operaBrowser) self.timer = setTimeout(action, 50); else action(); } function JOSC_refreshPage(msg, id) { if (msg) alert(msg); clearTimeout(self.timer); action = function() { var url = window.location.toString(); var index = url.indexOf('?option='); if (index == -1) { var sep = '?'; } /* SEF */ else { var sep = '&'; } /* normal */ window.location = JOSC_linkToContent + sep + 'comment_id=' + id + '#josc' + id; //if (JOSC_operaBrowser) window.location = '##'; } if (JOSC_operaBrowser) self.timer = setTimeout(action, 50); else action(); } function JOSC_getXmlResponse(withalert) { /* return DOM (W3C) if no parsing xml error else null (alert will show a javascript alert) */ if (JOSC_http.responseXML && JOSC_http.responseXML.parseError &&(JOSC_http.responseXML.parseError.errorCode !=0)) { error = JOSC_getXmlError(withalert); return null; } else { if (JOSC_AjaxDebug) alert('###GETXMLRESPONSE:\n' + JOSC_http.responseText ); /* if (JOSC_operaBrowser && JOSC_AjaxDebug && JOSC_AjaxDebugLevel>1) { txt = ''; for (prop in JOSC_http.responseXML) { txt = txt + '\n' + prop + '=' + JOSC_http.responseXML[prop]; } alert('JOSC_getXmlResponse:http.responseXML='+txt); }*/ return JOSC_http.responseXML; } } function JOSC_getXmlError(withalert) { if (JOSC_http.responseXML.parseError.errorCode !=0 ) { line = JOSC_http.responseXML.parseError.line; pos = JOSC_http.responseXML.parseError.linepos; error = JOSC_http.responseXML.parseError.reason; error = error + "Contact the support ! and send the following informations:\n error is line " + line + " position " + pos; error = error + " >>" + JOSC_http.responseXML.parseError.srcText.substring(pos); error = error + "\nGLOBAL:" + JOSC_http.responseText; if (withalert) alert(error); return error; } else { return ""; } } /* * Form type function */ function JOSC_modifyForm(formTitle, buttonValue, onClick) { document.getElementById('CommentFormTitle').innerHTML = formTitle; button = document.joomlacommentform.bsend; button.value = buttonValue; button.onclick = onClick; } function JOSC_xmlValue(xmlDocument, tagName) { try { var result = xmlDocument.getElementsByTagName(tagName).item(0).firstChild.data; } catch(e) { var result = ''; } return result; } function JOSC_removePost(post) { document.getElementById('Comments').removeChild(post); } /********************* * ajax call functions */ function JOSC_deleteComment(id) { if (window.confirm(_JOOMLACOMMENT_MSG_DELETE)) { var data = new JOSC_HTTPParam().create('ajax_delete', id); JOSC_ajaxSend(data, function() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText != '') alert(JOSC_http.responseText); else JOSC_removePost(document.getElementById('post' + id)); } } ); } } function JOSC_deleteAll() { if (window.confirm(_JOOMLACOMMENT_MSG_DELETEALL)) { var form = document.joomlacommentform; var param = new JOSC_HTTPParam(); param.create('ajax_delete_all', -1); JOSC_ajaxSend(param.insert('content_id',form.content_id.value), function() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText != '') alert(JOSC_http.responseText); else { /* JOSC_addNew(); why ? */ document.getElementById('Comments').innerHTML=''; } } } ); } } function JOSC_editComment(id) { JOSC_modifyForm(_JOOMLACOMMENT_EDITCOMMENT, _JOOMLACOMMENT_EDIT, function(event) { JOSC_editPost(id, -1);} ); JOSC_goToAnchor('CommentForm'); var data = new JOSC_HTTPParam().create('ajax_modify', id); JOSC_ajaxSend(data, JOSC_editResponse); } function JOSC_quote(id) { var data = new JOSC_HTTPParam().create('ajax_quote', id); JOSC_goToAnchor('CommentForm'); JOSC_ajaxSend(data, JOSC_quoteResponse); } function JOSC_voting(id, yes_no) { var data = new JOSC_HTTPParam().create('ajax_voting_' + yes_no, id); JOSC_ajaxSend(data, JOSC_votingResponse); } function JOSC_reloadCaptcha() { var data = new JOSC_HTTPParam().create('ajax_reload_captcha', 0); JOSC_ajaxSend(data, JOSC_editPostResponse); } function JOSC_searchForm() { JOSC_removeSearchResults(); var searchform = document.joomlacommentsearch; var form = document.joomlacommentform; if (searchform) { searchform.parentNode.removeChild(searchform); if (!JOSC_operaBrowser) document.joomlacommentsearch = null; } else { var param = new JOSC_HTTPParam(); param.create('ajax_insert_search', 0); JOSC_ajaxSend(param.insert('content_id', form.content_id.value), JOSC_searchFormResponse); } } function JOSC_search() { JOSC_removeSearchResults(); var keyword = document.joomlacommentsearch.tsearch.value; if (keyword=='') return 0; var param = new JOSC_HTTPParam(); param.create('ajax_search', 0); param.encode('search_keyword', keyword) JOSC_ajaxSend(param.insert('search_phrase',JOSC_rsearchphrase_selection), JOSC_searchResponse); } function JOSC_EmailCheck(str) { var at="@"; var dot="."; var lat=str.indexOf(at); var lstr=str.length; var ldot=str.indexOf(dot); if( (str.indexOf(at)==-1) || (str.indexOf(at)==0) || (str.indexOf(at)==lstr) || (str.indexOf(dot)==-1) || (str.indexOf(dot)==0) || (str.indexOf(dot)==lstr) ) return 0; if( (str.indexOf(at,(lat+1))!=-1) || (str.indexOf(dot,(lat+2)))==-1 ) return 0; if( (str.substring(lat-1,lat)==dot) || (str.substring(lat+1,lat+2)==dot) ) return 0; if( str.indexOf(" ")!=-1 ) return 0; return 1; } //function editPost(id, parentid) { // /* for backward compatibility with templates */ // return JOSC_editPost(id, parentid); //} function JOSC_editPost(id, parentid) { var form = document.joomlacommentform; if (form.tcomment.value == '') { alert(_JOOMLACOMMENT_FORMVALIDATE); return 0; } if ( document.getElementsByName('tnotify')[0] && document.getElementsByName('temail')[0] ) { if ( form.tnotify.selectedIndex && form.temail.value == '') { alert(_JOOMLACOMMENT_FORMVALIDATE_EMAIL); return 0; } } if (!JOSC_EmailCheck(form.temail.value)) { alert("Please enter a valid email address. For example jelkins@domain.com ."); return 0; } if (JOSC_captchaEnabled && form.security_try.value == '') { alert(_JOOMLACOMMENT_FORMVALIDATE_CAPTCHA); return 0; } if (JOSC_ajaxEnabled) { var param = new JOSC_HTTPParam(); param.create(id == -1 ? 'ajax_insert' : 'ajax_edit', id); param.insert('content_id', form.content_id.value); if (JOSC_captchaEnabled) { param.insert('security_try', form.security_try.value); param.insert('security_refid', form.security_refid.value); } if (parentid != -1) param.insert('parent_id', parentid); param.encode('tname', form.tname.value); /* optional */ if (document.getElementsByName('tnotify')[0]) { if (form.tnotify.selectedIndex) param.encode('tnotify', '1'); else param.encode('tnotify', '0'); }; if (document.getElementsByName('temail')[0]) param.encode('temail', form.temail.value); if (document.getElementsByName('twebsite')[0]) param.encode('twebsite', form.twebsite.value); /************/ param.encode('ttitle', form.ttitle.value); JOSC_ajaxSend(param.encode('tcomment', form.tcomment.value), JOSC_editPostResponse); } else { /* should we use JOSC_ConfigLiveSite ? */ form.action = JOSC_ConfigLiveSite+'/index.php?option=com_comment&josctask=noajax'; form.submit(); } } function JOSC_getComments(id, limitstart) { var form = document.joomlacommentform; if (JOSC_ajaxEnabled && JOSC_ajaxNotActive) { JOSC_ShowHide('', 'joscPageNavNoLink', 'joscPageNavLink'); var param = new JOSC_HTTPParam(); param.create('ajax_getcomments', id); param.insert('content_id',form.content_id.value); JOSC_ajaxSend(param.insert('josclimitstart', limitstart), JOSC_getCommentsResponse); } } /* * END of ajax call functions */ /******************** * response functions */ function JOSC_editResponse() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText.indexOf('invalid') == -1) { var form = document.joomlacommentform; var xmlDocument = JOSC_getXmlResponse(JOSC_XmlErrorAlert);; /*JOSC_http.responseXML;*/ if (xmlDocument) { JOSC_userName = form.tname.value; form.tname.value = JOSC_xmlValue(xmlDocument, 'name'); form.ttitle.value = JOSC_xmlValue(xmlDocument, 'title'); form.tcomment.value = JOSC_xmlValue(xmlDocument, 'comment'); /* optional values of the templates ! */ if (document.getElementsByName('tnotify')[0]) { JOSC_userNotify = form.tnotify.selectedIndex; form.tnotify.selectedIndex = new Boolean(JOSC_xmlValue(xmlDocument, 'notify')*1); } if (document.getElementsByName('temail')[0]) { JOSC_userEmail = form.temail.value; form.temail.value = JOSC_xmlValue(xmlDocument, 'email'); } if (document.getElementsByName('twebsite')[0]) { JOSC_userWebsite = form.twebsite.value; form.twebsite.value = JOSC_xmlValue(xmlDocument, 'website'); } /* ********************** */ } else { form.tcomment.value = 'failed to retrieve datas'; } if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_edit'); } } } function JOSC_quoteResponse() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText.indexOf('invalid') == -1) { var form = document.joomlacommentform; var xmlDocument = JOSC_getXmlResponse(true); if (xmlDocument) { name = JOSC_xmlValue(xmlDocument, 'name'); if (name == '') name = _JOOMLACOMMENT_ANONYMOUS; if (form.ttitle.value == '') form.ttitle.value = 're: ' + JOSC_xmlValue(xmlDocument, 'title'); form.tcomment.value += '[quote=' + name + ']' + JOSC_xmlValue(xmlDocument, 'comment') + '[/quote]'; } else { form.tcomment.value = 'failed to retrieve datas'; } if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_quote'); } } } function JOSC_votingResponse() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText.indexOf('invalid') == -1) { var form = document.joomlacommentform; var xmlDocument = JOSC_getXmlResponse(JOSC_XmlErrorAlert); /*JOSC_http.responseXML;*/ var id = JOSC_xmlValue(xmlDocument, 'id'); var yes = JOSC_xmlValue(xmlDocument, 'yes'); var no = JOSC_xmlValue(xmlDocument, 'no'); document.getElementById('yes' + id).innerHTML = yes; document.getElementById('no' + id).innerHTML = no; if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_voting'); } } } function JOSC_editPostResponse() { if (JOSC_ajaxReady()) { if (JOSC_http.responseText.indexOf('invalid') == -1) { var form = document.joomlacommentform; var element = document.getElementById('Comments'); var xmlDocument = JOSC_getXmlResponse(true); /*JOSC_http.responseXML;*/ if (!xmlDocument) { return 0; } var id = JOSC_xmlValue(xmlDocument, 'id'); var captcha = JOSC_xmlValue(xmlDocument, 'captcha'); if (captcha) { JOSC_refreshCaptcha(captcha); if (id == 'captchaalert') { alert(_JOOMLACOMMENT_FORMVALIDATE_CAPTCHA_FAILED); return 0; } if (id == 'captcha') { return 0; } } anchor = 'josc' + id; var idsave = id; id = 'post' + id; var body = JOSC_xmlValue(xmlDocument, 'body'); var post = document.getElementById(id); var after = JOSC_xmlValue(xmlDocument, 'after'); JOSC_clearInputbox(); var noerror = JOSC_xmlValue(xmlDocument, 'noerror'); if (noerror==0) { alert(_JOOMLACOMMENT_REQUEST_ERROR); form.tcomment.value=JOSC_http.responseText; return 0; } var published = JOSC_xmlValue(xmlDocument, 'published'); if (published==0) { alert(_JOOMLACOMMENT_BEFORE_APPROVAL); form.tcomment.value=""; if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_approval'); return 0; } if (post) { var className = JOSC_getPostClass(post); var indent = post.style.paddingLeft; JOSC_insertAdjacentHTML(post, 'beforeBegin', body); JOSC_removePost(post); newPost = document.getElementById(id); JOSC_setPostClass(newPost, className); newPost.style.paddingLeft = indent; JOSC_modifyForm(_JOOMLACOMMENT_WRITECOMMENT, _JOOMLACOMMENT_SENDFORM, function(event) { JOSC_editPost(-1, -1); }); form.tname.value = JOSC_userName; if (document.getElementsByName('temail')[0]) form.temail.value = JOSC_userEmail; if (document.getElementsByName('website')[0]) form.website.value = JOSC_userWebsite; if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_editpost'); } else { if (!after || after == -1) if (JOSC_sortDownward != 0) { if (JOSC_postREFRESH) JOSC_refreshPage(_JOOMLACOMMENT_MSG_NEEDREFRESH, idsave); else JOSC_insertAdjacentHTML(element, 'afterBegin', body); } else { if (JOSC_postREFRESH) JOSC_refreshPage(_JOOMLACOMMENT_MSG_NEEDREFRESH, idsave); else JOSC_insertAdjacentHTML(element, 'beforeEnd', body); } else { if (document.getElementById('post' + after)) JOSC_insertAdjacentHTML(document.getElementById('post' + after), 'afterEnd', body); else /* pagination or post has been deleted or new one from another users...=> refresh */ JOSC_refreshPage(_JOOMLACOMMENT_MSG_NEEDREFRESH, idsave); } JOSC_setPostClass(document.getElementById(id), 'sectiontableentry' + JOSC_postCSS); JOSC_postCSS == 1 ? JOSC_postCSS = 2 : JOSC_postCSS = 1; if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_posted'); } JOSC_goToAnchor(anchor); //JOSC_refreshPage('', idsave); } } } function JOSC_getCommentsResponse() { //JOSC_ShowHide('', 'joscPageNavLink', 'joscPageNavNoLink'); if (JOSC_ajaxReady()) { if (JOSC_http.responseText.indexOf('invalid') == -1) { JOSC_resetFormPos(); /* if reply... */ var element = document.getElementById('Comments'); var elementPN = document.getElementById('joscPageNav'); var xmlDocument = JOSC_getXmlResponse(true); /*JOSC_http.responseXML;*/ if (!xmlDocument) { return 0; } element.innerHTML=''; elementPN.innerHTML=''; var body = JOSC_xmlValue(xmlDocument, 'body'); var pagenav = JOSC_xmlValue(xmlDocument, 'pagenav'); if (JOSC_sortDownward != 0) JOSC_insertAdjacentHTML(element, 'afterBegin', body); else { JOSC_insertAdjacentHTML(element, 'beforeEnd', body); } JOSC_insertAdjacentHTML(elementPN, 'afterBegin', pagenav); if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_getcomments'); } } } function JOSC_searchFormResponse() { if (JOSC_ajaxReady()) { form = JOSC_http.responseText; if (form != '') { JOSC_insertAdjacentHTML(document.getElementById('CommentMenu'), 'afterEnd', form); if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_searchform'); } } } function JOSC_searchResponse() { if (JOSC_ajaxReady()) { form = JOSC_http.responseText; if (form != '') { JOSC_insertAdjacentHTML(document.joomlacommentsearch, 'afterEnd', form); if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_search'); } } } /* * END of response functions */ /* * Template functions */ //function JOSC_goToPost(contentid, id) //{ // var form = document.joomlacommentform; // if (form.content_id.value==contentid) JOSC_goToAnchor('josc'+id); /* not correct in case of pagination. use JOSC_viewPost */ // else window.location = 'index.php?option=' + form.component + '&task=view&id=' + contentid + '#josc' + id; // if (JOSC_operaBrowser) window.location = '##'; //} // //function JOSC_viewPost(contentid, id, itemid) //{ // var form = document.joomlacommentform; // window.location = 'index.php?option=' + form.component + '&task=view&id=' + contentid + (itemid ? ('&Itemid='+itemid) : '') + '&comment_id=' + id + '#josc' + id; // if (navigator.userAgent.toLowerCase().indexOf("opera") != -1) window.location = '##'; //} function JOSC_reply(id) { var form = document.joomlacommentform; var post = document.getElementById('post' + id); var postPadding = post.style.paddingLeft.replace('px','')*1; form.style.paddingLeft = ( postPadding + 20 ) + 'px'; JOSC_modifyForm(_JOOMLACOMMENT_WRITECOMMENT, _JOOMLACOMMENT_SENDFORM, function(event) { JOSC_editPost(-1, id); }); JOSC_insertAdjacentElement(post, 'afterEnd', form); if (self.JOSC_afterAjaxResponse) JOSC_afterAjaxResponse('response_reply'); } function JOSC_resetFormPos() { var form = document.joomlacommentform; var formpos = document.getElementById('JOSC_formpos'); if (form.parentNode.id != 'comment' || (formpos && form.parentNode.id != 'JOSC_formpos')) { form.style.paddingLeft = '0px'; form.bsend.onclick = function(event) { JOSC_editPost(-1, -1); }; if (!formpos) { JOSC_insertAdjacentElement(document.getElementById('Comments'), 'afterEnd', form); } else { JOSC_insertAdjacentElement(formpos, 'afterEnd', form); } } } function JOSC_insertUBBTag(tag) { JOSC_insertTags('[' + tag + ']', '[/' + tag + ']'); } function JOSC_fontColor(){ var color = document.joomlacommentform.menuColor.selectedIndex; switch (color){ case 0: color=''; break; case 1: color='aqua'; break; case 2: color='black'; break; case 3: color='blue'; break; case 4: color='fuchsia'; break; case 5: color='gray'; break; case 6: color='green'; break; case 7: color='lime'; break; case 8: color='maroon'; break; case 9: color='navy'; break; case 10: color='olive'; break; case 11: color='purple'; break; case 12: color='red'; break; case 13: color='silver'; break; case 14: color='teal'; break; case 15: color='white'; break; case 16: color='yellow'; break; } if (color!='') JOSC_insertTags('[color='+color+']','[/color]'); } function JOSC_fontSize() { var size = document.joomlacommentform.menuSize.selectedIndex; switch (size) { case 0: size = ''; break; case 1: size = 'x-small'; break; case 2: size = 'small'; break; case 3: size = 'medium'; break; case 4: size = 'large'; break; case 5: size = 'x-large'; break; } if (size != '') JOSC_insertTags('[size=' + size + ']', '[/size]'); } function JOSC_emoticon(icon) { var txtarea = document.joomlacommentform.tcomment; JOSC_scrollToCursor(txtarea, 0); txtarea.focus(); JOSC_pasteAtCursor(txtarea, ' ' + icon + ' '); JOSC_scrollToCursor(txtarea, 1); } /* * END of template function */ /* * ALL OTHERS UTILS FUNCTION */ function JOSC_insertTags(bbStart, bbEnd) { var txtarea = document.joomlacommentform.tcomment; JOSC_scrollToCursor(txtarea, 0); txtarea.focus(); if ((JOSC_clientVer >= 4) && JOSC_is_ie && JOSC_is_win) { theSelection = document.selection.createRange().text; if (theSelection) { document.selection.createRange().text = bbStart + theSelection + bbEnd; theSelection = ''; return; } else { JOSC_pasteAtCursor(txtarea, bbStart + bbEnd); } } else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0)) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + bbStart + s2 + bbEnd + s3; txtarea.selectionStart = selStart + (bbStart.length + s2.length + bbEnd.length); txtarea.selectionEnd = txtarea.selectionStart; JOSC_scrollToCursor(txtarea, 1); return; } else { JOSC_pasteAtCursor(txtarea, bbStart + bbEnd); JOSC_scrollToCursor(txtarea, 1); } } function JOSC_scrollToCursor(txtarea, action) { if (JOSC_is_nav) { if (action == 0) { JOSC_scrollTopPos = txtarea.scrollTop; JOSC_scrollLeftPos = txtarea.scrollLeft; } else { txtarea.scrollTop = JOSC_scrollTopPos; txtarea.scrollLeft = JOSC_scrollLeftPos; } } } function JOSC_pasteAtCursor(txtarea, txtvalue) { if (document.selection) { var sluss; txtarea.focus(); sel = document.selection.createRange(); sluss = sel.text.length; sel.text = txtvalue; if (txtvalue.length > 0) { sel.moveStart('character', -txtvalue.length + sluss); } } else if (txtarea.selectionStart || txtarea.selectionStart == '0') { var startPos = txtarea.selectionStart; var endPos = txtarea.selectionEnd; txtarea.value = txtarea.value.substring(0, startPos) + txtvalue + txtarea.value.substring(endPos, txtarea.value.length); txtarea.selectionStart = startPos + txtvalue.length; txtarea.selectionEnd = startPos + txtvalue.length; } else { txtarea.value += txtvalue; } } function JOSC_clearInputbox() { var form = document.joomlacommentform; form.ttitle.value = ''; form.tcomment.value = ''; } function JOSC_getPostClass(post) { return post.getElementsByTagName('ul')[0].getElementsByTagName('li')[0].className; } function JOSC_setPostClass(post, value) { post.getElementsByTagName('ul')[0].getElementsByTagName('li')[0].className = value; } function JOSC_refreshCaptcha(captcha) { document.getElementById('captcha').innerHTML = captcha; document.joomlacommentform.security_try.value = ''; } function JOSC_removeSearchResults() { var searchResults = document.getElementById('SearchResults'); if (searchResults) searchResults.parentNode.removeChild(searchResults); } function JOSC_addNew() { JOSC_resetFormPos(); JOSC_goToAnchor('CommentForm'); } function JOSC_ShowHide(emptyvalue, showId, hideId) { if (showId && showId!=emptyvalue) { document.getElementById(showId).style.visibility='visible'; document.getElementById(showId).style.display = ''; } if (hideId && hideId!=emptyvalue) { document.getElementById(hideId).style.visibility = 'hidden'; document.getElementById(hideId).style.display = 'none'; } return(showId); } function JOSC_toogle(ElementId) { if (ElementId) { if (document.getElementById(ElementId).style.visibility=='hidden') { document.getElementById(ElementId).style.visibility='visible'; document.getElementById(ElementId).style.display = ''; } else { document.getElementById(ElementId).style.visibility = 'hidden'; document.getElementById(ElementId).style.display = 'none'; } } } /* * return 0 if nothing done * return 1 if hidden->visible * return 2 if visible->hidden */ function JOSC_toogleR(ElementId) { if (ElementId) { if (document.getElementById(ElementId).style.visibility=='hidden') { document.getElementById(ElementId).style.visibility='visible'; document.getElementById(ElementId).style.display = ''; return 1; } else { document.getElementById(ElementId).style.visibility = 'hidden'; document.getElementById(ElementId).style.display = 'none'; return 2; } } else return 0; } /** * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ * * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * */ if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="";_19+="";var _1d=this.getParams();for(var key in _1d){_19+="";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="";}_19+="";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.majorfv.major){return true;}if(this.minorfv.minor){return true;}if(this.rev=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;