(function(e){e.fn.extend({accordion:function(g,h){return this.each(function(){var i=e.data(this,"accordion");if(!i){e.data(this,"accordion",new e.ui.accordion(this,g))}else{if(typeof g=="string"){i[g](h)}}})}});e.ui.accordion=function(g,h){this.options=h=e.extend({},e.ui.accordion.defaults,h);this.element=e(g);if(h.navigation){var k=this.element.find("a").filter(h.navigationFilter);if(k.length){if(k.filter(h.header).length){h.active=k}else{h.active=k.parent().parent().prev();k.addClass("current")}}}h.headers=this.element.find(h.header);h.active=c(h.headers,h.active);if(!this.element.hasClass("ui-accordion")){this.element.addClass("ui-accordion");e("<span class='ui-accordion-left'/>").insertBefore(h.headers);e("<span class='ui-accordion-right'/>").appendTo(h.headers);h.headers.addClass("ui-accordion-header").attr("tabindex","0")}if(h.fillSpace){var j=this.element.parent().height();h.headers.each(function(){j-=e(this).outerHeight()});var i=0;h.headers.next().each(function(){i=Math.max(i,e(this).innerHeight()-e(this).height())}).height(j-i)}else{if(h.autoHeight){var j=0;h.headers.next().each(function(){j=Math.max(j,e(this).outerHeight())}).height(j)}}h.headers.not(h.active||"").next().hide();h.active.parent().andSelf().addClass(h.selectedClass);if(h.event){this.element.bind((h.event)+".accordion",f)}};e.ui.accordion.prototype={activate:function(g){f.call(this.element[0],{target:c(this.options.headers,g)[0]})},enable:function(){this.options.disabled=false},disable:function(){this.options.disabled=true},destroy:function(){this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","")}e.removeData(this.element[0],"accordion");this.element.removeClass("ui-accordion").unbind(".accordion")}};function b(h,g){return function(){return h.apply(g,arguments)}}function d(i){if(!e.data(this,"accordion")){return}var g=e.data(this,"accordion");var h=g.options;h.running=i?0:--h.running;if(h.running){return}if(h.clearStyle){h.toShow.add(h.toHide).css({height:"",overflow:""})}e(this).triggerHandler("accordionchange",[h.data],h.change)}function a(g,k,l,j,m){var i=e.data(this,"accordion").options;i.toShow=g;i.toHide=k;i.data=l;var h=b(d,this);i.running=k.size()==0?g.size():k.size();if(i.animated){if(!i.alwaysOpen&&j){e.ui.accordion.animations[i.animated]({toShow:jQuery([]),toHide:k,complete:h,down:m,autoHeight:i.autoHeight})}else{e.ui.accordion.animations[i.animated]({toShow:g,toHide:k,complete:h,down:m,autoHeight:i.autoHeight})}}else{if(!i.alwaysOpen&&j){g.toggle()}else{k.hide();g.show()}h(true)}}function f(l){var j=e.data(this,"accordion").options;if(j.disabled){return false}if(!l.target&&!j.alwaysOpen){j.active.parent().andSelf().toggleClass(j.selectedClass);var i=j.active.next(),m={instance:this,options:j,newHeader:jQuery([]),oldHeader:j.active,newContent:jQuery([]),oldContent:i},g=j.active=e([]);a.call(this,g,i,m);return false}var k=e(l.target);if(k.parents(j.header).length){while(!k.is(j.header)){k=k.parent()}}var h=k[0]==j.active[0];if(j.running||(j.alwaysOpen&&h)){return false}if(!k.is(j.header)){return}j.active.parent().andSelf().toggleClass(j.selectedClass);if(!h){k.parent().andSelf().addClass(j.selectedClass)}var g=k.next(),i=j.active.next(),m={instance:this,options:j,newHeader:k,oldHeader:j.active,newContent:g,oldContent:i},n=j.headers.index(j.active[0])>j.headers.index(k[0]);j.active=h?e([]):k;a.call(this,g,i,m,h,n);return false}function c(h,g){return g!=undefined?typeof g=="number"?h.filter(":eq("+g+")"):h.not(h.not(g)):g===false?e([]):h.filter(":eq(0)")}e.extend(e.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:"slide",event:"click",header:"a",autoHeight:true,running:0,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(g,i){g=e.extend({easing:"swing",duration:300},g,i);if(!g.toHide.size()){g.toShow.animate({height:"show"},g);return}var h=g.toHide.height(),j=g.toShow.height(),k=j/h;g.toShow.css({height:0,overflow:"hidden"}).show();g.toHide.filter(":hidden").each(g.complete).end().filter(":visible").animate({height:"hide"},{step:function(l){var m=(h-l)*k;if(e.browser.msie||e.browser.opera){m=Math.ceil(m)}g.toShow.height(m)},duration:g.duration,easing:g.easing,complete:function(){if(!g.autoHeight){g.toShow.css("height","auto")}g.complete()}})},bounceslide:function(g){this.slide(g,{easing:g.down?"bounceout":"swing",duration:g.down?1000:200})},easeslide:function(g){this.slide(g,{easing:"easeinout",duration:700})}}});e.fn.activate=function(g){return this.accordion("activate",g)}})(jQuery);;jQuery(document).ready(function(){createAccordion();jQuery.preloadImages(SKIN_URL+"images/media/custom-pages/home/hm_main0.jpg",SKIN_URL+"images/media/custom-pages/home/hm_main1.jpg",SKIN_URL+"images/media/custom-pages/home/hm_main2.jpg",SKIN_URL+"images/media/custom-pages/home/hm_main3.jpg");createImageFade()});jQuery.preloadImages=function(){for(var a=0;a<arguments.length;a++){jQuery('<img />').attr("src",arguments[a])}};function createAccordion(){var a={event:"mouseover",header:"a.linkOne"};jQuery("ul#accordionList").accordion(a);}
function createImageFade(){var b=SKIN_URL+"images/media/custom-pages/home/hm_main";var c=".jpg";var d=0;var a=false;jQuery.each(jQuery("ul#accordionList li"),function(f,e){jQuery(this).mouseover(function(h){if(f!=d&&!a){var g=jQuery(this).find("a.linkOne").attr("href");a=true;d=f;jQuery("div#mainImage img").fadeTo("fast",0,function(i){jQuery("div#mainImage img").attr("src",b+f+c).load(function(){jQuery("div#mainImage img").fadeTo("fast",1);});});jQuery("div#mainImage a").attr("href",g);a=false}})})};
