function registerAnyNs(a,b){if(!b){b=window}var c=a.split(".");if(typeof(b[c[0]])=="undefined"){b[c[0]]={}}if(a.indexOf(".")!=-1){registerAnyNs(a.substr(a.indexOf(".")+1),b[c[0]])}}function requireAnyNs(b,d){if(!d){d=window}var e=b.split(".");var c=d;for(var a=0;a<e.length;a++){if(typeof(c[e[a]])=="undefined"){throw"The required namespace '"+b+"' is not available."}c=c[e[a]]}}registerAnyNs("anyLib");anyLib={domLoaded:false,windowLoaded:false};document.on("dom:loaded",function(){anyLib.domLoaded=true});Event.on(window,"load",function(){anyLib.windowLoaded=true});registerAnyNs("anyLib");anyLib.Event={};anyLib.Event.getMousePosition=function(a){return{top:(window.event)?a.pageY:a.clientY,left:(window.event)?a.pageX:a.clientX}};anyLib.Event.getPosition=function(a){if(typeof(a.touches)!="undefined"){if(a.touches.length>0){return anyLib.Touch.Event.getTouchPosition(a)}}return anyLib.Event.getMousePosition(a)};anyLib.Event.getMouseScrollEvent=function(){if(Prototype.Browser.Gecko){return"DOMMouseScroll"}return"mousewheel"};anyLib.Event.getMouseScrollDelta=function(a){var b=0;if(Prototype.Browser.IE||Prototype.Browser.Opera||Prototype.Browser.WebKit){b=a.wheelDelta/120;return b}if(a.detail){b=-a.detail/2;return b}return b};anyLib.Event.getMouseScrollDirection=function(a){if(anyLib.Event.getMouseScrollDelta(a)>0){return"up"}else{return"down"}};anyLib.Event.onHashChange=(function(){var a=null;return{getInstance:function(){if(a==null){a=new anyLib.Event.Collection();if(typeof(window.hashchange)=="undefined"){var b=window.location.hash;setInterval(function(){var c=window.location.hash;if(b==c){return}b=c;a.fire(c)},100)}else{Event.on(window,"hashchange",function(c){a.fire(window.location.hash)})}}return a}}})();registerAnyNs("anyLib");anyLib.StringBuilder=Class.create({initialize:function(){this.setString("")},getString:function(){if(typeof(this._string)=="undefined"){this.setString(null)}return this._string},setString:function(a){this._string=a;return this},append:function(a){this.setString(this.getString()+a);return this},prepend:function(a){this.setString(a+this.getString());return this},toString:function(){return this.getString()}});registerAnyNs("anyLib");anyLib.Exception=Class.create({initialize:function(a,b){this.setObject((a)?a:null);this.setMessage((b)?b:"Exception thrown")},getMessage:function(){if(typeof(this._message)=="undefined"){this.setMessage(null)}return this._message},setMessage:function(a){this._message=a},getObject:function(){if(typeof(this._object)=="undefined"){this.setObject(null)}return this._object},setObject:function(a){this._object=a},getStack:function(){if(typeof(this._stack)=="undefined"){this.setStack(null)}return this._stack},setStack:function(a){this._stack=a},getType:function(){return"Exception"},toString:function(){return this.getType()+": "+this.getMessage()}});registerAnyNs("anyLib.Exception");anyLib.Exception.NullReference=Class.create(anyLib.Exception,{getType:function(){return"NullReferenceException"},initialize:function(a,b){this.setObject((a)?a:null);this.setMessage((b)?b:"Object reference not set to an instance of an object")}});registerAnyNs("anyLib.Exception");anyLib.Exception.NotImplemented=Class.create(anyLib.Exception,{getType:function(){return"NotImplementedException"},initialize:function(a,b){this.setObject((a)?a:null);this.setMessage((b)?b:"Method not implemented")}});registerAnyNs("anyLib.Exception");anyLib.Exception.ArgumentException=Class.create(anyLib.Exception,{getType:function(){return"ArgumentException"},initialize:function(a,b){this.setObject((a)?a:null);this.setMessage((b)?b:"The argument is invalid")}});registerAnyNs("anyLib.Collection");anyLib.Collection.List=Class.create({initialize:function(){this._stack=[]},clear:function(){this._stack.clear();return this},add:function(a){this._stack.push(a);return this.getCount()-1},remove:function(b){if(!this.hasValue(b)){var a=new anyLib.Exception.ArgumentException(b,"The object does not exist");a.setStack(["anyLib.Collection.List#initialize","anyLib.Collection.List#remove(obj)","anyLib.Collection.List#hasValue(obj)"]);throw a}this.removeKey(this._stack.indexOf(b));return this},removeKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.List#initialize","anyLib.Collection.List#removeKey(key)","anyLib.Collection.List#hasKey(key)"]);throw a}this._stack.splice(b,1);return this},hasValue:function(a){return(this._stack.indexOf(a)!=-1)},hasKey:function(a){return(typeof(this._stack[a])!="undefined")},getValue:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.List#initialize","anyLib.Collection.List#getValue(key)","anyLib.Collection.List#hasKey(key)"]);throw a}return this._stack[b]},getKey:function(b){if(!this.hasValue(b)){var a=new anyLib.Exception.ArgumentException(b,"The object does not exist");a.setStack(["anyLib.Collection.List#initialize","anyLib.Collection.List#getKey(obj)","anyLib.Collection.List#hasValue(obj)"]);throw a}return this._stack.indexOf(b)},getAll:function(){return this._stack},isFirst:function(a){return(a.toString()==this._stack.first().toString())},isLast:function(a){return(a.toString()==this._stack.last().toString())},getCount:function(){return this._stack.length}});registerAnyNs("anyLib.Collection");anyLib.Collection.KeyValue=Class.create({initialize:function(){this._stack={}},clear:function(){delete this._stack;this._stack={};return this},add:function(b,c){if(this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#add(key, obj)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}this._stack[b]=c;return this},remove:function(b){if(!this.hasValue(b)){var a=new anyLib.Exception.ArgumentException(b,"The object does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#remove(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw a}this.removeKey(this.getKey(b));return this},removeKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#removeKey(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}delete (this._stack[b]);return this},set:function(a,b){if(this.hasKey(a)){this._stack[a]=b;return this}this.add(a,b);return this},get:function(a){return this.getValue(a)},getAll:function(){return this._stack},getCount:function(){return Object.keys(this._stack).length},getValue:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getValue(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}return this._stack[b]},getKey:function(d){if(!this.hasValue(d)){var b=new anyLib.Exception.ArgumentException(d,"The object does not exist");b.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getKey(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw b}var a=Object.values(this._stack);var c=Object.keys(this._stack);return c[a.indexOf(d)]},hasValue:function(b){var a=Object.values(this._stack);return(a.indexOf(b)!=-1)},hasKey:function(a){return this._stack.hasOwnProperty(a)},isFirst:function(b){if(!this.hasValue(b)){var a=new anyLib.Exception.ArgumentException(b,"The object does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#isFirst(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw a}return(b===this.getFirst())},isFirstKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#isFirstKey(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}return(b===this.getFirstKey())},isLast:function(b){if(!this.hasValue(b)){var a=new anyLib.Exception.ArgumentException(b,"The object does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#isLast(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw a}return(b===this.getLast())},isLastKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#isLastKey(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}return(b===this.getLastKey())},getFirst:function(){return this.getValue(this.getFirstKey())},getFirstKey:function(){var a=Object.keys(this._stack);return a[0]},getLast:function(){return this.getValue(this.getLastKey())},getLastKey:function(){var a=Object.keys(this._stack);return a[a.length-1]},getPrev:function(c){if(!this.hasValue(c)){var b=new anyLib.Exception.ArgumentException(c,"The object does not exist");b.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getPrev(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw b}if(this.isFirst(c)){var b=new anyLib.Exception.ArgumentException(c,"The object is the first one");b.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getPrev(obj)","anyLib.Collection.KeyValue#hasValue(obj)","anyLib.Collection.KeyValue#isFirst(obj)"]);throw b}var a=Object.values(this._stack);return a[a.indexOf(c)-1]},getPrevKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getPrevKey(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}if(this.isFirstKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key is the first one");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getPrevKey(key)","anyLib.Collection.KeyValue#hasKey(key)","anyLib.Collection.KeyValue#isFirstKey(key)"]);throw a}var c=Object.keys(this._stack);return c[c.indexOf(b)-1]},getNext:function(c){if(!this.hasValue(c)){var b=new anyLib.Exception.ArgumentException(c,"The object does not exist");b.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getNext(obj)","anyLib.Collection.KeyValue#hasValue(obj)"]);throw b}if(this.isLast(c)){var b=new anyLib.Exception.ArgumentException(c,"The object is the last one");b.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getNext(obj)","anyLib.Collection.KeyValue#hasValue(obj)","anyLib.Collection.KeyValue#isLast(obj)"]);throw b}var a=Object.values(this._stack);return a[a.indexOf(c)+1]},getNextKey:function(b){if(!this.hasKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key does not exist");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getNextKey(key)","anyLib.Collection.KeyValue#hasKey(key)"]);throw a}if(this.isLastKey(b)){var a=new anyLib.Exception.ArgumentException(b,"The key is the last one");a.setStack(["anyLib.Collection.KeyValue#initialize","anyLib.Collection.KeyValue#getNextKey(key)","anyLib.Collection.KeyValue#hasKey(key)","anyLib.Collection.KeyValue#isLastKey(key)"]);throw a}var c=Object.keys(this._stack);return c[c.indexOf(b)+1]}});registerAnyNs("anyLib");anyLib.Url=Class.create({initialize:function(a){if(a){this._setUrl(a)}},_getUrl:function(){if(typeof(this._url)=="undefined"){this._setUrl("")}return this._url},_setUrl:function(a){this._url=a;delete (this._hash);delete (this._host);delete (this._path);delete (this._port);delete (this._protocol);delete (this._queryString);delete (this._rawQueryString);delete (this._tld);return this},getPath:function(){if(typeof(this._path)=="undefined"){var a=this._getUrl();if(a.indexOf("://")!=-1){a=a.substr(a.indexOf("://")+3)}if(a.indexOf("?")!=-1){a=a.substr(0,a.indexOf("?"))}if(a.indexOf("#")!=-1){a=a.substr(0,a.indexOf("#"))}if(a.indexOf("/")==-1){a="/"}else{a=a.substr(a.indexOf("/"))}this.setPath(new anyLib.Url.Path(a))}return this._path},setPath:function(a){if(Object.isString(a)){a=new anyLib.Url.Path(a)}this._path=a;return this},getHash:function(){if(typeof(this._hash)=="undefined"){if(this._getUrl().indexOf("#")==-1){this.setHash("")}else{this.setHash(this._getUrl().substr(this._getUrl().indexOf("#")))}}return this._hash},setHash:function(a){this._hash=a;return this},getRawQueryString:function(){if(typeof(this._rawQueryString)=="undefined"){if(this._getUrl().indexOf("?")==-1){this._setRawQueryString("")}else{if(this._getUrl().indexOf("#")==-1){this._setRawQueryString(this._getUrl().substr(this._getUrl().indexOf("?")))}else{this._setRawQueryString(this._getUrl().substr(this._getUrl().indexOf("?"),this._getUrl().indexOf("#")-this._getUrl().indexOf("?")))}}}return this._rawQueryString},_setRawQueryString:function(a){this._rawQueryString=a;delete (this._queryString);return this},getQueryString:function(){if(typeof(this._queryString)=="undefined"){this.setQueryString(new anyLib.Url.QueryString(this.getRawQueryString()))}return this._queryString},setQueryString:function(a){if(Object.isString(a)){a=new anyLib.Url.QueryString(a)}this._queryString=a;return this},getPort:function(){if(typeof(this._port)=="undefined"){var b=this._getUrl();var a=80;if(b.indexOf("://")!=-1){b=b.substr(b.indexOf("://")+3)}if(b.indexOf("/")!=-1){b=b.substr(0,b.indexOf("/"))}if(b.indexOf(":")!=-1){a=parseInt(b.substr(b.indexOf(":")+1))}this.setPort(a)}return this._port},setPort:function(a){this._port=a;return this},getProtocol:function(){if(typeof(this._protocol)=="undefined"){if(this._getUrl().indexOf("://")==-1){this.setProtocol("http")}else{this.setProtocol(this._getUrl().substr(0,this._getUrl().indexOf("://")))}}return this._protocol},setProtocol:function(a){this._protocol=a;return this},getHost:function(){if(typeof(this._host)=="undefined"){var a=this._getUrl();if(a.indexOf("://")!=-1){a=a.substr(a.indexOf("://")+3)}if(a.indexOf(":")!=-1){a=a.substr(0,a.indexOf(":"))}if(a.indexOf("/")!=-1){a=a.substr(0,a.indexOf("/"))}this.setHost(a)}return this._host},setHost:function(a){this._host=a},getTopLevelDomain:function(){if(typeof(this._tld)=="undefined"){var a=this.getHost();if(a.indexOf(".")==-1){a=""}else{parts=a.split(".");if(parts.length==2&&parts[0]=="www"){a=""}a=parts[parts.length-1]}this.setTopLevelDomain(a)}return this._tld},setTopLevelDomain:function(a){this._tld=a},getParsed:function(b){var c=this.getQueryString().toQueryString();if(c!=""){c="?"+c}if(!b){return this.getProtocol()+"://"+this.getHost()+this.getPath().getFullPath()+c}var a={host:this.getHost(),port:this.getPort(),hash:this.getHash(),queryString:c,rawQueryString:c,protocol:this.getProtocol(),tld:this.getTopLevelDomain(),path:this.getPath().getFullPath()};return b.evaluate(a)}});anyLib.Url.getCurrent=function(){return new anyLib.Url(window.location.toString())};registerAnyNs("anyLib.Url");anyLib.Url.Path=Class.create({initialize:function(a){this._setPath(new anyLib.Collection.List());if(!a){a="/"}this._setRawPath(a)},getPath:function(){if(typeof(this._path)=="undefined"){this._setPath(null)}return this._path},_setPath:function(a){this._path=a;return this},getRawPath:function(){if(typeof(this._rawPath)=="undefined"){this._setRawPath("/")}return this._rawPath},_setRawPath:function(c){this.getPath().clear();if(c.substr(c.length-1)=="?"){c=c.substr(0,c.length-1)}if(c.length=="/"){c="/"}var b=c.substr(1).split("/");for(var a=0;a<b.length;a++){this.getPath().add("/"+b[a])}this._rawPath=this.getFullPath();return this},getFullPath:function(){return this.getPath().getAll().join("")},getToLevel:function(d){if(d>this.getPath().getCount()){var c=new anyLib.Exception.ArgumentException(d,"The requested level is not available");c.setStack(["anyLib.Url.Path#initialize","anyLib.Url.Path#setPath(path)","anyLib.Url.Path#getToLevel(level)"]);throw c}if(d==0){var c=new anyLib.Exception.ArgumentException(d,"The level must be greater than zero");c.setStack(["anyLib.Url.Path#initialize","anyLib.Url.Path#setPath(path)","anyLib.Url.Path#getToLevel(level)"]);throw c}var a="";for(var b=0;b<d;b++){a=a+this.getPath().getValue(b)}return a}});registerAnyNs("anyLib.Url");anyLib.Url.QueryString=Class.create({initialize:function(a){this._setItems(new anyLib.Collection.KeyValue());if(a){this._parseRaw(a)}},getItems:function(){if(typeof(this._items)=="undefined"){this.setItems(null)}return this._items},_setItems:function(a){this._items=a;return this},addItem:function(a,b){this.getItems().set(a,b);return this},_clear:function(){this.getItems().clear();return this},_parseRaw:function(a){this._clear();if(a==""){return}if(a.substr(0,1)=="?"){a=a.substr(1)}var b=a.toQueryParams();for(index in b){if(b[index]=="undefined"){b[index]=""}this.addItem(index,b[index])}return this},toQueryString:function(){return Object.toQueryString(this.getItems().getAll())}});registerAnyNs("anyLib.Url");anyLib.Url.DeepLink=Class.create({initialize:function(c,a,d){if(!c){var b=new anyLib.Exception.ArgumentException(null,"The element parameter has not been supplied.");b.setStack(["anyLib.Url.DeepLink#initialize"]);throw b}this.setElement(c);if(!a){a=c.href}if(!d){d="document"}this.setUrl(a);this.setType(d)},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){this._element=a;return this},getType:function(){if(typeof(this._type)=="undefined"){this.setType(null)}return this._type},setType:function(a){this._type=a;return this},getUrl:function(){if(typeof(this._url)=="undefined"){this._setUrl(null)}return this._url},setUrl:function(a){if(Object.isString(a)){a=new anyLib.Url(a)}this._url=a;return this}});registerAnyNs("anyLib");anyLib.DeepLinking=Class.create({initialize:function(a){this.onLinkTriggered=new anyLib.Event.Collection();if(!a){a=$$("body")[0]}this.setElement(a)},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){this._element=a;return this},getFilters:function(){if(typeof(this._filters)=="undefined"){this.setFilters(new anyLib.Collection.List())}return this._filters},setFilters:function(a){this._filters=a;return this},addFilter:function(a){this.getFilters().add(a);return this},clearFilter:function(){this.getFilters().clear();return this},getCurrent:function(){if(typeof(this._current)=="undefined"){this.setCurrent(null)}return this._current},setCurrent:function(a){this._current=a;return this},_getTriggerEvent:function(){return"click"},updateLink:function(a){var b=new anyLib.Url.DeepLink(a);b.getUrl().setHash(b.getUrl().getPath().getFullPath());a.href="#"+b.getUrl().getHash();a.on(this._getTriggerEvent(),function(){if(this.getCurrent()==b){return}this.setCurrent(b);this.onLinkTriggered.fire(b)}.bind(this));return this},updateLinks:function(){this.getElement().select("a").each(function(a){if(a.href==""){return}var b=true;this.getFilters().getAll().each(function(c){if(!c.isAllowed(a)){b=false}}.bind(this));if(!b){return}this.updateLink(a)}.bind(this));return this}});registerAnyNs("anyLib.DeepLinking");anyLib.DeepLinking.Filter=Class.create({isAllowed:function(b){var a=new anyLib.Exception.NotImplemented(this);a.setStack(["anyLib.DeepLinking.Filter#initialize","anyLib.DeepLinking.Filter#isAllowed(element)"]);throw a}});registerAnyNs("anyLib.DeepLinking.Filter");anyLib.DeepLinking.Filter.Contains=Class.create(anyLib.DeepLinking.Filter,{initialize:function(a){this.setSearchString(a)},getSearchString:function(){if(typeof(this._searchString)=="undefined"){this.setSearchString(null)}return this._searchString},setSearchString:function(a){this._searchString=a;return this},isAllowed:function(a){return(a.href.indexOf(this.getSearchString())==-1)}});registerAnyNs("anyLib.DeepLinking.Filter");anyLib.DeepLinking.Filter.ClassName=Class.create(anyLib.DeepLinking.Filter,{initialize:function(a){this.setClassName(a)},getClassName:function(){if(typeof(this._className)=="undefined"){this.setClassName(null)}return this._className},setClassName:function(a){this._className=a;return this},isAllowed:function(a){return !(a.hasClassName(this.getClassName()))}});registerAnyNs("anyLib.Event");anyLib.Event.Collection=Class.create(anyLib.Collection.List,{fire:function(a){if(this.getCount()==0){return}this.getAll().each(function(b){b(a)},this);return this}});registerAnyNs("anyLib.Event");anyLib.Event.Handle={};registerAnyNs("anyLib.Event.Handle");anyLib.Event.Handle.Collection=Class.create(anyLib.Collection.KeyValue,{stopAll:function(){if(this.getCount()==0){return}Object.values(this.getAll()).each(function(a){a.stop()})},startAll:function(){if(this.getCount()==0){return}Object.values(this.getAll()).each(function(a){a.start()})}});registerAnyNs("anyLib");anyLib.Counter=Class.create({initialize:function(a){this.afterCount=new anyLib.Event.Collection();this.beforeCount=new anyLib.Event.Collection();this.onLimitReached=new anyLib.Event.Collection();if(a){this.setLimit(a)}this.reset()},getLimit:function(){if(typeof(this._limit)=="undefined"){this.setLimit(null)}return this._limit},setLimit:function(a){if(a==0){var b=new anyLib.Exception.ArgumentException(this,"The limit must be greater than zero");b.setStack(["anyLib.Counter#initialize","anyLib.Counter#setLimit(limit)"]);throw b}this._limit=a;return this},getCount:function(){if(typeof(this._count)=="undefined"){this.setCount(null)}return this._count},setCount:function(a){this._count=a;return this},count:function(){if(this.getLimit()==null){var a=new anyLib.Exception.NullReference(this,"The limit must be defined before counting.");a.setStack(["anyLib.Counter#initialize","anyLib.Counter#count()"]);throw a}this.beforeCount.fire(this);this.setCount(parseInt(this.getCount())+1);this.afterCount.fire(this);if(this.getCount()==this.getLimit()){this.onLimitReached.fire(this)}return this},reset:function(){this.setCount(0);return this}});registerAnyNs("anyLib");anyLib.MVC={};registerAnyNs("anyLib.MVC");anyLib.MVC.Controller={};registerAnyNs("anyLib.MVC");anyLib.MVC.Request=Class.create({initialize:function(){},getUrl:function(){if(typeof(this._url)=="undefined"){this.setUrl(null)}return this._url},setUrl:function(a){this._url=a;return this},getAction:function(){if(typeof(this._action)=="undefined"){this.setAction(null)}return this._action},setAction:function(a){this._action=a;return this},getController:function(){if(typeof(this._controller)=="undefined"){this.setController(null)}return this._controller},setController:function(a){this._controller=a;return this},getParameters:function(){if(typeof(this._parameters)=="undefined"){this.setParameters(new anyLib.Collection.KeyValue())}return this._parameters},setParameters:function(a){this._parameters=a;return this}});registerAnyNs("anyLib.MVC");anyLib.MVC.Response=Class.create(Ajax.Response,{});registerAnyNs("anyLib.MVC");anyLib.MVC.View=Class.create({initialize:function(){this.afterRender=new anyLib.Event.Collection();this.beforeRender=new anyLib.Event.Collection()},render:function(){this.beforeRender.fire(this);this.afterRender.fire(this)}});registerAnyNs("anyLib.MVC.Controller");anyLib.MVC.Controller.Abstract=Class.create({initialize:function(a){this.requestError=new anyLib.Event.Collection();this.requestSuccess=new anyLib.Event.Collection();this.preDispatch=new anyLib.Event.Collection();this.postDispatch=new anyLib.Event.Collection();if(a){this.setRequest(a)}this.init()},init:function(){},getRequest:function(){if(typeof(this._request)=="undefined"){this.setRequest(new anyLib.MVC.Request())}return this._request},setRequest:function(a){this._request=a;return this},getResponse:function(){if(typeof(this._response)=="undefined"){this.setResponse({})}return this._response},setResponse:function(a){this._response=a;return this},getView:function(){if(typeof(this._view)=="undefined"){this.setView(new anyLib.MVC.View())}return this._view},setView:function(a){this._view=a;return this},getRegions:function(){if(typeof(this._regions)=="undefined"){this.setRegions(new anyLib.Collection.KeyValue())}return this._regions},setRegions:function(a){this._regions=a;return this},getActionNamespace:function(){if(typeof(this._actionNamespace)=="undefined"){this.setActionNamespace(anyLib.MVC)}return this._actionNamespace},setActionNamespace:function(a){this._actionNamespace=a;return this},addRegion:function(a){this.getRegions().add(a.getIdentifier(),a);return this},getValidActionName:function(a){if(!a.endsWith("Action")){a=a+"Action"}return a},dispatch:function(b){this.preDispatch.fire(this);if(!this.getRequest().getParameters().hasKey("asynchronous")){this.getRequest().getParameters().add("asynchronous",true)}var a=new Ajax.Request(this.getRequest().getUrl(),{method:"post",parameters:this.getRequest().getParameters().getAll(),onSuccess:function(c){this.setResponse(c);this.requestSuccess.fire(this);this.postDispatch.fire(this);if(this.getRequest().getAction()!=null&&b!=this.getRequest().getAction()){b=this.getRequest().getAction()}this._callAction(b);delete (a)}.bind(this),onFailure:function(c){this.setResponse(c);this.requestError.fire(this);this.postDispatch.fire(this);delete (a)}.bind(this)})},_callAction:function(c){var a=this.getValidActionName(c);if(typeof(this[a])!="function"){var b=new anyLib.Exception.ArgumentException(c,'The action "'+a+'" does not exist');b.setStack(["anyLib.MVC.Dispatcher#initialize","anyLib.MVC.Dispatcher#dispatch(request, response)","anyLib.MVC.Controller.Abstract#initialize","anyLib.MVC.Controller.Abstract#dispatch(view)","anyLib.MVC.Controller.Abstract#_callAction(action)"]);throw b}c=c.substr(0,1).capitalize()+c.substr(1);this.setView(new (this.getActionNamespace()[c])());this[a]();this.getView().render()}});registerAnyNs("anyLib.MVC.Controller");anyLib.MVC.Controller.Action=Class.create(anyLib.MVC.Controller.Abstract,{indexAction:function(){}});registerAnyNs("anyLib.MVC.Controller");anyLib.MVC.Controller.Dispatcher=Class.create({initialize:function(){},getResponse:function(){if(typeof(this._response)=="undefined"){this.setResponse(new anyLib.MVC.Response)}return this._response},setResponse:function(a){this._response=a;return this},getDefaultController:function(){if(typeof(this._defaultController)=="undefined"){this.setDefaultController(new anyLib.MVC.Controller.Action())}return this._defaultController},setDefaultController:function(a){this._defaultController=a;return this},getDefaultAction:function(){if(typeof(this._defaultAction)=="undefined"){this.setDefaultAction("index")}return this._defaultAction},setDefaultAction:function(a){this._defaultAction=a;return this},dispatch:function(b){var a=b.getController();if(a==null){a=this.getDefaultController()}a.setRequest(b);var c=b.getAction();if(c==null){c=this.getDefaultAction()}a.dispatch(c);return this}});registerAnyNs("anyLib.MVC.View");anyLib.MVC.View.Region=Class.create({initialize:function(a){if(!a){var b=new anyLib.Exception.NullReference(this,"No identifier supplied.");b.setStack(["anyLib.MVC.Dispatcher#initialize","anyLib.MVC.Dispatcher#dispatch(request, response)","anyLib.MVC.Controller.Abstract#initialize","anyLib.MVC.Controller.Abstract#dispatch(view)","anyLib.MVC.Controller.Abstract#_callAction(action)","anyLib.MVC.View.Region#initialize"]);throw b}this.setIdentifier(a);if($(a)){this.setElement($(a))}},getIdentifier:function(){if(typeof(this._identifier)=="undefined"){this.setIdentifier(null)}return this._identifier},setIdentifier:function(a){this._identifier=a;return this},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){this._element=a;return this},getContent:function(){if(typeof(this._content)=="undefined"){this.setContent(null)}return this._content},setContent:function(a){this._content=a;return this},getCurrentContent:function(){if(typeof(this._currentContent)=="undefined"){this.setCurrentContent(null)}return this._currentContent},setCurrentContent:function(a){this._currentContent=a;return this},parseHTML:function(a){var b=a.down("#"+this.getIdentifier());if(typeof(b.down(0))=="undefined"){this.setContent(false);return false}this.setContent(b.down(0));return true}});registerAnyNs("anyLib.Event");anyLib.Event.Trigger=Class.create({initialize:function(a,b){this.onTrigger=new anyLib.Event.Collection();if(a!=null){this.setElement(a)}if(b!=null){this.setContent(b)}},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){if(a!=null&&this.getElement()!=null){this.stopObserving()}this._element=a;if(a!=null&&this.getElement()!=null){this.observe()}return this},getContent:function(){if(typeof(this._content)=="undefined"){this.setContent(null)}return this._content},setContent:function(a){this._content=a;return this},_getEventHandle:function(){if(typeof(this._eventHandle)=="undefined"){this._setEventHandle(null)}return this._eventHandle},_setEventHandle:function(a){this._eventHandle=a;return this},_getEvent:function(){throw new anyLib.Exception.NotImplemented()},fire:function(){this.onTrigger.fire(this.getContent());return this},observe:function(){if(this.getElement()==null){throw new anyLib.Exception.NullReference(this,"No element is set for the trigger")}if(this._getEventHandle()==null){this._setEventHandle(this.getElement().on(this._getEvent(),this.fire.bindAsEventListener(this)))}else{this._getEventHandle().start()}},stopObserving:function(){if(this.getElement()==null){throw new anyLib.Exception.NullReference(this,"No element is set for the trigger")}if(this._getEventHandle()!=null){this._getEventHandle().stop()}}});registerAnyNs("anyLib.Event.Trigger");anyLib.Event.Trigger.Click=Class.create(anyLib.Event.Trigger,{_getEvent:function(){return"click"}});registerAnyNs("anyLib");anyLib.Preloader=Class.create({initialize:function(){this.onStart=new anyLib.Event.Collection();this.onComplete=new anyLib.Event.Collection();this.onEndLoadingItem=new anyLib.Event.Collection();this.onStartLoadingItem=new anyLib.Event.Collection();this.setItems(new anyLib.Collection.List());this.setItemsLoaded(new anyLib.Collection.List())},getCounter:function(){if(typeof(this._counter)=="undefined"){this.setCounter(null)}return this._counter},setCounter:function(a){this._counter=a;return this},getItems:function(){if(typeof(this._items)=="undefined"){this.setItems(null)}return this._items},setItems:function(a){this._items=a;return this},getItemsLoaded:function(){if(typeof(this._itemsLoaded)=="undefined"){this.setItemsLoaded(null)}return this._itemsLoaded},setItemsLoaded:function(a){this._itemsLoaded=a;return this},addItem:function(a){var b=false;this.getItems().getAll().each(function(c){if(c.getUrl()===a.getUrl()){b=true}});if(!b){this.getItems().add(a)}return this},start:function(){this.onStart.fire(this);if(this.getItems()==null){this.onComplete.fire(this);return this}if(this.getItems().getCount()==0){this.onComplete.fire(this);return this}this.setCounter(new anyLib.Counter(this.getItems().getCount()));this.getCounter().onLimitReached.add(function(){this.onComplete.fire(this)}.bind(this));this.getItems().getAll().each(function(a){a.onLoaded.add(function(){this.getItemsLoaded().add(a);this.onEndLoadingItem.fire(a);this.getCounter().count()}.bind(this));a.load();this.onStartLoadingItem.fire(a)}.bind(this))}});registerAnyNs("anyLib.Preloader");anyLib.Preloader.Sequenced=Class.create(anyLib.Preloader,{start:function(){this.onStart.fire(this);if(this.getItems()==null){this.onComplete.fire(this);return this}if(this.getItems().getCount()==0){this.onComplete.fire(this);return this}this.setCounter(new anyLib.Counter(this.getItems().getCount()));this.getCounter().onLimitReached.add(function(){this.onComplete.fire(this)}.bind(this));this._load(0)},getCurrentIndex:function(){if(typeof(this._currentIndex)=="undefined"){this._setCurrentIndex(null)}return this._currentIndex},_setCurrentIndex:function(a){this._currentIndex=a;return this},_load:function(a){this._setCurrentIndex(a);var b=this.getItems().getAll()[a];b.onLoaded.add(function(){this.getItemsLoaded().add(b);this.onEndLoadingItem.fire(b);this.getCounter().count();if(!this.getItems().isLast(a)&&this.getItems().hasKey(a+1)){setTimeout(function(){this._load(a+1)}.bind(this),50)}}.bind(this));b.load();this.onStartLoadingItem.fire(b);return this}});registerAnyNs("anyLib.Preloader");anyLib.Preloader.Item=Class.create({initialize:function(a){this.setUrl(a);this.onLoaded=new anyLib.Event.Collection()},getData:function(){if(typeof(this._data)=="undefined"){this.setData(null)}return this._data},setData:function(a){this._data=a;return this},_getUrl:function(){if(typeof(this._url)=="undefined"){this.setUrl(null)}return this._url},setUrl:function(a){this._url=a;return this},load:function(){throw new anyLib.Exception.NotImplemented(this).setStack(["anyLib.Preloader#initialize","anyLib.Preloader#load()"])},toString:function(){return this.getType()+": "+this.getUrl()},getType:function(){throw new anyLib.Exception.NotImplemented(this).setStack(["anyLib.Preloader#initialize","anyLib.Preloader#getType()"])}});registerAnyNs("anyLib.Preloader.Item");anyLib.Preloader.Item.Image=Class.create(anyLib.Preloader.Item,{load:function(){var a=new Image();a.onload=(function(){this.onLoaded.fire(this)}).bind(this);a.src=this.getUrl();this.setData(a)},getType:function(){return"Image"}});registerAnyNs("anyLib");anyLib.Paging=Class.create({initialize:function(){this.setContents(new anyLib.Collection.KeyValue())},getContents:function(){if(typeof(this._contents)=="undefined"){this.setContents(null)}return this._contents},setContents:function(a){this._contents=a;return this},addPage:function(a,b){this.getContents().add(a,b);if(this.getCurrent()==null){this.setCurrent(a)}return this},getCurrent:function(){if(typeof(this._current)=="undefined"){this.setCurrent(null)}return this._current},setCurrent:function(a){this._current=a;return this},next:function(){if(this.getContents().isLastKey(this.getCurrent())){return}this.setPage(this.getContents().getNextKey(this.getCurrent()))},prev:function(){if(this.getContents().isFirstKey(this.getCurrent())){return}this.setPage(this.getContents().getPrevKey(this.getCurrent()))},setPage:function(a){this.getContents().getValue(this.getCurrent()).hide();this.setCurrent(a);this.getContents().getValue(this.getCurrent()).show()}});registerAnyNs("anyLib.Paging");anyLib.Paging.Page=Class.create({initialize:function(a,b){if(a){this.setTrigger(a)}if(b){this.setElement(b)}},getTrigger:function(){if(typeof(this._trigger)=="undefined"){this.setTrigger(null)}return this._trigger},setTrigger:function(a){this._trigger=a;return this},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){this._element=a;return this},show:function(){this.getElement().show();return this},hide:function(){this.getElement().hide();return this}});registerAnyNs("anyLib.Touch");anyLib.Touch.Event={};anyLib.Touch.Event.getTouchPosition=function(a){return{top:a.touches[0].clientY,left:a.touches[0].clientX}};registerAnyNs("anyLib.Touch.Event.Handle");anyLib.Touch.Event.Handle.TouchEnd=(function(){var a=null;var b=Class.create(anyLib.Event.Handle,{_getEvent:function(){return"touchend"}});return{getInstance:function(){if(a==null){a=new b()}return a}}})();registerAnyNs("anyLib.Touch.Event.Handle");anyLib.Touch.Event.Handle.TouchMove=(function(){var a=null;var b=Class.create(anyLib.Event.Handle,{_getEvent:function(){return"touchmove"}});return{getInstance:function(){if(a==null){a=new b()}return a}}})();registerAnyNs("anyLib.Touch.Event.Handle");anyLib.Touch.Event.Handle.TouchStart=(function(){var a=null;var b=Class.create(anyLib.Event.Handle,{_getEvent:function(){return"touchstart"}});return{getInstance:function(){if(a==null){a=new b()}return a}}})();registerAnyNs("anyLib.UI");anyLib.UI.Lightbox=Class.create({initialize:function(){this.beforeNext=new anyLib.Event.Collection();this.beforePrev=new anyLib.Event.Collection();this.beforeOpen=new anyLib.Event.Collection();this.beforeClose=new anyLib.Event.Collection();this.beforeChange=new anyLib.Event.Collection();this.onOpen=new anyLib.Event.Collection();this.onClose=new anyLib.Event.Collection();this.onChange=new anyLib.Event.Collection();this.afterNext=new anyLib.Event.Collection();this.afterPrev=new anyLib.Event.Collection();this.afterOpen=new anyLib.Event.Collection();this.afterClose=new anyLib.Event.Collection();this.afterChange=new anyLib.Event.Collection();this.beforeOpen.add(function(){if(this.getLayout().getContainer()==null){this.getLayout().render();this.getLayout().nextTrigger.onTrigger.add(this.next.bind(this));this.getLayout().prevTrigger.onTrigger.add(this.prev.bind(this));this.getLayout().closeTrigger.onTrigger.add(this.close.bind(this));this.getLayout().backgroundTrigger.onTrigger.add(this.close.bind(this))}this.beforeOpen.removeKey(0)}.bind(this));this.beforeOpen.add(this._scaleBackground.bind(this));this.onChange.add(this._updateControls.bind(this));this.onChange.add(this._insertContent.bind(this));this.onOpen.add(function(){this.setOpened(true)}.bind(this));this.onClose.add(function(){this.setOpened(false)}.bind(this))},getCurrent:function(){if(typeof(this._current)=="undefined"){this.setCurrent(null)}return this._current},setCurrent:function(a){this._current=a;return this},getContents:function(){if(typeof(this._contents)=="undefined"){this.setContents(new anyLib.Collection.KeyValue())}return this._contents},setContents:function(a){this._contents=a;return this},addContent:function(a){this.getContents().add(a.getKey(),a);return this},getLayout:function(){if(typeof(this._layout)=="undefined"){this.setLayout(null)}return this._layout},setLayout:function(a){this._layout=a;return this},getOpened:function(){if(typeof(this._opened)=="undefined"){this.setOpened(false)}return this._opened},setOpened:function(a){this._opened=a;return this},change:function(a){if(this.getOpened()===false){this.open(a);return}this.beforeChange.fire(this);var b=this.getContents().getValue(a);b.onLoad.add(function(){this.setCurrent(b);this.onChange.fire(this);this.afterChange.fire(this)}.bind(this));b.load()},next:function(){if(this.getContents().isLastKey(this.getCurrent().getKey())){return}this.beforeNext.fire(this);this.change(this.getContents().getNextKey(this.getCurrent().getKey()));this.afterNext.fire(this)},prev:function(){if(this.getContents().isFirstKey(this.getCurrent().getKey())){return}this.beforePrev.fire(this);this.change(this.getContents().getPrevKey(this.getCurrent().getKey()));this.afterPrev.fire(this)},open:function(b){var a=this._getContentCenter();this.getLayout().getContainer().setStyle({top:a.top+"px",left:a.left+"px"});this.beforeOpen.fire(this);this.onOpen.fire(this);this.getLayout().getBackground().show();this.getLayout().getContainer().show();this.afterOpen.fire(this);this.change(b)},close:function(){this.beforeClose.fire(this);this.onClose.fire(this);this.getLayout().getContent().innerHTML="";this.getLayout().getContainer().hide();this.getLayout().getBackground().hide();this.afterClose.fire(this)},_scaleBackground:function(){var a=this._getDimensions();this.getLayout().getBackground().setStyle({width:a.width+"px",height:a.height+"px"});return this},_getContentCenter:function(){var c=document.viewport.getDimensions();var b=document.viewport.getScrollOffsets();var a={top:Math.floor(c.height/2),left:Math.floor(c.width/2)};if(b.top>0){a.top=a.top+b.top}if(b.left>0){a.left=a.left+b.left}return a},_getDimensions:function(){throw new anyLib.Exception.NotImplemented()},_insertContent:function(){throw new anyLib.Exception.NotImplemented()},_updateControls:function(){throw new anyLib.Exception.NotImplemented()}});registerAnyNs("anyLib.UI.Lightbox");anyLib.UI.Lightbox.Layout=Class.create({initialize:function(){},getTemplate:function(){if(typeof(this._template)=="undefined"){this.setTemplate(new Template())}return this._template},setTemplate:function(a){this._template=a;return this},getContent:function(){if(typeof(this._content)=="undefined"){this.setContent(null)}return this._content},setContent:function(a){this._content=a;return this},getContainer:function(){if(typeof(this._container)=="undefined"){this.setContainer(null)}return this._container},setContainer:function(a){this._container=a;return this},getBackground:function(){if(typeof(this._background)=="undefined"){this.setBackground(null)}return this._background},setBackground:function(a){this._background=a;return this},getBackgroundId:function(){if(typeof(this._backgroundId)=="undefined"){this.setBackgroundId("any_light_box_background")}return this._backgroundId},setBackgroundId:function(a){this._backgroundId=a;return this},getContainerId:function(){if(typeof(this._containerId)=="undefined"){this.setContainerId("any_light_box_container")}return this._containerId},setContainerId:function(a){this._containerId=a;return this},getContentId:function(){if(typeof(this._contentId)=="undefined"){this.setContentId("any_light_box_content")}return this._contentId},setContentId:function(a){this._contentId=a;return this},getFoo:function(){if(typeof(this._foo)=="undefined"){this.setFoo(null)}return this._foo},setFoo:function(a){this._foo=a;return this},_registerControls:function(){this.nextTrigger=new anyLib.Event.Trigger.Click(this.getContainer().select(".any_lightbox_button_next").first(),this);this.prevTrigger=new anyLib.Event.Trigger.Click(this.getContainer().select(".any_lightbox_button_prev").first(),this);this.closeTrigger=new anyLib.Event.Trigger.Click(this.getContainer().select(".any_lightbox_button_close").first(),this);this.backgroundTrigger=new anyLib.Event.Trigger.Click(this.getBackground(),this);return this},getTemplateData:function(){return{contentId:this.getContentId(),containerId:this.getContainerId(),backgroundId:this.getBackgroundId()}},render:function(){if(this.getContainer()!=null){return this}$$("body")[0].insert({top:this.getTemplate().evaluate(this.getTemplateData())});this.setContent($(this.getContentId()));this.setContainer($(this.getContainerId()));this.setBackground($(this.getBackgroundId()));this._registerControls();return this}});registerAnyNs("anyLib.UI.Lightbox");anyLib.UI.Lightbox.Content=Class.create({getContent:function(){if(typeof(this._content)=="undefined"){this.setContent(null)}return this._content},setContent:function(a){this._content=a},getKey:function(){if(typeof(this._key)=="undefined"){this.setKey(null)}return this._key},setKey:function(a){this._key=a},getIsLoaded:function(){if(typeof(this._isLoaded)=="undefined"){this.setIsLoaded(null)}return this._isLoaded},setIsLoaded:function(a){this._isLoaded=a;return this},isLoaded:function(){return this._isLoaded},initialize:function(a,b){this.onLoad=new anyLib.Event.Collection();this.onLoad.add(function(){this.setIsLoaded(true)}.bind(this));this.setIsLoaded(false);if(a){this.setKey(a)}if(b){this.setContent(b)}},load:function(){this.onLoad.fire(this)},toString:function(){return this.getContent()}});registerAnyNs("anyLib.UI.Lightbox.Content");anyLib.UI.Lightbox.Content.Video=Class.create(anyLib.UI.Lightbox.Content,{getWidth:function(){if(typeof(this._width)=="undefined"){this.setWidth(50)}return this._width},setWidth:function(a){this._width=a;return this},getHeight:function(){if(typeof(this._height)=="undefined"){this.setHeight(50)}return this._height},setHeight:function(a){this._height=a;return this},toString:function(){var a=new anyLib.Exception.NotImplemented(this);a.setMessage("The class anyLib.UI.Lightbox.Content.Video is abstract.");throw a}});registerAnyNs("anyLib.UI.Lightbox.Content");anyLib.UI.Lightbox.Content.Image=Class.create(anyLib.UI.Lightbox.Content,{getDescription:function(){if(typeof(this._description)=="undefined"){this.setDescription(null)}return this._description},setDescription:function(a){this._description=a;return this},getDimensions:function(){if(typeof(this._dimensions)=="undefined"){this.setDimensions(null)}return this._dimensions},setDimensions:function(a){this._dimensions=a;return this},load:function(){var a=new Image();a.onload=(function(){this.setDimensions({width:a.width,height:a.height});this.onLoad.fire(this)}).bind(this);a.src=this.getContent()},toString:function(){var b=this.getDimensions();var a='<img src="'+this.getContent()+'" width="'+b.width+'" height="'+b.height+'" />';if(this.getDescription()==null){return a}return'<div class="content_image">'+a+'<div class="description">'+this.getDescription()+"</div></div>"}});registerAnyNs("anyLib.UI.Lightbox.Content.Video");anyLib.UI.Lightbox.Content.Video.Vimeo=Class.create(anyLib.UI.Lightbox.Content.Video,{toString:function(){return'<iframe src="'+this.getContent()+'" width="'+this.getWidth()+'" height="'+this.getHeight()+'" frameborder="0"></iframe>'}});registerAnyNs("anyLib.UI.Lightbox.Content.Video");anyLib.UI.Lightbox.Content.Video.YouTube=Class.create(anyLib.UI.Lightbox.Content.Video,{toString:function(){return'<object style="height: '+this.getHeight()+"px; width: "+this.getWidth()+'px"><param name="movie" value="http://www.youtube.com/v/'+this.getContent()+'?version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'+this.getContent()+'?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="'+this.getWidth()+'" height="'+this.getHeight()+'"></object>'}});registerAnyNs("anyLib.UI");requireAnyNs("anyLib.Event.Collection");anyLib.UI.Rating=Class.create({initialize:function(a,c){this.setElement($(a));var b=this.getElement().getDimensions();var d=this.getElement().cumulativeOffset();this.setElementBounds({top:d.top,left:d.left,width:b.width,height:b.height});this.setRating(0);this.setTimesRated(0);this.setRatesAllowed(1);this.setResource((c!=null)?c:new anyLib.UI.Rating.Resource.Ajax());this.afterSave=new anyLib.Event.Collection();this.beforeSave=new anyLib.Event.Collection();this.afterReset=new anyLib.Event.Collection();this.beforeReset=new anyLib.Event.Collection();this.onMouseMove=new anyLib.Event.Collection();this.getElement().on("click",this._rate.bind(this));this.getElement().on("mouseenter",this._mouseEnter.bind(this));this.getElement().on("mouseleave",this._mouseLeave.bind(this));this._setMouseMoveHandle(this.getElement().on("mousemove",this._updateByMousePosition.bind(this)));this._getMouseMoveHandle().stop()},getElement:function(){if(typeof(this._element)=="undefined"){this.setElement(null)}return this._element},setElement:function(a){this._element=a;return this},getResource:function(){if(typeof(this._resource)=="undefined"){this.setResource(null)}return this._resource},setResource:function(a){this._resource=a;return this},getRatesAllowed:function(){if(typeof(this._ratesAllowed)=="undefined"){this.setRatesAllowed(null)}return this._ratesAllowed},setRatesAllowed:function(a){this._ratesAllowed=a;return this},getTimesRated:function(){if(typeof(this._timesRated)=="undefined"){this.setTimesRated(null)}return this._timesRated},setTimesRated:function(a){this._timesRated=a;return this},getRating:function(){if(typeof(this._rating)=="undefined"){this.setRating(null)}return this._rating},setRating:function(a){this._rating=a;return this},getElementBounds:function(){if(typeof(this._elementBounds)=="undefined"){this.setElementBounds(null)}return this._elementBounds},setElementBounds:function(a){this._elementBounds=a;return this},_getMouseMoveHandle:function(){if(typeof(this._mouseMoveHandle)=="undefined"){this._setMouseMoveHandle(null)}return this._mouseMoveHandle},_setMouseMoveHandle:function(a){this._mouseMoveHandle=a;return this},_mouseEnter:function(){if(this.getTimesRated()==this.getRatesAllowed()){return}this._getMouseMoveHandle().start();return this},_mouseLeave:function(){this._getMouseMoveHandle().stop();return this},_updateByMousePosition:function(a){this.setRating(this.getMouseOffset(a));this.onMouseMove.fire(this);return this},_rate:function(a){this._getMouseMoveHandle().stop();this.rate(this.getRating());return this},reset:function(a){this.beforeReset.fire(this);this.setTimesRated(0);this.setRating((a!=null)?a:0);this.afterReset.fire(this);return this},getRelativeMousePosition:function(a){var b=anyLib.Event.getMousePosition(a);return{top:parseInt(b.top)-parseInt(this.getElementBounds().top),left:parseInt(b.left)-parseInt(this.getElementBounds().left)}},getMouseOffset:function(a){return parseFloat((parseInt(this.getRelativeMousePosition(a).left)/parseInt(this.getElementBounds().width))*100)},rate:function(a){if(this.getTimesRated()==this.getRatesAllowed()){return}this.setTimesRated(parseInt(this.getTimesRated())+1);this.setRating(a);this.beforeSave.fire(this);this.getResource().save(this);return this}});registerAnyNs("anyLib.UI.Rating");requireAnyNs("anyLib.Exception.NotImplemented");anyLib.UI.Rating.Resource=Class.create({initialize:function(){},save:function(a){throw new anyLib.Exception.NotImplemented(a).setStack(["anyLib.UI.Rating#initialize(element, resource)","anyLib.UI.Rating.Resource#initialize()","anyLib.UI.Rating#rate(percent)","anyLib.UI.Rating.Resource#save(rating)"])}});registerAnyNs("anyLib.UI.Rating.Resource");anyLib.UI.Rating.Resource.Ajax=Class.create(anyLib.UI.Rating.Resource,{initialize:function(a,b){this.setUrl(a);this.setMethod((b!=null)?b:"post")},_getUrl:function(){if(typeof(this._url)=="undefined"){this.setUrl(null)}return this._url},setUrl:function(a){this._url=a;return this},getMethod:function(){if(typeof(this._method)=="undefined"){this.setMethod(null)}return this._method},setMethod:function(a){this._method=a;return this},save:function(a){new Ajax.Request(this.getUrl(),{method:this.getMethod(),parameters:{rating:a.getRating()},onSuccess:function(){a.afterSave.fire(a)}});return this}});registerAnyNs("anyLib.UI");anyLib.UI.ScrollBar=Class.create({initialize:function(a,b){if(a!=null){this.setContainer(a)}if(b!=null){this.setHandle(b)}this._setValue(0);this.onJump=new anyLib.Event.Collection();this.onScroll=new anyLib.Event.Collection();this.onScrollStop=new anyLib.Event.Collection();this.onScrollStart=new anyLib.Event.Collection()},getContainer:function(){if(typeof(this._container)=="undefined"){this.setContainer(null)}return this._container},setContainer:function(a){this._container=a;if(a!=null){this.getContainer().on("click",this._findClick.bind(this))}return this},getHandle:function(){if(typeof(this._handle)=="undefined"){this.setHandle(null)}return this._handle},setHandle:function(a){this._handle=a;if(a!=null){this._setMouseMoveHandle(document.on("mousemove",this._find.bind(this)));this._getMouseMoveHandle().stop();this._setTouchMoveHandle(document.on("touchmove",this._find.bind(this)));this._getTouchMoveHandle().stop();this._setMouseUpHandle(document.on("mouseup",this._mouseUp.bind(this)));this._getMouseUpHandle().stop();this.getHandle().on("mousedown",this._mouseDown.bind(this));document.on("touchend",this._mouseUp.bind(this));this.getHandle().on("touchstart",this._mouseDown.bind(this))}return this},_getMouseUpHandle:function(){if(typeof(this._mouseUpHandle)=="undefined"){this._setMouseUpHandle(null)}return this._mouseUpHandle},_setMouseUpHandle:function(a){this._mouseUpHandle=a;return this},_getMouseMoveHandle:function(){if(typeof(this._mouseMoveHandle)=="undefined"){this._setMouseMoveHandle(null)}return this._mouseMoveHandle},_setMouseMoveHandle:function(a){this._mouseMoveHandle=a;return this},_getTouchMoveHandle:function(){if(typeof(this._touchMoveHandle)=="undefined"){this._setTouchMoveHandle(null)}return this._touchMoveHandle},_setTouchMoveHandle:function(a){this._touchMoveHandle=a;return this},getValue:function(){if(typeof(this._value)=="undefined"){this._setValue(null)}return this._value},_setValue:function(a){this._value=a;return this},getClickOffset:function(){if(typeof(this._clickOffset)=="undefined"){this._setClickOffset(null)}return this._clickOffset},_setClickOffset:function(a){this._clickOffset=a;return this},_findClick:function(a){Event.stop(a);this.onJump.fire(this);this._find(a);this._setClickOffset(0)},_mouseUp:function(a){Event.stop(a);this._getMouseUpHandle().stop();this._getMouseMoveHandle().stop();this._getTouchMoveHandle().stop();this.onScrollStop.fire(this)},_mouseDown:function(b){var a=new anyLib.Exception.NotImplemented("_mouseDown");a.setStack(["anyLib.UI.ScrollBar#initialize","anyLib.UI.ScrollBar#_mouseDown(event)"]);throw a},_find:function(b){var a=new anyLib.Exception.NotImplemented("_find");a.setStack(["anyLib.UI.ScrollBar#initialize","anyLib.UI.ScrollBar#_find(event)"]);throw a},_setPosition:function(a){var b=new anyLib.Exception.NotImplemented("setPosition");b.setStack(["anyLib.UI.ScrollBar#initialize","anyLib.UI.ScrollBar#setPosition(position)"]);throw b},setToValue:function(b){var a=new anyLib.Exception.NotImplemented("setToValue");a.setStack(["anyLib.UI.ScrollBar#initialize","anyLib.UI.ScrollBar#setToValue(percent)"]);throw a}});registerAnyNs("anyLib.UI.ScrollBar");anyLib.UI.ScrollBar.Horizontal=Class.create(anyLib.UI.ScrollBar,{_mouseDown:function(b){Event.stop(b);var a=this.getHandle().cumulativeOffset().left+(this.getHandle().measure("width")/2);this._setClickOffset(a-anyLib.Event.getPosition(b).left);this._getMouseUpHandle().start();this._getMouseMoveHandle().start();this._getTouchMoveHandle().start();this.onScrollStart.fire(this)},_find:function(c){var a=anyLib.Event.getPosition(c).left-this.getContainer().cumulativeOffset().left;a=a-(this.getHandle().measure("width")/2);a=a+this.getClickOffset();if(a<0){a=0}var b=this.getContainer().measure("width")-this.getHandle().getWidth();if(a>b){a=b}this._setPosition(a)},_setPosition:function(a){this._setValue((a/(this.getContainer().measure("width")-this.getHandle().measure("width")))*100);this.onScroll.fire(this);this.getHandle().setStyle({left:a+"px"})},setToValue:function(c){if(c<0){var b=new anyLib.Exception.ArgumentException(c,"The value can not be below zero");b.setStack(["anyLib.UI.ScrollBar.Horizontal#initialize","anyLib.UI.ScrollBar.Horizontal#setToValue(percent)"]);throw b}if(c>100){var b=new anyLib.Exception.ArgumentException(c,"The value can not be above 100");b.setStack(["anyLib.UI.ScrollBar.Horizontal#initialize","anyLib.UI.ScrollBar.Horizontal#setToValue(percent)"]);throw b}var a=((this.getContainer().measure("width")-this.getHandle().measure("width"))/100)*c;this._setPosition(parseInt(a))}});registerAnyNs("anyLib.UI.ScrollBar");anyLib.UI.ScrollBar.Vertical=Class.create(anyLib.UI.ScrollBar,{_mouseDown:function(b){Event.stop(b);var a=this.getHandle().cumulativeOffset().top+(this.getHandle().measure("height")/2);this._setClickOffset(a-anyLib.Event.getPosition(b).top);this._getMouseUpHandle().start();this._getMouseMoveHandle().start();this._getTouchMoveHandle().start();this.onScrollStart.fire(this)},_find:function(c){var a=anyLib.Event.getPosition(c).top-this.getContainer().cumulativeOffset().top;a=a-(this.getHandle().measure("height")/2);a=a+this.getClickOffset();if(a<0){a=0}var b=this.getContainer().measure("height")-this.getHandle().measure("height");if(a>b){a=b}this._setPosition(a)},_setPosition:function(a){this._setValue((a/(this.getContainer().measure("height")-this.getHandle().measure("height")))*100);this.onScroll.fire(this);this.getHandle().setStyle({top:a+"px"})},setToValue:function(c){if(c<0){var b=new anyLib.Exception.ArgumentException(c,"The value can not be below zero");b.setStack(["anyLib.UI.ScrollBar.Vertical#initialize","anyLib.UI.ScrollBar.Vertical#setToValue(percent)"]);throw b}if(c>100){var b=new anyLib.Exception.ArgumentException(c,"The value can not be above 100");b.setStack(["anyLib.UI.ScrollBar.Vertical#initialize","anyLib.UI.ScrollBar.Vertical#setToValue(percent)"]);throw b}var a=((this.getContainer().measure("height")-this.getHandle().measure("height"))/100)*c;this._setPosition(parseInt(a))}});
