(function(a){a.current_id=0;a.fn.generateId=function(b){if(b===undefined){b="userid_"}return this.each(function(){var c=a(this);if(!c.attr("id")){var d=b+(a.current_id++);c.attr("id",d)}})};a.fn.getIdSelector=function(b){if(this.length==0){return undefined}this.generateId(b);return"#"+this.eq(0).attr("id")}})(jQuery);function ns(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;e++){f=b[e].split(".");g=window;for(c=0;c<f.length;c++){g[f[c]]=g[f[c]]||{};g=g[f[c]]}}return g}ns("utils");utils.extend=function(d,e,c){var b=function(){};b.prototype=e.prototype;d.prototype=new b();d.prototype.constructor=d;d.superclass=e.prototype;if(e.prototype.constructor==Object.prototype.constructor){e.prototype.constructor=e}if(c){for(var a in c){d.prototype[a]=c[a]}}};Offset=function(b,a){this.left=0;this.top=0;this.setup(b,a)};Offset.prototype={setup:function(b,a){if(b instanceof Object){this.left=b.left;this.top=b.top}else{if(b!==undefined){this.left=b}if(a!==undefined){this.top=a}}return this},add:function(b,a){var c=new Offset(b,a);this.left+=c.left;this.top+=c.top;return this},sub:function(b,a){var c=new Offset(b,a);this.left-=c.left;this.top-=c.top;return this},getCopy:function(){return new Offset(this)}};Size=function(b,a){this.width=0;this.height=0;this.setup(b,a)};Size.prototype={setup:function(b,a){if(b instanceof Object){this.width=b.width;this.height=b.height}else{if(b!==undefined){this.width=b}if(a!==undefined){this.height=a}}return this},add:function(c,a){var b=new Size(c,a);this.width+=b.width;this.height+=b.height;return this},sub:function(c,a){var b=new Size(c,a);this.width-=b.width;this.height-=b.height;return this},getCopy:function(){return new Size(this)}};Frame=function(d,c,b,a){this.offset=new Offset();this.size=new Size();this.setup(d,c,b,a)};Frame.prototype={setup:function(d,c,b,a){if(d instanceof Object){this.setOffset(d);if(c){this.setSize(c)}}else{this.offset.setup(d,c);this.size.setup(b,a)}return this},setSize:function(b,a){this.size.setup(b,a);return this},setOffset:function(b,a){this.offset.setup(b,a);return this},getRight:function(){return this.offset.left+this.size.width},getBottom:function(){return this.offset.top+this.size.height},getXC:function(){return this.offset.left+this.size.width/2},getYC:function(){return this.offset.top+this.size.height/2},getCenter:function(){return new Offset(this.getXC(),this.getYC())},getCopy:function(){return new Frame(this.offset,this.size)},setRight:function(a){this.offset.left=a-this.size.width},setBottom:function(a){this.offset.top=a-this.size.height},testX:function(a){return a>=this.offset.left&&a<=this.getRight()},testY:function(a){return a>=this.offset.top&&a<=this.getBottom()},testPoint:function(a,b){return this.testX(a)&&this.testY(b)}};Function.prototype.createDelegate=function(c,b,a){var d=this;return function(){var f=b||arguments;if(a===true){f=Array.prototype.slice.call(arguments,0);f=f.concat(b)}else{if(typeof a=="number"){f=Array.prototype.slice.call(arguments,0);var e=[a,0].concat(b);Array.prototype.splice.apply(f,e)}}return d.apply(c||window,f)}};String.prototype.entityDecode=function(){return this.replace("&gt;",">").replace("&lt;","<").replace("&quot;",'"').replace("&#039;","'").replace("&amp;","&")};ns("utils");utils.Observable=function(a){this.listeners={};if(!this.events){this.events={}}if(a){$.extend(this,a)}this.addListeners(this.listeners)};utils.Observable.prototype={addEvents:function(a){this.events=$.extend(this.events||{},a)},addListeners:function(b){var c=this;var a=b.scope?b.scope:window;$.each(b,function(d,e){var f=a;if(!$.isFunction(e)){if(e.scope){f=e.scope}e=e.handler}c.addListener(d,e,f)})},addListener:function(a,c,b){if(!(this.events[a] instanceof Array)){this.events[a]=[]}this.events[a].push([c,b])},on:function(a,c,b){this.addListener(a,c,b)},fireEvent:function(d,c){if(!(this.events[d] instanceof Array)){return true}var a=true;if(!c){c=[]}for(var e=0,b=this.events[d].length;e<b;e++){var g=this.events[d][e][0];var f=this.events[d][e][1];if(!f){f=window}if(g.apply(f,c)===false){a=false}}return a}};ns("utils.Effects.Frame");utils.Effects.Frame={getViewCenter:function(){var a=utils.Effects.Frame.getViewFrame();return new Offset(a.offset.left+a.size.width/2,a.offset.top+a.size.height/2)},getViewFrame:function(){return new Frame(utils.Effects.Frame.getViewOffset(),utils.Effects.Frame.getViewSize())},getViewSize:function(){var a=document.compatMode=="CSS1Compat"?document.documentElement.clientHeight:document.body.clientHeight;var b=document.compatMode=="CSS1Compat"?document.documentElement.clientWidth:document.body.clientWidth;return new Size(b,a)},getViewOffset:function(){var b=self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop);var a=self.pageXOffset||(document.documentElement&&document.documentElement.scrollLeft)||(document.body&&document.body.scrollLeft);return new Offset(a,b)},getBodyOffset:function(){return $("body").offset()},scaleRectangleIntoRectangle:function(d,e){var c=1;var b=e.width/d.width;var a=e.height/d.height;if(b>1&&a>1){c=1}else{if(b<1&&a<1){if(b>a){c=a}else{c=b}}else{if(b<=1){c=b}else{c=a}}}return new Size(d.width*c,d.height*c)}};ns("utils.Effects");utils.Effects.ImagePreloader=function(a){this.loaded=false;this.size=new Size();this.selector=null;this.src=null;this.loading=false;this.addEvents({load:true});utils.Effects.ImagePreloader.superclass.constructor.call(this,a)};utils.extend(utils.Effects.ImagePreloader,utils.Observable,{load:function(a){this.loaded=false;this.loading=true;this.src=a;this.getImgEl().attr("src",a)},getSrc:function(){return this.src},isLoaded:function(){return this.loaded},isLoading:function(){return this.loading},getSize:function(){return this.size.getCopy()},onLoad:function(a){this.size.setup(a.target.width,a.target.height);this.loaded=true;this.loading=false;this.removeEl();this.fireEvent("load",[this])},cancel:function(){this.loading=false;this.removeEl()},removeEl:function(){if(!this.selector){return}this.getImgEl().unbind("load",this.onLoad);this.getEl().remove();this.selector=null},getEl:function(){if(!this.selector){this.selector=this._createPreloadImg()}return $(this.selector)},getImgEl:function(){return $("img",this.getEl())},_createPreloadImg:function(){var b=$('<div style="position: absolute; top: -10px; left: -10px; width: 1px; height: 1px; overflow: hidden;"></div>');var a=$("<img>").load(this.onLoad.createDelegate(this));return b.append(a).appendTo("body").getIdSelector()}});ns("utils.Effects");utils.Effects.SimpleImagePreloader=function(){this.images={};this.queue=[];this.loading=false};utils.Effects.SimpleImagePreloader._instance=null;utils.Effects.SimpleImagePreloader.instance=function(){if(!utils.Effects.SimpleImagePreloader._instance){utils.Effects.SimpleImagePreloader._instance=new utils.Effects.SimpleImagePreloader()}return utils.Effects.SimpleImagePreloader._instance};utils.Effects.SimpleImagePreloader.prototype={add:function(c,b){if(b===undefined){b=true}if(c instanceof Array){for(var a=c.length-1;a>=0;a--){this.add(c[a],a==0&&b)}}else{this._prepareImageIf(c);this.queue.push(c);if(b){this.next()}}},_prepareImageIf:function(a){if(!this.images[a]){this._prepareImage(a)}},_prepareImage:function(a){this.images[a]=new Image();this.images[a].onload=this.onLoad.createDelegate(this);this.images[a].onerror=this.onError.createDelegate(this);this.images[a].onabort=this.onAbort.createDelegate(this)},_loadIf:function(a){if(!this.images[a].src){this._load(a)}},_load:function(a){this.images[a].src=a;this.loading=true},next:function(){while(!this.loading&&this.queue.length>0){this._loadIf(this.queue.pop())}},onLoad:function(){this.loading=false;this.next()},onError:function(){this.loading=false;this.next()},onAbort:function(){this.loading=false;this.next()}};function preload_image(b,a){utils.Effects.SimpleImagePreloader.instance().add(b,a)}ns("utils.Effects");utils.Effects.Mask=function(a){this.opacity=utils.Effects.Mask.MASK_OPACITY;this.mask_speed=utils.Effects.Mask.SPEED;this.shown=false;this.el=null;this.addEvents({click:true});utils.Effects.Mask.superclass.constructor.call(this,a)};utils.Effects.Mask.MASK_OPACITY=0.6;utils.Effects.Mask.SPEED="fast";utils.extend(utils.Effects.Mask,utils.Observable,{initEvents:function(){$(window).resize(this.onUpdateFrame.createDelegate(this)).scroll(this.onUpdateFrame.createDelegate(this));this.getEl().click(this.onClick.createDelegate(this))},show:function(a){this.shown=true;this._updatePosition();this.getEl().fadeTo(this.mask_speed,this.opacity,a)},hide:function(){var a=this;this.getEl().fadeTo(this.mask_speed,0,function(){a.shown=false;$(this).css({top:-1000,left:-1000,width:0,height:0})})},_updatePosition:function(){this.getEl().css({top:0,left:0}).width("100%").height($(document).height())},getEl:function(){if(!this.el){this.el=this._createEl().getIdSelector();this.initEvents()}return $(this.el)},onUpdateFrame:function(){if(this.shown){this._updatePosition()}},onClick:function(){this.fireEvent("click",[this])},_createEl:function(){return $('<div class="magnifier_mask">&nbsp;</div>').css({position:"absolute",top:-1000,left:-1000,width:0,height:0,opacity:0}).appendTo("body")}});utils.Effects.Mask.Singletone={_instance:null,instance:function(){if(!utils.Effects.Mask.Singletone._instance){utils.Effects.Mask.Singletone._instance=new utils.Effects.Mask()}return utils.Effects.Mask.Singletone._instance},show:function(){utils.Effects.Mask.Singletone.instance().show()},hide:function(){utils.Effects.Mask.Singletone.instance().hide()}};
