Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);this.parent(a)},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j)}}return c},set:function(b){for(var c in b){var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit)}}return this},start:function(c){if(!this.check(arguments.callee,c)){return this}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to}}return this.parent(h,j)}});var ImageMenu=new Class({getOptions:function(){return{OnOpen:$lambda(false),OnClose:$lambda(false),OnClickOpen:false,OnClickClose:false,openWidth:200,transition:Fx.Transitions.Quad.easeOut,duration:400,open:null,border:0}},initialize:function(b,a){this.setOptions(this.getOptions(),a);this.elements=$$(b);this.widths={};this.widths.closed=this.elements[0].getStyle("width").toInt();this.widths.openSelected=this.options.openWidth;this.widths.openOthers=Math.round(((this.widths.closed*this.elements.length)-(this.widths.openSelected+this.options.border))/(this.elements.length-1));this.fx=new Fx.Elements(this.elements,{wait:false,duration:this.options.duration,transition:this.options.transition});this.elements.each(function(d,c){d.addEvent("mouseenter",function(f){new Event(f).stop();this.reset(c);if(this.options.OnOpen){this.options.OnOpen(d,c)}}.bind(this));d.addEvent("mouseleave",function(f){new Event(f).stop();this.reset(this.options.open);if(this.options.OnClose){this.options.OnClose(d,c)}}.bind(this));var e=this;d.addEvent("click",function(f){if(e.options.OnClickOpen){new Event(f).stop();if(e.options.open==c){e.options.open=null;e.options.OnClickClose(this.href,c)}else{e.options.open=c;e.options.OnClickOpen(this.href,c)}}})}.bind(this));if(this.options.open!=null){if($type(this.options.open)=="number"){this.reset(this.options.open)}else{this.elements.each(function(d,c){if(d.id==this.options.open){this.reset(c)}},this)}}},reset:function(a){if($type(a)=="number"){var b=this.widths.openOthers;if(a+1==this.elements.length){b+=this.options.border}}else{var b=this.widths.closed}var c={};this.elements.each(function(f,e){var d=b;if(e==this.elements.length-1){d=b+5}c[e]={width:d}}.bind(this));if($type(a)=="number"){c[a]={width:this.widths.openSelected}}this.fx.start(c)}});ImageMenu.implement(new Options);ImageMenu.implement(new Events);var horseGallery=new Class({Implements:[Events,Options],options:{overallContainer:null,elementScrolled:null,thumbsContainer:null,itemsSelector:null,itemsVisible:4,elemsSlide:null,itemWidth:null,itemHeight:null,navs:{allv:"horseGalleryAllButton",fwd:"horseGalleryNextButton",bk:"horseGalleryPrevButton"},showControls:1,transition:Fx.Transitions.linear,duration:800,direction:1,autoSlide:false,mouseWheelNav:false,startIndex:null,baseHeight:0},initialize:function(a){this.setOptions(a);this.elements=$(this.options.thumbsContainer).getElements(this.options.itemsSelector);this.totalElements=this.elements.length;if(this.totalElements<=this.options.itemsVisible){return}var b=this.elements[0].getSize();this.elementWidth=this.options.itemWidth||b.x;this.elementHeight=this.options.itemHeight||b.y;this.currentElement=0;this.direction=this.options.direction;this.autoSlideTotal=this.options.autoSlide+this.options.duration;if(this.options.elemsSlide==1){this.options.elemsSlide=null}this.begin()},begin:function(){this.addControls();this.setContainersSize();this.myFx=new Fx.Tween(this.options.thumbsContainer,{property:(this.options.slideVertical?"margin-top":"margin-left"),wait:true,transition:this.options.transition,duration:this.options.duration});if(this.options.mouseWheelNav&&!this.options.autoSlide){$(this.options.thumbsContainer).addEvent("mousewheel",function(b){new Event(b).stop();this.slide(-b.wheel)}.bind(this))}if(this.options.startIndex&&this.options.startIndex>0&&this.options.startIndex<this.elements.length){for(var a=1;a<this.options.startIndex;a++){this.rearange()}}if(this.options.autoSlide&&this.elements.length>this.options.itemsVisible){this.startAutoSlide()}},resetStart:function(c){if((parseInt(c)>=0&&parseInt(c)<this.elements.length)&&(parseInt(c)!=this.currentElement)){this.options.startIndex=c;if(this.options.startIndex>this.currentElement){var a=this.options.startIndex-this.currentElement}else{var a=(this.elements.length-this.currentElement)+this.options.startIndex}for(var b=0;b<a;b++){this.rearange()}}},resetAll:function(){var a=document.id(this.options.overallContainer).getStyle("height");var b=this.options.baseHeight;new Fx.Morph(this.options.overallContainer,{duration:500,onComplete:function(){$(this.options.overallContainer).removeProperty("style");$(this.options.elementScrolled).removeProperty("style");$(this.options.thumbsContainer).removeProperty("style");this.initialize();document.id(this.options.navs.bk).setStyle("display","block");document.id(this.options.navs.fwd).setStyle("display","block");this.allv.getElement("img").set("src","/images/horse-gallery-viewall.png");this.allv.getElement("img").setStyle("bottom","-10px")}.bindWithEvent(this)}).start({height:[a,b]})},setContainersSize:function(){var d={};var c={};var a={};var b=0;c.width=this.options.itemsVisible*this.elementWidth;a.width=this.totalElements*(this.elementWidth+10);$(this.options.elementScrolled).set({styles:c});$(this.options.thumbsContainer).set({styles:a})},addControls:function(){if(!this.options.showControls||this.elements.length<=this.options.itemsVisible){return}this.allv=document.id(this.options.navs.allv);this.fwd=document.id(this.options.navs.fwd);this.bkwd=document.id(this.options.navs.bk);if(this.allv){this.allv.removeEvents("click");this.allv.addEvent("click",function(a){a=new Event(a).stop()});this.allv.addEvent("click",this.extend.pass(1,this))}if(this.fwd){this.fwd.addEvent("click",function(a){a=new Event(a).stop()});this.fwd.addEvent("click",this.slide.pass(1,this))}if(this.bkwd){this.bkwd.addEvent("click",function(a){a=new Event(a).stop()});this.bkwd.addEvent("click",this.slide.pass(-1,this))}},extend:function(){var c=this.options.itemsVisible*(this.elementWidth+10);var a=document.id(this.options.overallContainer).getStyle("height");this.options.baseHeight=a;document.id(this.options.overallContainer).setStyle("height",a);document.id(this.options.elementScrolled).setStyles({width:c+"px"});document.id(this.options.thumbsContainer).setStyles({width:c+"px"});var b=parseInt(document.id(this.options.thumbsContainer).getStyle("height"))+20;new Fx.Morph(this.options.overallContainer,{duration:500}).start({height:[a,b]});document.id(this.options.navs.bk).setStyle("display","none");document.id(this.options.navs.fwd).setStyle("display","none");this.allv.getElement("img").set("src","/images/horse-gallery-shrink.png");this.allv.getElement("img").setStyle("bottom","-2px");this.allv.removeEvents("click");this.allv.addEvent("click",function(d){d=new Event(d).stop()});this.allv.addEvent("click",this.resetAll.pass(1,this))},slide:function(d){if(this.started){return}this.direction=d?d:this.direction;var a=this.currentIndex();if(this.options.elemsSlide&&this.options.elemsSlide>1&&this.endingElem==null){this.endingElem=this.currentElement;for(var b=0;b<this.options.elemsSlide;b++){this.endingElem+=d;if(this.endingElem>=this.totalElements){this.endingElem=0}if(this.endingElem<0){this.endingElem=this.totalElements-1}}}var c=new Hash();var e=0;c.include("margin-left",-this.elementWidth);e=this.direction==1?-this.elementWidth:0;if(this.direction==-1){this.rearange();$(this.options.thumbsContainer).setStyles(c)}this.started=true;this.myFx.start(e).chain(function(){this.rearange(true);if(this.options.elemsSlide){if(this.endingElem!==this.currentElement){if(this.options.autoSlide){this.stopAutoSlide()}this.slide(this.direction)}else{if(this.options.autoSlide){this.startAutoSlide()}this.endingElem=null}}}.bind(this));this.fireEvent("onChange",a)},rearange:function(a){if(a){this.started=false}if(a&&this.direction==-1){return}this.currentElement=this.currentIndex(this.direction);var b=new Hash();if(this.options.slideVertical){b.include("margin-top",0)}else{b.include("margin-left",0)}$(this.options.thumbsContainer).setStyles(b);if(this.currentElement==1&&this.direction==1){this.elements[0].injectAfter(this.elements[this.totalElements-1]);return}if((this.currentElement==0&&this.direction==1)||(this.direction==-1&&this.currentElement==this.totalElements-1)){this.rearrangeElement(this.elements.getLast(),this.direction==1?this.elements[this.totalElements-2]:this.elements[0]);return}if(this.direction==1){this.rearrangeElement(this.elements[this.currentElement-1],this.elements[this.currentElement-2])}else{this.rearrangeElement(this.elements[this.currentElement],this.elements[this.currentElement+1])}},rearrangeElement:function(b,a){this.direction==1?b.injectAfter(a):b.injectBefore(a)},currentIndex:function(){var a=null;switch(this.direction){case 1:a=this.currentElement>=this.totalElements-1?0:this.currentElement+this.direction;break;case -1:a=this.currentElement==0?this.totalElements-1:this.currentElement+this.direction;break}return a},startAutoSlide:function(){this.startIt=this.slide.bind(this).pass(this.direction|1);this.autoSlide=this.startIt.periodical(this.autoSlideTotal,this);this.isRunning=true;this.elements.addEvents({mouseenter:function(){$clear(this.autoSlide);this.isRunning=false}.bind(this),mouseleave:function(){this.autoSlide=this.startIt.periodical(this.autoSlideTotal,this);this.isRunning=true}.bind(this)})},stopAutoSlide:function(){$clear(this.autoSlide);this.isRunning=false}});var Imagebox=new Class({Implements:[Options,Events],options:{overlayOpacity:0.75,topPosition:20,initialWidth:770,initialHeight:570,canvasBorderWidth:"0px",canvasBorderColor:"#000000",canvasPadding:"0px",resizeDuration:400,resizeTransition:"sine:in:out",autoPlay:false,autoPlayDelay:5,removeTitle:false,onXmlGalleries:$empty,onClosed:$empty,onFileReady:$empty},initialize:function(a){this.setOptions(a);this.autoPlayBkup={autoPlayDelay:this.options.autoPlayDelay,autoPlay:this.options.autoPlay};this.fullOptionsBkup={};this.galleries=[];this.families=[];this.xmlFiles=[];this.loadedImages=[];this.currentFile=null;this.currentIndex=null;this.currentGallery=null;this.currentRequest=null;this.currentResponse=null;this.mode=null;this.closed=true;this.busy=true;this.paused=true;this.fileReady=false;this.eventsok=false;this.first=true;this.intObj=null;this.formtags=null;this.prepareGalleries();if(this.galleries.length==0){return}this.initImagebox();this.saveOptions()},initImagebox:function(){this.prepareHTML();this.prepareEffects();this.prepareEvents();this.formtags=$$("select",'textarea:not[name~="content content2"]');this.activated=true},openImagebox:function(b,c){this.closed=false;if(this.formtags.length!=0){this.formtags.setStyle("display","none")}this.overlay.setStyles({top:-$(window).getScroll().y,height:$(window).getScrollSize().y+$(window).getScroll().y});this.center.setStyle("top",$(window).getScroll().y+this.options.topPosition);this.currentGallery=b;this.currentIndex=c;this.overlay.tween("opacity",this.options.overlayOpacity);if(b.length==1){this.mode="singleFile";this.loadFile(b[c],c)}else{this.mode="fileGallery";var a=0;$$(this.prev,this.next,this.count,this.playpause).setStyle("display","block");var e=(c!=b.length-1)?b[c+1]:b[0];var f=(c!=0)?b[c-1]:b[b.length-1];var d=(f==e)?[f]:[f,e];this.loadFile(b[c],d)}},loadFile:function(c,b){this.fileReady=false;var a=this.checkFileType(c,"swf");if(!a){if(!this.loadedImages.contains(c.retrieve("href"))){this.container.addClass("mbLoading")}this.loadImage(c.retrieve("href"))}else{this.loadSwf(c)}if(b){this.preloadFiles(b)}},preloadFiles:function(a){a.each(function(d,b){var c=this.checkFileType(d.retrieve("href"),"swf");if(!c){this.preloadImage(d.retrieve("href"))}},this)},loadImage:function(b){var a=new Asset.image(b,{onload:function(c){if(!this.loadedImages.contains(b)){this.loadedImages.push(b)}this.currentFile=c;this.loadAux(this.currentFile)}.bindWithEvent(this)})},preloadImage:function(b){if(!this.loadedImages.contains(b)){var a=new Asset.image(b,{onload:function(c){this.loadedImages.push(b)}.bindWithEvent(this)})}},loadSwf:function(b){var a=new Swiff(b.retrieve("href"),{width:b.retrieve("width").toInt(),height:b.retrieve("height").toInt(),params:{wMode:"opaque",swLiveConnect:"false"}});this.currentFile=a;this.loadAux(b)},loadAux:function(a){this.fileReady=true;this.fireEvent("fileReady");this.showFile(a)},showFile:function(c){if(this.closed){return}this.center.setStyle("display","block");var f=new Hash();var g={};var j=null;var a=null;if(this.options.canvasBorderWidth.toInt()!=0&&this.canvas.getStyle("borderWidth").toInt()==0){j=this.options.canvasBorderWidth+" solid "+this.options.canvasBorderColor;this.canvas.setStyle("border",j)}if(this.options.canvasPadding.toInt()!=0&&this.canvas.getStyle("padding").toInt()==0){a=this.options.canvasPadding;this.canvas.setStyle("padding",a)}var m=this.canvas.getSize();var e=this.canvas.getStyle("borderWidth").toInt()*2+this.canvas.getStyle("padding").toInt()*2;if(!c.retrieve("width")){f=f.extend(c.getProperties("width","height")).map(function(d,b){return d.toInt()})}else{f.extend({height:c.retrieve("height").toInt(),width:c.retrieve("width").toInt()})}var l=new Hash(this.center.getStyles("width","height")).map(function(d,b){return d.toInt()});if(f.width!=l.width){g.width=f.width+e;g.marginLeft=-(g.width/2).round()-10}var k=(m.y-e>0)?l.height-m.y:0;g.height=f.height+e+k;var h=((m.y/2)-((f.height+this.description.getStyle("height").toInt())/2));c.setStyle("margin-top",h+"px");this.container.removeClass("mbLoading");var i=0;if(this.first){i=500;this.first=false}(function(){this.center.morph()}).delay(i,this)},showGallery:function(a){if(!a||!a.gallery){return}var c=($chk(a.index))?a.index:0;var b=this.getGallery(a.gallery);var f=false;var e;if(a.autoplay||(b.options&&b.options.autoplay)){f=true}if(b!=-1&&!this.opened){if(f){e=(a&&a.delay)?a.delay:(b.options&&b.options.delay)?b.options.delay:this.autoPlayDelay;this.startAutoPlay({gallery:b,index:c,delay:e})}else{this.openImagebox(b,c)}}},addGalleries:function(a){this.currentRequest=new Request({method:"get",autoCancel:true,url:a,onRequest:function(){}.bindWithEvent(this),onSuccess:function(d,b){var c=d.replace(/(<a.+)\/>/gi,"$1></a>");this.setGalleries(new Element("div",{html:c}),a)}.bindWithEvent(this),onFailure:function(b){alert("Imagebox :: addGalleries: XML file path error or local Ajax test: please test addGalleries() on-line")}});this.currentRequest.send()},setGalleries:function(d,f){if(!this.xmlFiles.contains(f)){this.xmlFiles.push(f)}var g=d;var b=g.getElements(".gallery");var e=[];var a=[];b.each(function(h,j){var m={gallery:h.getProperty("name"),autoplay:Boolean(h.getProperty("autoplay")),delay:Number(h.getProperty("delay"))};var c=h.getChildren("a");var k=c.map(function(i){return i.setProperty("rel","imagebox["+m.gallery+"]")});e.push(k);if(m.autoplay){a.push(m)}});this.prepareGalleries(e.flatten());this.setAutoPlay(a);if(!this.activated){this.initImagebox()}this.fireEvent("xmlGalleries")},checkFileType:function(b,c){var a=null;if($type(b)!="string"){a=b.retrieve("href")}else{a=b}var d=new RegExp(".("+c+")$","i");return a.split("?")[0].test(d)},getGallery:function(a){var d=null;if(a.test(/^imagebox/i)){d=this.families}else{d=this.families.map(function(g){var h=g.trim();var e=h.slice(0,h.length).substr(8);var f=e.replace(/(.+)]$/,"$1");return f})}var b=d.indexOf(a);var c=(b!=-1)?this.galleries[b]:b;return c},setFileProps:function(c,a){var b=a.split(",");b.each(function(f,e){var d=f.trim().split(":");c.store(d[0].trim(),d[1].trim())},this)},changeOptions:function(a){if(!a){return}this.setOptions(a);this.center.get("morph").setOptions({transition:this.options.resizeTransition,duration:this.options.resizeDuration})},saveOptions:function(a){if($chk(a)){this.fullOptionsBkup=a}else{this.fullOptionsBkup=this.options}},restoreOptions:function(){this.setOptions(this.fullOptionsBkup);this.center.get("morph").setOptions({transition:this.options.resizeTransition,duration:this.options.resizeDuration})},reloadGalleries:function(){this.galleries=[];this.families=[];this.formtags=$$("select","textarea");this.prepareGalleries();this.removeGalleriesEvents();this.setGalleriesEvents();if(this.xmlFiles.length==0){return}this.xmlFiles.each(function(b,a){this.addGalleries(b)}.bind(this))},setAutoPlay:function(b){var a=($type(b)=="object")?[b]:b;a.each(function(f){var e=this.getGallery(f.gallery);if(e==-1){return}var c=(f.autoplay==true)?f.autoplay:false;var h=($chk(f.delay)&&c)?f.delay:this.options.autoPlayDelay;e.options={autoplay:c,delay:h}},this)},startAutoPlay:function(b){var c=-1;var a,e;if(b&&b.gallery){if($type(b.gallery)=="array"){c=b.gallery}else{if($type(b.gallery)=="string"){c=this.getGallery(b.gallery)}}}if(c==-1){c=this.galleries[0]}e=(b&&b.delay&&($type(b.delay)=="number"))?b.delay*1000:(c.options&&c.options.delay)?c.options.delay*1000:this.options.autoPlayDelay*1000;a=(b&&b.index&&($type(b.index)=="number"))?b.index:0;if(e<this.options.resizeDuration*2){e=this.options.resizeDuration*2}this.options.autoPlayDelay=e/1000;if(!this.options.autoPlay){this.setOptions({autoPlay:true,autoPlayDelay:this.options.autoPlayDelay})}if(this.closed){this.openImagebox(c,a);if(this.mode!="fileGallery"){return}this.addEvent("fileReady",function(){this.intObj=this.next_prev_aux.periodical(e,this,[null,"next"]);this.removeEvents("fileReady")}.bindWithEvent(this))}else{if(!this.closed){this.next_prev_aux(null,"next")}this.intObj=this.next_prev_aux.periodical(e,this,[null,"next"])}this.paused=false},stopAutoPlay:function(){if(this.intObj){$clear(this.intObj);this.intObj=null}this.playpause.setStyle("backgroundPosition","0 0");this.next.setStyles({visibility:"visible",display:"block"});this.prev.setStyles({visibility:"visible",display:"block"});this.paused=true},removeGalleriesEvents:function(){this.galleries.each(function(a){$$(a).removeEvents("click")},this)},setGalleriesEvents:function(){this.galleries.each(function(a){$$(a).addEvent("click",function(d){var b=($(d.target).match("a"))?$(d.target):$(d.target).getParent("a");d.preventDefault();var c=this.getGallery(b.rel);if(c.options&&c.options.autoplay){this.setOptions({autoPlay:c.options.autoplay,autoPlayDelay:c.options.delay})}if(this.options.autoPlay){this.startAutoPlay({gallery:a,index:a.indexOf(b)})}else{this.openImagebox(a,a.indexOf(b))}}.bindWithEvent(this))},this)},prepareEvents:function(a){this.setGalleriesEvents();this.next.addEvent("click",this.next_prev_aux.bindWithEvent(this,"next"));this.prev.addEvent("click",this.next_prev_aux.bindWithEvent(this,"prev"));$(window.document).addEvent("keydown",function(b){if(this.mode!="fileGallery"||this.busy==true){return}if(b.key=="right"||b.key=="space"){this.next_prev_aux(b,"next")}else{if(b.key=="left"){this.next_prev_aux(b,"prev")}else{if(b.key=="esc"){this.closeImagebox()}}}}.bindWithEvent(this));this.playpause.addEvents({click:function(){if(this.paused==false){this.stopAutoPlay();this.paused=true;this.playpause.setStyle("backgroundPosition","0 0")}else{var b=(this.currentGallery.options&&this.currentGallery.options.delay)?this.currentGallery.options.delay:this.options.autoPlayDelay;this.startAutoPlay({gallery:this.currentGallery,index:this.currentIndex+1,delay:b});this.paused=false;this.playpause.setStyle("backgroundPosition","0 -29px");this.next.setStyles({visibility:"hidden",display:"none"});this.prev.setStyles({visibility:"hidden",display:"none"})}}.bindWithEvent(this)});this.overlay.get("tween").addEvent("onComplete",function(){if(this.overlay.getStyle("opacity")==this.options.overlayOpacity){this.center.tween("opacity",1)}else{if(this.overlay.getStyle("opacity")==0){this.overlay.setStyles({height:0,top:""})}}}.bindWithEvent(this));this.center.get("morph").addEvent("onComplete",function(){if($type(this.currentFile)=="element"){this.canvas.grab(this.currentFile)}else{(function(){this.canvas.grab(this.currentFile)}).delay(500,this)}this.canvas.tween("opacity",1);var c=(!(this.mode=="showThisImage"))?this.currentGallery[this.currentIndex].retrieve("title"):this.specialDescription;if($chk(c)){this.description.innerHTML=c}if(this.mode=="fileGallery"){this.count.set("html","Photo "+(this.currentIndex+1)+" of "+this.currentGallery.length)}var b=this.center.getStyle("height").toInt();this.center.retrieve("setFinalHeight").start(b,b)}.bindWithEvent(this));this.center.retrieve("setFinalHeight").addEvent("onComplete",function(){if(this.paused==true){this.prev.setStyles({visibility:"visible",display:"block"});this.next.setStyles({visibility:"visible",display:"block"})}this.playpause.setStyles({visibility:"visible",display:"block"});$$(this.description,this.navigation).setStyle("visibility","visible");var b=$(window).getScrollSize().y;var c=$(window).getScroll().y;this.overlay.setStyles({height:b+c,top:-c});this.busy=false}.bindWithEvent(this));window.addEvent("resize",function(){if(this.overlay.getStyle("opacity")==0){return}var b=$(window).getScrollSize().y;var c=$(window).getScroll().y;this.overlay.setStyles({height:b+c,top:-c})}.bindWithEvent(this));$$(this.overlay,this.close).addEvent("click",function(){this.closeImagebox()}.bindWithEvent(this));this.eventsok=true},next_prev_aux:function(d,c){if(d){d.preventDefault();this.stopAutoPlay()}else{if(this.busy||!this.fileReady){return}}this.busy=true;var f=this.currentIndex;if(c=="next"){var a=(this.currentIndex!=this.currentGallery.length-1)?this.currentIndex+=1:this.currentIndex=0;var b=(this.currentIndex!=this.currentGallery.length-1)?this.currentIndex+1:0}else{var a=(this.currentIndex!=0)?this.currentIndex-=1:this.currentIndex=this.currentGallery.length-1;var b=(this.currentIndex!=0)?this.currentIndex-1:this.currentGallery.length-1}if(this.canvas.getElement("img")){this.canvas.getElement("img").dispose()}this.description.empty();this.next.setStyle("visibility","hidden");this.prev.setStyle("visibility","hidden");this.loadFile(this.currentGallery[a],[this.currentGallery[b]])},prepareEffects:function(){this.overlay.set("tween",{duration:"short",link:"cancel"});this.center.set("tween",{duration:"short",link:"chain"});this.center.set("morph",{duration:this.options.resizeDuration,link:"chain",transition:this.options.resizeTransition});this.center.store("setFinalHeight",new Fx.Tween(this.center,{property:"height",duration:"short"}));this.canvas.set("tween",{link:"chain"})},prepareGalleries:function(b){var a=[];var d;var c=(b)?b:$$("a");c.each(function(e){if(e.rel&&e.rel.test(/^imagebox/i)&&e.href.split("?")[0].test(/\.(gif|jpg|jpeg|png|swf)$/i)){if(e.rel.length>7&&!this.families.contains(e.rel)){this.families.push(e.rel)}a.push(e)}},this);a.each(function(e){$(e).store("href",e.href);$(e).store("rel",e.rel);$(e).store("title",e.title);if(this.checkFileType(e.href,"swf")){this.setFileProps($(e),e.rev)}if(this.options.removeTitle){$(e).removeProperty("title")}if(e.rel.length>7){this.families.each(function(k,j){if(e.rel==k){var g=false;var h;this.galleries.each(function(i,f){if(i[0].rel==k){g=true;h=f;return}});if(g==true){this.galleries[h].push($(e))}else{this.galleries.push([$(e)])}}},this)}else{this.galleries.push([$(e)])}},this)},prepareHTML:function(){this.overlay=new Element("div",{id:"mbOverlay",styles:{opacity:0,visibility:"visible",height:0,overflow:"hidden"}}).inject($(document.body));this.center=new Element("div",{id:"mbCenter",styles:{width:this.options.initialWidth,height:this.options.initialHeight,marginLeft:-(this.options.initialWidth/2),opacity:0}}).inject($(document.body));this.container=new Element("div",{id:"mbContainer"}).inject(this.center).addClass("mbLoading");this.canvas=new Element("div",{id:"mbCanvas"}).inject(this.container);this.bottom=new Element("div",{id:"mbBottom"}).inject(this.center);this.topEdge=new Element("div",{id:"mbTopEdge",styles:{width:"100%"}}).inject(this.container);this.topLeft=new Element("div",{id:"mbTopLeft",styles:{height:"100%"}}).inject(this.container);this.topRight=new Element("div",{id:"mbTopRight",styles:{height:"100%"}}).inject(this.container);this.topLeftC=new Element("div",{id:"mbTopLC"}).inject(this.container);this.topRightC=new Element("div",{id:"mbTopRC"}).inject(this.container);this.bottomEdge=new Element("div",{id:"mbBottomEdge",styles:{width:"100%"}}).inject(this.bottom);this.bottomLeft=new Element("div",{id:"mbBottomLeft",styles:{height:"100%"}}).inject(this.bottom);this.bottomRight=new Element("div",{id:"mbBottomRight",styles:{height:"100%"}}).inject(this.bottom);this.bottomLeftC=new Element("div",{id:"mbBottomLC"}).inject(this.bottom);this.bottomRightC=new Element("div",{id:"mbBottomRC"}).inject(this.bottom);this.navigation=new Element("div",{id:"mbNavigation"}).setStyle("visibility","hidden");this.description=new Element("div",{id:"mbDescription"}).inject(this.canvas);this.close=new Element("a",{id:"mbCloseLink"}).inject(this.bottom);this.next=new Element("a",{id:"mbNextLink"}).inject(this.bottom).setStyle("visibility","hidden");this.prev=new Element("a",{id:"mbPrevLink"}).inject(this.bottom).setStyle("visibility","hidden");this.playpause=new Element("a",{id:"mbPlayPause"}).inject(this.bottom).setStyle("visibility","hidden");this.count=new Element("div",{id:"mbCount"}).inject(this.container)},closeImagebox:function(){this.cancelAllEffects();this.stopAutoPlay();this.setOptions(this.autoPlayBkup);this.currentFile=null;this.currentIndex=null;this.currentGallery=null;this.currentRequest=null;this.currentResponse=null;$$(this.prev,this.next,this.playpause,this.count).setStyle("display","none");this.playpause.setStyle("backgroundPosition","0 0");var a=this.center.getStyle("border-right-width").toInt();var b=this.close.getSize().x+a;this.navigation.setStyles({width:b,height:"",visibility:"hidden"});this.description.setStyle("margin-right",b);this.description.empty();this.canvas.setStyles({opacity:0,width:"",height:""});if(this.canvas.getElement("img")){this.canvas.getElement("img").dispose()}this.count.empty();this.center.setStyles({opacity:0,width:this.options.initialWidth,height:this.options.initialHeight,marginLeft:-(this.options.initialWidth/2),display:"none"});this.overlay.tween("opacity",0);if(this.formtags.length!=0){this.formtags.setStyle("display","")}this.mode=null;this.closed=true;this.first=true;this.fileReady=false;this.fireEvent("closed")},cancelAllEffects:function(){this.overlay.get("tween").cancel();this.center.get("morph").cancel();this.center.get("tween").cancel();this.center.retrieve("setFinalHeight").cancel();this.canvas.get("tween").cancel()}});window.addEvent("domready",function(){Imagebox=new Imagebox();new Asset.images(["/images/imagebox/edge-t.png","/images/imagebox/edge-b.png","/images/imagebox/edge-l.png","/images/imagebox/edge-r.png","/images/imagebox/corner-tl.png","/images/imagebox/corner-tr.png","/images/imagebox/corner-bl.png","/images/imagebox/corner-br.png","/images/imagebox/loading.gif","/images/imagebox/prev-photo.png","/images/imagebox/next-photo.png","/images/imagebox/close.png","/images/imagebox/play-pause.png"])});window.addEvent("domready",function(){var b=new Array();b.push("/images/photo-loading.gif");b.push("/images/horse-gallery-fill.png");b.push("/images/header-menu-highlight.png");b.push("/images/imageMenu/stallions-hover.png");b.push("/images/imageMenu/broodmares-hover.png");b.push("/images/imageMenu/salehorses-hover.png");b.push("/images/horse-gallery-viewall.png");$$(".hoverLink").each(function(f){f.removeEvents("mouseenter");f.removeEvents("mouseleave");var g=f.getElement("img").get("src");var e=g.substr(0,g.length-4);var d=g.substr(g.length-4);f.addEvent("mouseenter",function(){f.getElement("img").set("src",e+"-over"+d)});f.addEvent("mouseleave",function(){f.getElement("img").set("src",e+d)});b.push(e+"-over"+d)});var a=new Asset.images(b);if(document.id("pageContentRegion")){document.id("pageContentRegion").getElements(".imageHeading").each(function(d){d.setStyle("display","none")});document.id("pageContentRegion").getElements(".headingImage").each(function(d){d.setStyle("display","block")})}if(document.id("refreshCaptcha")){document.id("refreshCaptcha").addEvent("click",function(d){d=new Event(d).stop()});document.id("refreshCaptcha").addEvent("click",function(){document.id("captchaImage").setProperty("src","/images/captcha.php?width=80&height=35&characters=4&request="+dateStamp())})}if(Browser.Engine.trident||Browser.Engine.presto){var c=new Element("span",{id:"testEl",styles:{visibility:"hidden"}});c.inject(document.body);document.id("headerMenu").getElements("li ul").each(function(d){maxWidth=0;parentWidth=parseInt(d.getParent("li").getComputedSize()["width"]);parentWidth+=parseInt(d.getParent("li").getStyle("padding-left"));parentWidth+=parseInt(d.getParent("li").getStyle("padding-right"));d.getElements("li a").each(function(f){document.id("testEl").set("html",f.get("html"));var e=document.id("testEl").getComputedSize()["width"];e+=parseInt(f.getStyle("padding-left"));e+=parseInt(f.getStyle("padding-right"));if(e>maxWidth){maxWidth=e}});if(maxWidth<=parentWidth){newWidth=parentWidth}else{if(maxWidth>parentWidth){newWidth=maxWidth}}if(newWidth>0){d.getElements("li a").each(function(e){e.setStyle("width",newWidth+"px")});d.getElements("li").each(function(e){e.setStyle("width",(newWidth+5)+"px")});d.setStyle("width",(newWidth+5)+"px")}});$("testEl").dispose()}if(document.id("galleryContainer")){pgallery=new horseGallery({overallContainer:"galleryContainer",elementScrolled:"galleryContainer_slide",thumbsContainer:"galleryContainer_blocks",itemsVisible:1,elemsSlide:1,duration:300,itemsSelector:".galleryContainer_block",itemWidth:595,showControls:1,startIndex:1,navs:{fwd:"galMoreNext",bk:"galMorePrev"}})}});function changePage(a,b,d){var c=document.getElementById(b).value;if(c==d){return}window.open(a+c,"_self")}function dateStamp(){var a=new Date();return a.getTime()};var menuSelected;var menuSlider;var menuMover;var menuSizer;window.addEvent("domready",function(){if(document.id("headerMenuSlider")){menuSelected=document.id("headerMenu").getElement("li.mSelected");if(menuSelected==""||menuSelected==null){}menuSlider=document.id("headerMenuSlider");menuSlider.setStyles({display:"block"});menuMover=new Fx.Move(menuSlider,{duration:200,relativeTo:menuSelected,link:"cancel",position:"left top",offset:{x:0,y:-1}});menuSizer=new Fx.Morph(menuSlider,{duration:200,link:"cancel"});menuHome();document.id("headerMenu").getElements("li").each(function(a){a.addEvent("mouseenter",function(){menuSlide(a)}.bindWithEvent(a));a.addEvent("mouseleave",function(){menuHome()})})}});function menuHome(){menuMover.start();menuSizer.start({width:parseInt(menuSelected.getStyle("width"))+"px"})}function menuSlide(a){var b=a.getStyle("width");menuMover.start({relativeTo:a});menuSizer.start({width:parseInt(b)+"px"})};window.addEvent("domready",function(){if(document.id("horseGalleryViewAll")){gallery=new horseGallery({overallContainer:"horseGallery_outer",elementScrolled:"horseGallery_inner",thumbsContainer:"horseGallery_items",itemsVisible:4,elemsSlide:4,duration:300,itemsSelector:".horseGallery_element",itemWidth:191,showControls:1,startIndex:1})}if(document.id("spGallery_outer")){spgallery=new horseGallery({overallContainer:"spGallery_outer",elementScrolled:"spGallery_inner",thumbsContainer:"spGallery_items",itemsVisible:1,elemsSlide:1,duration:500,itemsSelector:".spGallery_element",itemWidth:167,showControls:1,startIndex:1,autoSlide:7000,navs:{fwd:"spGalleryNext",bk:"spGalleryPrev"}})}if(document.id("bpGallery_outer")){spgallery=new horseGallery({overallContainer:"bpGallery_outer",elementScrolled:"bpGallery_inner",thumbsContainer:"bpGallery_items",itemsVisible:1,elemsSlide:1,duration:500,itemsSelector:".bpGallery_element",itemWidth:167,showControls:1,startIndex:1,autoSlide:7000,navs:{fwd:"bpGalleryNext",bk:"bpGalleryPrev"}})}if(document.id("hpGallery_outer")){spgallery=new horseGallery({overallContainer:"hpGallery_outer",elementScrolled:"hpGallery_inner",thumbsContainer:"hpGallery_items",itemsVisible:1,elemsSlide:1,duration:500,itemsSelector:".hpGallery_element",itemWidth:167,showControls:1,startIndex:1,autoSlide:7000,navs:{fwd:"hpGalleryNext",bk:"hpGalleryPrev"}})}if(document.id("imageMenuAdvanced")){var c=location.href.replace("http://","").replace(".php","").split("/");var b=0;switch(c[2]){case"stallions":b=0;break;case"broodmares":b=1;break;case"sale-horses":b=2;break}var a=new ImageMenu($$("#imageMenuAdvanced a"),{openWidth:780,duration:1000,border:1,open:b});var d=new TipsSwitch(".menuTip",{className:"hmenutip"});$$(".menuTip").each(function(g){var f=g.retrieve("tip:text");var e=g.retrieve("tip:title");g.store("tip:title","");g.store("tip:text",new Element("img",{src:f,alt:e}).setStyles({position:"absolute",top:"0",left:"0"}))});if(document.id("horseGallery_items")){document.id("horseGallery_items").getElements("a[rel=showHorse").each(function(e){if(!e.hasClass("horseSelected")){e.getElement("img").setStyle("opacity",0.8);e.addEvent("mouseenter",function(){e.getElement("img").setStyle("opacity",1)});e.addEvent("mouseleave",function(){e.getElement("img").setStyle("opacity",0.8)})}})}}if(document.id("horseDetailsMenu")){document.id("horseDetailsMenu").getElements("a").each(function(e){e.addEvent("click",function(){horseTab(e);return false})})}});function horseTab(a){if(a.getParent("li").hasClass("hDMSelect")){return false}document.id("horseDetailsMenu").getElements("li").each(function(b){b.removeClass("hDMSelect")});document.id("horseDetailsContent").getElements("div.tabContent").each(function(b){b.setStyle("display","none")});document.id("horseDetails"+a.get("rel")).setStyle("display","block");a.getParent("li").addClass("hDMSelect")}var TipsSwitch=new Class({Extends:Tips,position:function(e){if(!this.tip){document.id(this)}var b=window.getSize(),a=window.getScroll(),f={x:this.tip.offsetWidth,y:this.tip.offsetHeight},c={x:"left",y:"top"},g={};var d=1;for(var h in c){g[c[h]]=e.page[h]+this.options.offset[h];if((g[c[h]]+f[h]-a[h])>b[h]-this.options.windowPadding[h]){g[c[h]]=e.page[h]-this.options.offset[h]-f[h];if(d==1){if(this.tip.getElement("img")){this.tip.getElement("img").setStyles({top:"-45px",right:"0",left:"auto"})}}}else{if(d==1){if(this.tip.getElement("img")){this.tip.getElement("img").setStyles({top:"0",right:"auto",left:"0"})}}}d++}this.tip.setStyles(g)}});var validationFields=Array();var errorColour="#FFFFFF";var standardColour="#d8c686";var formProcessing=false;var formSuccess='<div class="successMessage">Thankyou, your enquiry was sent successfully</div>';var formOkay=true;window.addEvent("domready",function(){if($("enquirySend")){standardColour=$("phoneField").getStyle("border-color");new Asset.images(["images/button-send-enquiry.png","images/button-wait-enquiry.png"]);enquiryInitialise()}});function enquiryInitialise(){if($("enquirySend")){$("enquirySend").addEvent("click",function(b){b=new Event(b).stop()});$("enquirySend").addEvent("click",function(){validateEnquiry()})}var a=0;$$(".validateField").each(function(c){var d=c.getProperty("id");var b=d+"Error";validationFields[a]=d;$(d).addEvent("blur",function(){if($(b).get("style","height")!="15px"&&($(d).get("value")==""||$(d).get("value")==null)){$(b).morph({height:"15px",opacity:"1"});$(b).setStyle("display","block");$(d).morph({"border-color":errorColour})}else{if($(b).get("style","height")>"0"&&$(d).get("value")!=""&&$(d).get("value")!=null){$(b).morph({height:"0",opacity:"0"});$(d).morph({"border-color":standardColour})}}});a++});addContactValidation("phoneField");addContactValidation("emailField");if(document.id("enquiryField")){new AutoGrow(document.id("enquiryField"))}}function addContactValidation(a){if($(a)){$(a).addEvent("blur",function(){if($(a+"Error").get("style","height")!="15px"&&($("phoneField").get("value")==""||$("phoneField").get("value")==null)&&($("emailField").get("value")==""||$("emailField").get("value")==null)){$("phoneFieldError").morph({height:"15px",opacity:"1"});$("phoneFieldError").setStyle("display","block");$("phoneField").morph({"border-color":errorColour});$("emailFieldError").morph({height:"15px",opacity:"1"});$("emailFieldError").setStyle("display","block");$("emailField").morph({"border-color":errorColour})}else{if($(a+"Error").get("style","height")>"0"&&$(a).get("value")!=""&&$(a).get("value")!=null){$("phoneFieldError").morph({height:"0",opacity:"0"});$("phoneField").morph({"border-color":standardColour});$("emailFieldError").morph({height:"0",opacity:"0"});$("emailField").morph({"border-color":standardColour})}}})}}function validateEnquiry(){if(formProcessing==false){$("enquirySend").set("src","images/button-wait-enquiry.png");formProcessing=true;formOkay=true;validationFields.each(function(d){if($(d).get("value")==""||$(d).get("value")==null){$(d+"Error").morph({height:"15px",opacity:"1"});$(d+"Error").setStyle("display","block");$(d).morph({"border-color":errorColour});formOkay=false}});if($("phoneFieldError").get("style","height")!="15px"&&($("phoneField").get("value")==""||$("phoneField").get("value")==null)&&($("emailField").get("value")==""||$("emailField").get("value")==null)){$("phoneFieldError").morph({height:"15px",opacity:"1"});$("phoneFieldError").setStyle("display","block");$("phoneField").morph({"border-color":errorColour});$("emailFieldError").morph({height:"15px",opacity:"1"});$("emailFieldError").setStyle("display","block");$("emailField").morph({"border-color":errorColour});formOkay=false}if(formOkay==false){$("enquirySend").set("src","images/button-send-enquiry.png");formProcessing=false;alert("A problem was encountered sending your form.\nSome mandatory fields still require information.")}else{var a=$("formURL").get("value");var c=$("enquiryForm").toQueryString();var b=new Request({url:a,onRequest:function(){$$(".waitItem").each(function(d){d.morph(".waitingTitle")});$$(".waitField").each(function(d){d.morph(".waitingField");d.disabled=true})},onComplete:function(d){$("enquiryFormContainer").set("html",d);formProcessing=false;enquiryInitialise()},method:"post"}).send(c+"&mode=ajax")}}else{alert("Please wait while your enquiry is being processed")}}var AutoGrow=new Class({Implements:[Options,Events],options:{interval:333,margin:12,minHeight:0},initialize:function(a,b){this.textarea=$(a);this.options.minHeight=a.clientHeight;this.setOptions(b);this.dummy=new Element("div",{styles:{"overflow-x":"hidden",position:"absolute",top:0,left:"-9999px"}}).setStyles(this.textarea.getStyles("font-size","font-family","width","line-height","padding")).inject(document.body);this.resize.periodical(this.options.interval,this)},resize:function(){var c=this.textarea.get("value").replace(/\n|\r\n/g,"<br>X");if(this.dummy.get("html").toLowerCase()!=c.toLowerCase()){this.dummy.set("html",c);var b=this.dummy.getSize().y+this.options.margin;if(this.textarea.clientHeight!=b){var a=Math.max(this.options.minHeight,b);this.textarea.tween("height",a)}}}});Accordion.implement({showAll:function(){var b={};this.previous=-1;this.elements.each(function(f,a){b[a]={};this.fireEvent("onActive",[this.togglers[a],f]);for(var e in this.effects){b[a][e]=f[this.effects[e]]}},this);return this.start(b)},hideAll:function(){var b={};this.previous=-1;this.elements.each(function(f,a){b[a]={};this.fireEvent("onBackground",[this.togglers[a],f]);for(var e in this.effects){b[a][e]=0}},this);return this.start(b)}});function expandCollapse(){if($("expandAll")){$("expandAll").addEvent("click",function(){var b=new Accordion("h4.atStart","div.atStart",{opacity:false,start:"all-open",duration:200,onBackground:function(a){$("collapseAll").setStyle("display","none");$("expandAll").setStyle("display","block")}},$("linkCategoryArea"));b.showAll();if($("expandAll")){$("expandAll").setStyle("display","none")}if($("collapseAll")){$("collapseAll").setStyle("display","block")}})}if($("collapseAll")){$("collapseAll").addEvent("click",function(){var b=new Accordion("h4.atStart","div.atStart",{opacity:false,start:"all-closed",alwaysHide:true,duration:200},$("linkCategoryArea"));if($("collapseAll")){$("collapseAll").setStyle("display","none")}if($("expandAll")){$("expandAll").setStyle("display","block")}})}}window.addEvent("domready",function(){var d=new Array();var e=new TipsSwitch(".mediaTip",{className:"mediatip",offset:{x:20,y:-60}});$$(".mediaTip").each(function(g){var f=g.retrieve("tip:text");var a=g.retrieve("tip:title");g.store("tip:title","");g.store("tip:text",new Element("img",{src:f,alt:a}).setStyles({position:"absolute",top:"0",left:"0"}));d.push(f)});var c=new Asset.images(d);if($("mediaCategoryArea")){var b=new Accordion("h4.atStart","div.atStart",{opacity:false,start:"all-closed",alwaysHide:true,duration:200,onActive:function(a){a.addClass("mediaSelected");if(a.getElement("div.icon")){a.getElement("div.icon").addClass("mediaSelected")}},onBackground:function(a){a.removeClass("mediaSelected");if(a.getElement("div.icon")){a.getElement("div.icon").removeClass("mediaSelected")}}},$("mediaCategoryArea"))}if($("categoryListing")){$("categoryListing").addEvent("change",function(){$("selectCategory").submit()})}expandCollapse()});