/*
*  Ajax Autocomplete for jQuery, version 1.1
*  (c) 2009 Tomas Kirda
*
*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
*  For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
*
*  Last Review: 09/27/2009
*/
(function($){var reEscape=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g");function fnFormatResult(value,data,currentValue){var pattern="("+currentValue.replace(reEscape,"\\$1")+")";return value.replace(new RegExp(pattern,"gi"),"<strong>$1</strong>");}function Autocomplete(el,options){this.el=$(el);this.el.attr("autocomplete","off");this.suggestions=[];this.data=[];this.badQueries=[];this.selectedIndex=-1;this.currentValue=this.el.val();this.intervalId=0;this.cachedResponse=[];this.onChangeInterval=null;this.ignoreValueChange=false;this.serviceUrl=options.serviceUrl;this.isLocal=false;this.options={autoSubmit:false,minChars:1,maxHeight:300,deferRequestBy:0,width:0,highlight:true,params:{},fnFormatResult:fnFormatResult,delimiter:null,zIndex:9999};this.initialize();this.setOptions(options);}$.fn.autocomplete=function(options){return new Autocomplete(this.get(0),options);};Autocomplete.prototype={killerFn:null,initialize:function(){var me,uid,autocompleteElId;me=this;uid=new Date().getTime();autocompleteElId="Autocomplete_"+uid;this.killerFn=function(e){if($(e.target).parents(".autocomplete").size()===0){me.killSuggestions();me.disableKillerFn();}};if(!this.options.width){this.options.width=this.el.width();}this.mainContainerId="AutocompleteContainter_"+uid;$('<div id="'+this.mainContainerId+'" style="position:absolute;z-index:9999;"><div class="autocomplete-w1"><div class="autocomplete" id="'+autocompleteElId+'" style="display:none; width:300px;"></div></div></div>').appendTo("body");this.container=$("#"+autocompleteElId);this.fixPosition();if(window.opera){this.el.keypress(function(e){me.onKeyPress(e);});}else{this.el.keydown(function(e){me.onKeyPress(e);});}this.el.keyup(function(e){me.onKeyUp(e);});this.el.blur(function(){me.enableKillerFn();});this.el.focus(function(){me.fixPosition();});},setOptions:function(options){var o=this.options;$.extend(o,options);if(o.lookup){this.isLocal=true;if($.isArray(o.lookup)){o.lookup={suggestions:o.lookup,data:[]};}}$("#"+this.mainContainerId).css({zIndex:o.zIndex});this.container.css({maxHeight:o.maxHeight+"px",width:o.width});},clearCache:function(){this.cachedResponse=[];this.badQueries=[];},disable:function(){this.disabled=true;},enable:function(){this.disabled=false;},fixPosition:function(){var offset=this.el.offset();$("#"+this.mainContainerId).css({top:(offset.top+this.el.innerHeight())+"px",left:offset.left+"px"});},enableKillerFn:function(){var me=this;$(document).bind("click",me.killerFn);},disableKillerFn:function(){var me=this;$(document).unbind("click",me.killerFn);},killSuggestions:function(){var me=this;this.stopKillSuggestions();this.intervalId=window.setInterval(function(){me.hide();me.stopKillSuggestions();},300);},stopKillSuggestions:function(){window.clearInterval(this.intervalId);},onKeyPress:function(e){if(this.disabled||!this.enabled){return;}switch(e.keyCode){case 27:this.el.val(this.currentValue);this.hide();break;case 9:case 13:if(this.selectedIndex===-1){this.hide();return;}this.select(this.selectedIndex);if(e.keyCode===9){return;}break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return;}e.stopImmediatePropagation();e.preventDefault();},onKeyUp:function(e){if(this.disabled){return;}switch(e.keyCode){case 38:case 40:return;}clearInterval(this.onChangeInterval);if(this.currentValue!==this.el.val()){if(this.options.deferRequestBy>0){var me=this;this.onChangeInterval=setInterval(function(){me.onValueChange();},this.options.deferRequestBy);}else{this.onValueChange();}}},onValueChange:function(){clearInterval(this.onChangeInterval);this.currentValue=this.el.val();var q=this.getQuery(this.currentValue);this.selectedIndex=-1;if(this.ignoreValueChange){this.ignoreValueChange=false;return;}if(q===""||q.length<this.options.minChars){this.hide();}else{this.getSuggestions(q);}},getQuery:function(val){var d,arr;d=this.options.delimiter;if(!d){return $.trim(val);}arr=val.split(d);return $.trim(arr[arr.length-1]);},getSuggestionsLocal:function(q){var ret,arr,len,val,i;arr=this.options.lookup;len=arr.suggestions.length;ret={suggestions:[],data:[]};q=q.toLowerCase();for(i=0;i<len;i++){val=arr.suggestions[i];if(val.toLowerCase().indexOf(q)===0){ret.suggestions.push(val);ret.data.push(arr.data[i]);}}return ret;},getSuggestions:function(q){var cr,me;cr=this.isLocal?this.getSuggestionsLocal(q):this.cachedResponse[q];if(cr&&$.isArray(cr.suggestions)){this.suggestions=cr.suggestions;this.data=cr.data;this.suggest();}else{if(!this.isBadQuery(q)){me=this;me.options.params.query=q;$.get(this.serviceUrl,me.options.params,function(txt){me.processResponse(txt);},"text");}}},isBadQuery:function(q){var i=this.badQueries.length;while(i--){if(q.indexOf(this.badQueries[i])===0){return true;}}return false;},hide:function(){this.enabled=false;this.selectedIndex=-1;this.container.hide();},suggest:function(){if(this.suggestions.length===0){this.hide();return;}var me,len,div,f,v,i,s,mOver,mClick;me=this;len=this.suggestions.length;f=this.options.fnFormatResult;v=this.getQuery(this.currentValue);mOver=function(xi){return function(){me.activate(xi);};};mClick=function(xi){return function(){me.select(xi);};};this.container.hide().empty();for(i=0;i<len;i++){s=this.suggestions[i];div=$((me.selectedIndex===i?'<div class="selected"':"<div")+' title="'+s+'">'+f(s,this.data[i],v)+"</div>");div.mouseover(mOver(i));div.click(mClick(i));this.container.append(div);}this.enabled=true;this.container.show();},processResponse:function(text){var response;try{response=eval("("+text+")");}catch(err){return;}if(!$.isArray(response.data)){response.data=[];}this.cachedResponse[response.query]=response;if(response.suggestions.length===0){this.badQueries.push(response.query);}if(response.query===this.getQuery(this.currentValue)){this.suggestions=response.suggestions;this.data=response.data;this.suggest();}},activate:function(index){var divs,activeItem;divs=this.container.children();if(this.selectedIndex!==-1&&divs.length>this.selectedIndex){$(divs.get(this.selectedIndex)).attr("class","");}this.selectedIndex=index;if(this.selectedIndex!==-1&&divs.length>this.selectedIndex){activeItem=divs.get(this.selectedIndex);$(activeItem).attr("class","selected");}return activeItem;},deactivate:function(div,index){div.className="";if(this.selectedIndex===index){this.selectedIndex=-1;}},select:function(i){var selectedValue,f;selectedValue=this.suggestions[i];if(selectedValue){this.el.val(selectedValue);if(this.options.autoSubmit){f=this.el.parents("form");if(f.length>0){f.get(0).submit();}}this.ignoreValueChange=true;this.hide();this.onSelect(i);}},moveUp:function(){if(this.selectedIndex===-1){return;}if(this.selectedIndex===0){this.container.children().get(0).className="";this.selectedIndex=-1;this.el.val(this.currentValue);return;}this.adjustScroll(this.selectedIndex-1);},moveDown:function(){if(this.selectedIndex===(this.suggestions.length-1)){return;}this.adjustScroll(this.selectedIndex+1);},adjustScroll:function(i){var activeItem,offsetTop,upperBound,lowerBound;activeItem=this.activate(i);offsetTop=activeItem.offsetTop;upperBound=this.container.scrollTop();lowerBound=upperBound+this.options.maxHeight-25;if(offsetTop<upperBound){this.container.scrollTop(offsetTop);}else{if(offsetTop>lowerBound){this.container.scrollTop(offsetTop-this.options.maxHeight+25);}}},onSelect:function(i){var me,onSelect,getValue,s,d;me=this;onSelect=me.options.onSelect;getValue=function(value){var del,currVal,arr;del=me.options.delimiter;if(!del){return value;}currVal=me.currentValue;arr=currVal.split(del);if(arr.length===1){return value;}return currVal.substr(0,currVal.length-arr[arr.length-1].length)+value;};s=me.suggestions[i];d=me.data[i];me.el.val(getValue(s));if($.isFunction(onSelect)){onSelect(s,d);}}};}(jQuery));
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
function popUpApsis(URL){day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=660');")}$(document).ready(function(){$(document).keypress(function(c){if(c.which==13&&c.target.tagName=="INPUT"&&($(c.target).attr("type")=="text"||$(c.target).attr("type")=="password")){try{if($(c.target).hasClass("enable-submit")){c.returnValue=false;c.cancel=true;c.preventDefault();c.stopPropagation();if($(c.target).closest("#sales-office-search").length>0){var b=$(c.target).closest("#sales-office-search");var a=$("input[type='button'], input[type='submit']",b);a.click()}else{if($(c.target).closest("#SearchArea").length>0){var b=$(c.target).closest("#SearchArea");var a=$("input[type='button'], input[type='submit']",b);a.click()}else{if($(c.target).closest("#LoginForm").length>0){var b=$(c.target).closest("#LoginForm");var a=$("input[type='button'], input[type='submit']",b);a.click()}}}}else{c.returnValue=false;c.cancel=true;c.preventDefault();c.stopPropagation()}}catch(d){}}else{if(c.which==13){c.returnValue=false;c.cancel=true;c.preventDefault();c.stopPropagation()}}})});
jQuery.fn.ImageSlider=function(d){var e=jQuery.extend({NumberOfVisible:50,NextSelector:"",PrevSelector:"",NextThumbSelector:"",PrevThumbSelector:"",GoToSelector:"",UseThumbnails:false,Animation:"easeOutCubic",Opacity:"0.2",SlideElement:"img",SlideElementWidth:0,SlideWidth:0,Padding:4,StartOffset:2,ShowCenter:true,UseIdHolder:false},d);var b=new Array();var a=0;var f=this;var g=0;$(e.SlideElement+":lt("+(e.NumberOfVisible+1)+")",this).show();$(e.SlideElement+":first",this).css("opacity","1");$(e.SlideElement,f).each(function(h){var j=new Object();j.x=a;j.width=$(this).width()+e.Padding;j.id=$(this).attr("src");b[h]=j;a+=$(this).width()+e.Padding;if(h==($(e.SlideElement,f).length-1)){if(g==h){$(e.NextSelector).hide()}else{$(e.NextSelector).show()}}else{if(h==0){$("#"+_CurrentImageInput).val(b[h].id)}}});$(e.PrevSelector).hide();$(e.NextSelector).click(function(){g++;if(e.UseThumbnails){$(e.NextThumbSelector).click()}c()});$(e.PrevSelector).click(function(){g--;if(e.UseThumbnails){$(e.PrevThumbSelector).click()}c()});$(e.GoToSelector).click(function(h){g=$(e.GoToSelector).data("SliderIndex");c()});function c(){if(g==0){$(e.PrevSelector).hide()}else{$(e.PrevSelector).show()}if(g==b.length-1){$(e.NextSelector).hide()}else{$(e.NextSelector).show()}$(e.SlideElement+":eq("+(g+(e.NumberOfVisible-1))+")",f).show();e.ScrollPosition=b[g].x*(-1);if(e.ShowCenter){e.ScrollPosition+=((e.SlideWidth/2)-(b[g].width/2))}if(g==0){e.ScrollPosition=0}else{if(g==b.length-1){e.ScrollPosition=(b[g].x*(-1)+e.SlideWidth)-(b[g].width-e.Padding)}}$(e.SlideElement+":eq("+g+")",f).animate({opacity:1});if(g>0){$(e.SlideElement+":eq("+(g-1)+")",f).animate({opacity:e.Opacity})}$(e.SlideElement+":eq("+(g+1)+")",f).animate({opacity:e.Opacity});$(f).animate({marginLeft:e.ScrollPosition+e.StartOffset});$("#"+_CurrentImageInput).val(b[g].id)}return this};jQuery.fn.ThumbnailSlider=function(g){var i=jQuery.extend({NumberOfVisible:8,NextSelector:"",PrevSelector:"",GoToSelector:"",NextSectionSelector:"",PrevSectionSelector:"",Animation:"easeOutCubic",Opacity:".5",SlideElement:"div",SlideElementWidth:0,SlideWidth:0,Padding:3,ShowCenter:true,ReverseOpacity:false,ThumbnailsPerPage:0,CurrentIndex:0,UseIdHolder:false},g);var c=new Array();var a=0;var j=this;var k=0;var h=0;$(i.SlideElement,j).each(function(l){var m=new Object();m.x=a;m.width=$(this).width()+i.Padding;m.id=$(this).attr("src");c[l]=m;a+=$(this).width()+i.Padding;if(l==$(i.SlideElement,j).length-1){d(false)}else{if(l==0){$("#"+_CurrentImageInput).val(c[l].id)}}});function d(l){if(typeof l=="undefined"){l=true}k=i.CurrentIndex;h=(Math.floor(k/i.ThumbnailsPerPage))*i.ThumbnailsPerPage;if(h<0){h=0}var m=k>=i.ThumbnailsPerPage?true:false;b(m,k,l)}$(i.NextSelector).click(function(){k++;f(true)});$(i.PrevSelector).click(function(){k--;f(false)});$(i.NextSectionSelector).click(function(){h+=i.ThumbnailsPerPage;e(true)});$(i.PrevSectionSelector).click(function(){h-=i.ThumbnailsPerPage;e(false)});$(i.SlideElement,this).each(function(l){$(this).data("SliderIndex",l);$(this).click(function(){k=$(this).data("SliderIndex");$(i.GoToSelector).data("SliderIndex",k);$(i.GoToSelector).click();b(false,k)})});function b(m,n,l){if(typeof l=="undefined"){l=true}if(h==0){$(i.PrevSectionSelector).hide()}else{$(i.PrevSectionSelector).show()}if(h==(Math.ceil(c.length/i.ThumbnailsPerPage)-1)*i.ThumbnailsPerPage){$(i.NextSectionSelector).hide()}else{$(i.NextSectionSelector).show()}$(i.SlideElement+":eq("+(k+(i.NumberOfVisible-1))+")",j).show();if(m){i.ScrollPosition=c[h].x*(-1)}if(h==0){i.ScrollPosition=0}if(i.ReverseOpacity){$(i.SlideElement,j).css("opacity",1);$(i.SlideElement+":eq("+n+")",j).css("opacity",i.Opacity)}else{$(i.SlideElement+" .tn-text",j).addClass("inactive");$(i.SlideElement+" .tn-text:eq("+n+")",j).removeClass("inactive")}if(l){$(j).animate({marginLeft:i.ScrollPosition})}else{$(j).css("marginLeft",i.ScrollPosition);$("#content-holder-no-margin .slider-thumbnails div.thumb-item").show()}}function f(l){h=k-(k%i.ThumbnailsPerPage);if(h==0){$(i.PrevSectionSelector).hide()}else{$(i.PrevSectionSelector).show()}if(h==c.length-1%i.ThumbnailsPerPage){$(i.NextSectionSelector).hide()}else{$(i.NextSectionSelector).show()}$(i.SlideElement+":eq("+(k+(i.NumberOfVisible-1))+")",j).show();i.ScrollPosition=c[h].x*(-1);if(l){if(h+i.ThumbnailsPerPage>c.length){h=(c.length-i.ThumbnailsPerPage)}i.ScrollPosition=c[h].x*(-1)}if(h==0){i.ScrollPosition=0}if(!i.ReverseOpacity){$(i.SlideElement+":eq("+k+")",j).animate({opacity:1});$(i.SlideElement+":eq("+(k-1)+")",j).animate({opacity:i.Opacity});$(i.SlideElement+":eq("+(k+1)+")",j).animate({opacity:i.Opacity})}else{$(i.SlideElement+":eq("+k+")",j).animate({opacity:i.Opacity});$(i.SlideElement+":eq("+(k-1)+")",j).animate({opacity:1});$(i.SlideElement+":eq("+(k+1)+")",j).animate({opacity:1})}$(j).animate({marginLeft:i.ScrollPosition});$("#"+_CurrentImageInput).val(c[k].id)}function e(l){if(h<=0){$(i.PrevSectionSelector).hide()}else{$(i.PrevSectionSelector).show()}if((h+i.ThumbnailsPerPage)<c.length){$(i.NextSectionSelector).show()}else{$(i.NextSectionSelector).hide()}i.ScrollPosition=c[h].x*(-1);$(j).animate({marginLeft:i.ScrollPosition});$("#"+_CurrentImageInput).val(c[k].id)}return this};
/*
 * Galleria v 1.1.2
 * http://galleria.aino.se
 *
 * Copyright 2010, Aino
 * Licensed under the MIT license.
 */
(function(){var e=false,c=/xyz/.test(function(){xyz})?/\b__super\b/:/.*/,b=function(){},m=this;b.extend=function(q){var n=this.prototype;e=true;var r=new this();e=false;for(var p in q){if(p){r[p]=typeof q[p]=="function"&&typeof n[p]=="function"&&c.test(q[p])?(function(t,s){return function(){var v=this.__super;this.__super=n[t];var u=s.apply(this,arguments);this.__super=v;return u}})(p,q[p]):q[p]}}function o(){if(!e&&this.__constructor){this.__constructor.apply(this,arguments)}}o.prototype=r;o.constructor=o;o.extend=arguments.callee;return o};var a=b.extend({loop:function(n,o){var p=this;if(typeof n=="number"){n=new Array(n)}jQuery.each(n,function(){o.call(p,arguments[1],arguments[0])});return n},create:function(p,n){p=p||"div";var o=document.createElement(p);if(n){o.className=n}return o},getElements:function(o){var n={};this.loop(jQuery(o),this.proxy(function(p){this.push(p,n)}));return n},setStyle:function(o,n){jQuery(o).css(n);return this},cssText:function(o){var p=document.createElement("style");this.getElements("head")[0].appendChild(p);if(p.styleSheet){p.styleSheet.cssText=o}else{var n=document.createTextNode(o);p.appendChild(n)}return this},cssFile:function(o){var n=document.createElement("link");n.media="all";n.rel="stylesheet";n.href=o;this.getElements("head")[0].appendChild(n)},moveOut:function(n){return this.setStyle(n,{position:"absolute",left:"-10000px"})},moveIn:function(n){return this.setStyle(n,{left:"0"})},reveal:function(n){return jQuery(n).show()},hide:function(n){return jQuery(n).hide()},mix:function(o,n){return jQuery.extend(o,n)},proxy:function(n,o){if(typeof n!=="function"){return function(){}}o=o||this;return function(){return n.apply(o,Array.prototype.slice.call(arguments))}},listen:function(n,p,o){jQuery(n).bind(p,o)},forget:function(n,o){jQuery(n).unbind(o)},dispatch:function(n,o){jQuery(n).trigger(o)},clone:function(n,o){o=o||false;return jQuery(n).clone(o)[0]},removeAttr:function(o,n){this.loop(n.split(" "),function(p){jQuery(o).removeAttr(p)})},push:function(n,o){if(typeof o.length=="undefined"){o.length=0}Array.prototype.push.call(o,n);return n},width:function(n,o){return this.meassure(n,o,"Width")},height:function(n,o){return this.meassure(n,o,"Height")},meassure:function(n,q,p){var o=jQuery(n);var r=q?o["outer"+p](true):o[p.toLowerCase()]();if(d.QUIRK){var s=p=="Width"?["left","right"]:["top","bottom"];this.loop(s,function(t){r+=o.css("border-"+t+"-width").replace(/[^\d]/g,"")*1;r+=o.css("padding-"+t).replace(/[^\d]/g,"")*1})}return r},toggleClass:function(p,o,n){if(typeof n!=="undefined"){var q=n?"addClass":"removeClass";jQuery(p)[q](o);return this}jQuery(p).toggleClass(o);return this},hideAll:function(n){jQuery(n).find("*").hide()},animate:function(n,p){var o=jQuery(n);if(!o.length){return}if(p.from){o.css(from)}o.animate(p.to,{duration:p.duration||400,complete:p.complete||function(){}})},wait:function(p,n,o,q){p=this.proxy(p);n=this.proxy(n);o=this.proxy(o);var r=new Date().getTime()+(q||3000);m.setTimeout(function(){if(p()){n();return false}if(new Date().getTime()>=r){o();n();return false}m.setTimeout(arguments.callee,1)},1);return this},getScript:function(r,n){var p=document.getElementsByTagName("head")[0];var q=document.createElement("script");q.src=r;n=this.proxy(n);var o=false;q.onload=q.onreadystatechange=function(){if(!o&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){o=true;n();q.onload=q.onreadystatechange=null}};p.appendChild(q);return this}});var g=a.extend({__constructor:function(n){this.image=null;this.elem=this.create("div","galleria-image");this.setStyle(this.elem,{overflow:"hidden",position:"relative"});this.order=n;this.orig={w:0,h:0,r:1}},cache:{},add:function(o){if(this.cache[o]){return this.cache[o]}var n=new Image();n.src=o;this.setStyle(n,{display:"block"});if(n.complete&&n.width){this.cache[o]=n;return n}n.onload=(function(p){return function(){p.cache[o]=n}})(this);return n},isCached:function(n){return this.cache[n]?this.cache[n].complete:false},make:function(o){var n=this.cache[o]||this.add(o);return this.clone(n)},load:function(o,n){n=this.proxy(n);this.elem.innerHTML="";this.image=this.make(o);this.moveOut(this.image);this.elem.appendChild(this.image);this.wait(function(){return(this.image.complete&&this.image.width)},function(){this.orig={h:this.image.height,w:this.image.width};n({target:this.image,scope:this})},function(){d.raise("image not loaded in 10 seconds: "+o)},10000);return this},scale:function(s,p,o,r,q,n){q=q||0;n=n||function(){};if(!this.image){return this}this.wait(function(){width=s||this.width(this.elem);height=p||this.height(this.elem);return width&&height},function(){var t=Math[(o?"max":"min")](width/this.orig.w,height/this.orig.h);if(r){t=Math.min(r,t)}this.setStyle(this.elem,{width:width,height:height});this.image.width=Math.ceil(this.orig.w*t)-q*2;this.image.height=Math.ceil(this.orig.h*t)-q*2;this.setStyle(this.image,{position:"relative",top:Math.round(this.image.height*-1/2+(height/2))-q,left:Math.round(this.image.width*-1/2+(width/2))-q});n.call(this)});return this}});var l;var d=m.Galleria=a.extend({__constructor:function(o){if(typeof o.target==="undefined"){d.raise("No target.")}this.playing=false;this.playtime=3000;this.active=null;this.queue={};this.data={};this.dom={};this.controls={active:0,swap:function(){this.active=this.active?0:1},getActive:function(){return this[this.active]},getNext:function(){return this[Math.abs(this.active-1)]}};this.thumbnails={};this.options=this.mix({preload:2,image_crop:false,thumb_crop:true,thumb_quality:"auto",image_margin:0,thumb_margin:0,transition:d.transitions.fade,transition_speed:400,carousel:true,carousel_speed:200,carousel_steps:"auto",carousel_follow:true,popup_links:false,max_scale_ratio:undefined,thumbnails:true,data_type:"auto",data_image_selector:"img",data_source:o.target,data_config:function(p){return{}},queue:true,remove_original:true},o);this.target=this.dom.target=this.getElements(this.options.target)[0];if(!this.target){d.raise("Target not found.")}this.stageWidth=0;this.stageHeight=0;var n="container stage images image-nav image-nav-left image-nav-right info info-link info-text info-title info-description info-author info-close thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter";n=n.split(" ");this.loop(n,function(p){this.dom[p]=this.create("div","galleria-"+p)})},bind:function(o,n){this.listen(this.get("container"),o,this.proxy(n));return this},trigger:function(n){n=typeof n=="object"?this.mix(n,{scope:this}):{type:n,scope:this};this.dispatch(this.get("container"),n);return this},run:function(){var p=this.options;if(!this.data.length){d.raise("Data is empty.")}this.target.innerHTML="";this.loop(2,function(){var o=new g();this.setStyle(o.elem,{position:"absolute",top:0,left:0});this.setStyle(this.get("images"),{position:"relative",top:0,left:0,width:"100%",height:"100%"});this.get("images").appendChild(o.elem);this.push(o,this.controls)},this);for(var n=0;this.data[n];n++){var r;if(p.thumbnails){r=new g(n);var q=this.data[n].thumb||this.data[n].image;this.get("thumbnails").appendChild(r.elem);r.load(q,this.proxy(function(o){var s=this.width(o.target);o.scope.scale(null,null,p.thumb_crop,p.max_scale_ratio,p.thumb_margin,this.proxy(function(){this.toggleQuality(o.target,p.thumb_quality===true||(p.thumb_quality=="auto"&&s<o.target.width*3));this.trigger({type:d.THUMBNAIL,thumbTarget:o.target,thumbOrder:o.scope.order})}))}));if(p.preload=="all"){r.add(this.data[n].image)}}else{r={elem:this.create("div","galleria-image"),image:this.create("span","img")};r.elem.appendChild(r.image);this.get("thumbnails").appendChild(r.elem)}r.elem.rel=n;this.listen(r.elem,"click",this.proxy(function(o){var s=o.currentTarget.rel;if(this.active!==s){this.show(s)}}));this.push(r,this.thumbnails)}this.build();this.target.appendChild(this.get("container"));this.wait(function(){this.stageWidth=this.width(this.get("stage"));this.stageHeight=this.height(this.get("stage"));return this.stageHeight&&this.stageWidth},function(){var s=this.thumbnails[0]?this.width(this.thumbnails[0].elem,true):0;var o=s*this.thumbnails.length;if(o<this.stageWidth){p.carousel=false}if(p.carousel){this.toggleClass(this.get("thumbnails-container"),"galleria-carousel");this.carousel={right:this.get("thumb-nav-right"),left:this.get("thumb-nav-left"),overflow:0,setOverflow:this.proxy(function(t){t=t||this.width(this.get("thumbnails-list"));this.carousel.overflow=Math.ceil(((o-t)/s)+1)*-1}),pos:0,setClasses:this.proxy(function(){this.toggleClass(this.carousel.left,"disabled",this.carousel.pos===0);this.toggleClass(this.carousel.right,"disabled",this.carousel.pos==this.carousel.overflow+1)}),animate:this.proxy(function(){this.carousel.setClasses();this.animate(this.get("thumbnails"),{to:{left:s*this.carousel.pos},duration:p.carousel_speed})})};this.carousel.setOverflow();this.setStyle(this.get("thumbnails-list"),{overflow:"hidden",position:"relative"});this.setStyle(this.get("thumbnails"),{width:o,position:"relative"});this.proxy(function(t,u){u=(typeof u=="string"&&u.toLowerCase()=="auto")?this.thumbnails.length+t.overflow:u;t.setClasses();this.loop(["left","right"],this.proxy(function(v){this.listen(t[v],"click",function(w){if(t.pos===(v=="right"?t.overflow:0)){return}t.pos=v=="right"?Math.max(t.overflow+1,t.pos-u):Math.min(0,t.pos+u);t.animate()})}))})(this.carousel,p.carousel_steps)}this.listen(this.get("image-nav-right"),"click",this.proxy(function(){this.next()}));this.listen(this.get("image-nav-left"),"click",this.proxy(function(){this.prev()}));this.trigger(d.READY)},function(){d.raise("Galleria could not load. Make sure stage has a height and width.")},5000)},addElement:function(){this.loop(arguments,function(n){this.dom[n]=this.create("div","galleria-"+n)});return this},getDimensions:function(n){return{w:n.width,h:n.height,cw:this.stageWidth,ch:this.stageHeight,top:(this.stageHeight-n.height)/2,left:(this.stageWidth-n.width)/2}},attachKeyboard:function(n){jQuery(document).bind("keydown",{map:n,scope:this},this.keyNav);return this},detachKeyboard:function(){jQuery(document).unbind("keydown",this.keyNav);return this},keyNav:function(n){var q=n.keyCode||n.which;var s=n.data.map;var t=n.data.scope;var r={UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8};for(var o in s){var p=o.toUpperCase();if(r[p]){s[r[p]]=s[o]}}if(typeof s[q]=="function"){s[q].call(t,n)}},build:function(){this.append({"info-text":["info-title","info-description","info-author"],info:["info-link","info-text","info-close"],"image-nav":["image-nav-right","image-nav-left"],stage:["images","loader","counter","image-nav"],"thumbnails-list":["thumbnails"],"thumbnails-container":["thumb-nav-left","thumbnails-list","thumb-nav-right"],container:["stage","thumbnails-container","info"]})},appendChild:function(p,n){try{this.get(p).appendChild(this.get(n))}catch(o){}},append:function(n){for(var o in n){if(n[o].constructor==Array){for(var p=0;n[o][p];p++){this.appendChild(o,n[o][p])}}else{this.appendChild(o,n[o])}}return this},rescale:function(p,o){var n=this.proxy(function(){this.stageWidth=p||this.width(this.get("stage"));this.stageHeight=o||this.height(this.get("stage"));return this.stageWidth&&this.stageHeight});if(d.WEBKIT){this.wait(n)}else{n.call(this)}this.controls.getActive().scale(this.stageWidth,this.stageHeight,this.options.image_crop,this.options.max_scale_ratio,this.options.image_margin);if(this.carousel){this.carousel.setOverflow()}},show:function(n,o){if(!this.options.queue&&this.queue.stalled){return}o=typeof o!="undefined"?!!o:n<this.active;this.active=n;this.push([n,o],this.queue);if(!this.queue.stalled){this.showImage()}return this},showImage:function(){var z=this.options;var r=this.queue[0];var w=r[0];var B=!!r[1];if(z.carousel&&this.carousel&&z.carousel_follow){this.proxy(function(n){if(w<=Math.abs(n.pos)){n.pos=Math.max(0,(w-1))*-1;n.animate()}else{if(w>=this.thumbnails.length+n.overflow+Math.abs(n.pos)){n.pos=this.thumbnails.length+n.overflow-w-1+(w==this.thumbnails.length-1?1:0);n.animate()}}})(this.carousel)}var C=this.getData(w).image;var q=this.controls.getActive();var y=this.controls.getNext();var s=y.isCached(C);if(q.image){this.toggleQuality(q.image,false)}var t=this.proxy(function(){this.queue.stalled=false;this.toggleQuality(y.image,z.image_quality);this.setStyle(q.elem,{zIndex:0});this.setStyle(y.elem,{zIndex:1});this.moveOut(q.image);this.controls.swap();if(this.getData(w).link){this.setStyle(y.image,{cursor:"pointer"});this.listen(y.image,"click",this.proxy(function(){if(z.popup_links){var n=m.open(this.getData(w).link,"_blank")}else{m.location.href=this.getData(w).link}}))}Array.prototype.shift.call(this.queue);if(this.queue.length){this.showImage()}this.playCheck()});if(typeof z.preload=="number"&&z.preload>0){var A,x=this.getNext();try{for(var v=z.preload;v>0;v--){A=new g();A.add(this.getData(x).image);x=this.getNext(x)}}catch(u){}}this.trigger({type:d.LOADSTART,cached:s,imageTarget:y.image,thumbTarget:this.thumbnails[w].image});y.load(C,this.proxy(function(n){y.scale(this.stageWidth,this.stageHeight,z.image_crop,z.max_scale_ratio,z.image_margin,this.proxy(function(o){this.toggleQuality(y.image,false);this.trigger({type:d.LOADFINISH,cached:s,imageTarget:y.image,thumbTarget:this.thumbnails[w].image});this.queue.stalled=true;var p=d.transitions[z.transition]||z.transition;if(typeof p=="function"){p.call(this,{prev:q.image,next:y.image,rewind:B,speed:z.transition_speed||400},t)}else{t()}}));this.setInfo(w);this.get("counter").innerHTML='<span class="current">'+(w+1)+'</span> / <span class="total">'+this.thumbnails.length+"</span>"}))},getNext:function(n){n=n||this.active;return n==this.data.length-1?0:n+1},getPrev:function(n){n=n||this.active;return n===0?this.data.length-1:n-1},next:function(){this.show(this.getNext(),false);return this},prev:function(){this.show(this.getPrev(),true);return this},get:function(n){return this.dom[n]||false},getData:function(n){return this.data[n]||this.data[this.active]},play:function(n){this.playing=true;this.playtime=n||this.playtime;this.playCheck();return this},pause:function(){this.playing=false;return this},playCheck:function(){if(this.playing){m.clearInterval(l);l=m.setTimeout(this.proxy(function(){if(this.playing){this.next()}}),this.playtime)}},setActive:function(n){this.active=n;return this},setInfo:function(o){var n=this.getData(o);var p=this.proxy(function(){this.loop(arguments,function(s){var q=this.get("info-"+s);var r=n[s]&&n[s].length?"reveal":"hide";this[r](q);q.innerHTML=n[s]})});p("title","description","author");return this},hasInfo:function(o){var n=this.getData(o);var p=n.title+n.description+n.author;return !!p.length},getDataObject:function(n){var p={image:"",thumb:"",title:"",description:"",author:"",link:""};return n?this.mix(p,n):p},jQuery:function(p){var o=[];this.loop(p.split(","),this.proxy(function(q){q=q.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.get(q)){o.push(q)}}));var n=jQuery(this.get(o.shift()));this.loop(o,this.proxy(function(q){n=n.add(this.get(q))}));return n},$:function(n){return this.jQuery(n)},toggleQuality:function(o,n){if(!d.IE7||typeof o=="undefined"||!o){return this}if(typeof n==="undefined"){n=o.style.msInterpolationMode=="nearest-neighbor"}o.style.msInterpolationMode=n?"bicubic":"nearest-neighbor";return this},load:function(){var q=0;var r=this.options;if((r.data_type=="auto"&&typeof r.data_source=="object"&&!(r.data_source instanceof jQuery)&&!r.data_source.tagName)||r.data_type=="json"||r.data_source.constructor=="Array"){this.data=r.data_source;this.trigger(d.DATA)}else{var p=jQuery(r.data_source).find(r.data_image_selector);var n=this.proxy(function(s){var t,u,o=s.parentNode;if(o&&o.nodeName=="A"){if(o.href.match(/\.(png|gif|jpg)/)){t=o.href}else{u=o.href}}var v=this.getDataObject({title:s.title,thumb:s.src,image:t||s.src,description:s.alt,link:u||s.getAttribute("longdesc")});return this.mix(v,r.data_config(s))});this.loop(p,function(o){q++;this.push(n(o),this.data);if(r.remove_original){o.parentNode.removeChild(o)}if(q==p.length){this.trigger(d.DATA)}})}}});d.log=function(){try{console.log.apply(console,Array.prototype.slice.call(arguments))}catch(n){try{opera.postError.apply(opera,arguments)}catch(o){alert(Array.prototype.join.call(arguments," "))}}};d.DATA="data";d.READY="ready";d.THUMBNAIL="thumbnail";d.LOADSTART="loadstart";d.LOADFINISH="loadfinish";var f=navigator.userAgent.toLowerCase();d.IE7=(m.XMLHttpRequest&&document.expando);d.IE6=(!m.XMLHttpRequest);d.IE=!!(d.IE6||d.IE7);d.WEBKIT=/webkit/.test(f);d.SAFARI=/safari/.test(f);d.CHROME=/chrome/.test(f);d.QUIRK=(d.IE&&document.compatMode&&document.compatMode=="BackCompat");d.MAC=/mac/.test(navigator.platform.toLowerCase());var k="";var j="";var i=false;var h="";d.themes={create:function(n){var o=["name","author","version","defaults","init"];var p=d.prototype;p.loop(o,function(r){if(!n[r]){d.raise(r+" not specified in theme.")}if(typeof d.themes[n.name]=="undefined"){d.themes[n.name]={}}if(r!="name"&&r!="init"){d.themes[n.name][r]=n[r]}});if(n.css){if(!k.length){var q=p.getElements("script");p.loop(q,function(r){var s=new RegExp("galleria."+n.name+".js");if(s.test(r.src)){k=r.src.replace(/[^\/]*$/,"")}})}n.cssPath=k+n.css;k=""}j=n.name;d.themes[n.name].init=function(t){if(n.cssPath){var s=p.getElements("#galleria-styles");if(s.length){s=s[0]}else{s=p.create("link");s.id="galleria-styles";s.rel="stylesheet";s.media="screen";p.getElements("head")[0].appendChild(s)}s.href=n.cssPath}if(n.cssText){p.cssText(n.cssText)}t=p.mix(d.themes[n.name].defaults,t);var r=new d(t);r.bind(d.DATA,function(){r.run()});r.bind(d.READY,function(){n.init.call(r,t);if(typeof t.extend=="function"){t.extend.call(r,t)}});r.load();return r}}};d.raise=function(n){if(d.debug){throw Error(n)}},d.loadTheme=function(o,n){i=true;k=o.replace(/[^\/]*$/,"");h=o;d.prototype.getScript(o,function(){i=false;if(typeof n=="function"){n()}})};jQuery.easing.galleria=function(r,q,n,o,p){if((q/=p/2)<1){return o/2*q*q*q*q+n}return -o/2*((q-=2)*q*q*q-2)+n};d.transitions={add:function(o,n){if(o!=arguments.callee.name){this[o]=n}},fade:function(o,n){jQuery(o.next).show().css("opacity",0).animate({opacity:1},o.speed,n);if(o.prev){jQuery(o.prev).css("opacity",1).animate({opacity:0},o.speed)}},flash:function(o,n){jQuery(o.next).css("opacity",0);if(o.prev){jQuery(o.prev).animate({opacity:0},(o.speed/2),function(){jQuery(o.next).animate({opacity:1},o.speed,n)})}else{jQuery(o.next).animate({opacity:1},o.speed,n)}},slide:function(q,n){var o=jQuery(q.next).parent();var p=this.$("images");var r=this.stageWidth;o.css({left:r*(q.rewind?-1:1)});p.animate({left:r*(q.rewind?1:-1)},{duration:q.speed,queue:false,easing:"galleria",complete:function(){p.css("left",0);o.css("left",0);n()}})},fadeslide:function(o,n){if(o.prev){jQuery(o.prev).css({opacity:1,left:0}).animate({opacity:0,left:50*(o.rewind?1:-1)},{duration:o.speed,queue:false,easing:"swing"})}jQuery(o.next).css({left:50*(o.rewind?-1:1),opacity:0}).animate({opacity:1,left:0},{duration:o.speed,complete:n,queue:false,easing:"swing"})}};d.flickr={key:null,options:{max:30,use_original:false,data_config:function(){}},setOptions:function(n){this.options=Galleria.prototype.mix(this.options,n);return this},search:function(o,q,n){this.key=o;var p={};var r=Galleria.prototype;q=r.mix({method:"flickr.photos.search",extras:"o_dims, url_t, url_m, url_o",sort:"interestingness-desc"},q);this.load(o,q,function(s){var w=s.photos.photo;var v=Math.min(this.options.max,w.length);for(var t=0;t<v;t++){var u=r.getDataObject({thumb:w[t].url_t,image:(w[t].url_o&&this.options.use_original)?w[t].url_o:w[t].url_m,title:w[t].title});r.push(r.mix(u,this.options.data_config(w[t])),p)}n(p)});return this},load:function(o,p,n){var r="http://api.flickr.com/services/rest/?";var q=this;p=$.extend({format:"json",jsoncallback:"?",api_key:o||this.key},p);jQuery.each(p,function(s,t){r+="&"+s+"="+t});jQuery.getJSON(r,function(s){if(s.stat=="ok"){n.call(q,s)}else{d.raise("Flickr data failed. Check API Key.")}});return this}};jQuery.fn.galleria=function(){var o=this.selector;var n=arguments;d.prototype.wait(function(){return !i},function(){var q=typeof n[0]=="string";var s=q?n[0]:j;var r=q?n[1]||{}:n[0]||{};r=d.prototype.mix(r,{target:o});d.debug=!!r.debug;if(typeof d.themes[s]=="undefined"){var p=s?"Theme "+s+" not found.":"No theme specified";d.raise(p);return null}else{return d.themes[s].init(r)}},function(){d.raise("Theme file "+h+" not found.")})}})();

