var sections={},fancyGallery,transform2d3d=function(d,c){if(AC.Detector.supportsThreeD()){d.setVendorPrefixStyle("transform","translate3d("+c+", 0, 0)")
}else{d.setVendorPrefixStyle("transform","translate("+c+", 0)")}},fancySection={initializeFancySection:function(){this._width=this.content.getWidth();
this._offset=this.content.positionedOffset().left;this.imgs=this.content.select("img.hero");
this.img=this.imgs[0];this.hdr=this.content.down("h1");this.sub=this.content.down("h2");
this.imgsLength=this.imgs.length;for(var b=this.imgsLength-1;b>=0;b--){transform2d3d(this.imgs[b],this.width+"px");
this.imgs[b].setVendorPrefixStyle("transition","0");this.imgs[b].setVendorPrefixStyle("transition-timing-function","cubic-bezier(0.25, 0, 0.25, 1.0)")
}transform2d3d(this.hdr,this.width+"px");this.hdr.setVendorPrefixStyle("transition","0");
this.hdr.setVendorPrefixStyle("transition-timing-function","cubic-bezier(0.25, 0, 0.25, 1.0)");
transform2d3d(this.sub,this.width+"px");this.sub.setVendorPrefixStyle("transition","0");
this.sub.setVendorPrefixStyle("transition-timing-function","cubic-bezier(0.25, 0, 0.25, 1.0)")
},resetPosition:function(){for(var b=this.imgsLength-1;b>=0;b--){transform2d3d(this.imgs[b],"0")
}transform2d3d(this.hdr,"0");transform2d3d(this.sub,"0");this.hdr.style.opacity=1;
this.sub.style.opacity=1},resetDuration:function(c){if(!c){c=0}for(var d=this.imgsLength-1;
d>=0;d--){this.imgs[d].setVendorPrefixStyle("transition-duration",c+"ms")}this.hdr.setVendorPrefixStyle("transition-duration",c+"ms");
this.sub.setVendorPrefixStyle("transition-duration",c+"ms")},mode:"play",multiplier:function(){return this[this.mode+"Multiplier"]
},playMultiplier:1,touchMultiplier:(1/8),options:{duration:500},duration:function(){return this[this.mode+"Duration"]()
},playDuration:function(){return this.options.duration},touchDuration:function(){return this.options.duration/2
},_width:980,width:function(){return this._width},_offset:980,offset:function(){return this._offset
},easeOut:function(b){return(b==1)?1:1-Math.pow(2,-10*b)},right:Prototype.emptyFunction,left:Prototype.emptyFunction,show:Prototype.emptyFunction};
sections.galleryNew={};Object.extend(sections.galleryNew,fancySection);Object.extend(sections.galleryNew,{resetDuration:function(c){if(!c){c=0
}if(!this.shown){for(var d=0;d<this.imgsLength;d++){this.imgs[d].setVendorPrefixStyle("transition-duration",c*((d+1)/2)+"ms")
}this.hdr.setVendorPrefixStyle("transition-duration",c*1.5+"ms");this.sub.setVendorPrefixStyle("transition-duration",c*1.5+"ms");
this.shown=true}else{for(var d=this.imgsLength-1;d>=0;d--){this.imgs[d].setVendorPrefixStyle("transition-duration",c+"ms")
}this.hdr.setVendorPrefixStyle("transition-duration",c+"ms");this.sub.setVendorPrefixStyle("transition-duration",c+"ms")
}},right:function(g){var e=this.easeOut(g)*this.width();var h=[];for(var f=this.imgsLength;
f>=0;f--){h.push(-Math.round(e*(f)*this.multiplier()))}for(var f=this.imgsLength-1;
f>=0;f--){transform2d3d(this.imgs[f],h[f]+"px")}this.sub.style.opacity=1-this.easeOut(g);
this.touched=true},left:function(g){var e=this.easeOut(g)*this.width();var h=[];
for(var f=this.imgsLength+1;f>=0;f--){h[f]=(this.touched)?Math.round(e*(f+1)*((f+1)*this.multiplier())):Math.round(e*(1)*((1)*this.multiplier()))
}for(var f=this.imgsLength-1;f>=0;f--){transform2d3d(this.imgs[f],h[f]+"px")}transform2d3d(this.hdr,h[this.imgsLength]+"px");
transform2d3d(this.sub,h[this.imgsLength]+"px");this.sub.style.opacity=1-this.easeOut(g);
this.touched=true},show:function(){for(var b=this.imgsLength-1;b>=0;b--){this.imgs[b].setVendorPrefixStyle("transition-duration",this.duration()-(b*20)+"ms")
}this.hdr.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms");
this.sub.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms")
}});sections.galleryDisplay={};Object.extend(sections.galleryDisplay,fancySection);
Object.extend(sections.galleryDisplay,{right:function(g){var e=this.easeOut(g)*this.width();
var f=-Math.round(e*4*this.multiplier());var h=-Math.round(e*0.25*this.multiplier());
transform2d3d(this.img,f+"px");transform2d3d(this.hdr,h+"px");transform2d3d(this.sub,h+"px");
this.hdr.style.opacity=1-this.easeOut(g);this.sub.style.opacity=1-this.easeOut(g)
},left:function(g){var e=this.easeOut(g)*this.width();var f=Math.round(e*4*this.multiplier());
var h=Math.round(e*1.25*this.multiplier());transform2d3d(this.img,f+"px");transform2d3d(this.hdr,h+"px");
transform2d3d(this.sub,h+"px");this.hdr.style.opacity=1-this.easeOut(g);this.sub.style.opacity=1-this.easeOut(g)
},show:function(){this.img.setVendorPrefixStyle("transition-duration",this.duration()+"ms");
this.hdr.setVendorPrefixStyle("transition-duration",this.duration()+"ms");this.sub.setVendorPrefixStyle("transition-duration",this.duration()+"ms")
}});sections.galleryAllinone={};Object.extend(sections.galleryAllinone,fancySection);
Object.extend(sections.galleryAllinone,{playMultiplier:1,touchMultiplier:(1/4),right:function(g){var e=this.easeOut(g)*this.width();
var f=-Math.round(e*2*this.multiplier());var h=-Math.round(e*1*this.multiplier());
transform2d3d(this.img,f+"px");transform2d3d(this.hdr,h+"px");transform2d3d(this.sub,h+"px");
this.hdr.style.opacity=1;this.sub.style.opacity=1},left:function(g){var e=this.easeOut(g)*this.width();
var f=Math.round(e*2*this.multiplier());var h=Math.round(e*0.5*this.multiplier());
transform2d3d(this.img,f+"px");transform2d3d(this.hdr,h+"px");transform2d3d(this.sub,h+"px");
this.hdr.style.opacity=1-this.easeOut(g);this.sub.style.opacity=1-this.easeOut(g)
},show:function(){this.img.setVendorPrefixStyle("transition-duration",(this.duration()*1)+"ms");
this.hdr.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms");
this.sub.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms")
}});sections.galleryWireless={};Object.extend(sections.galleryWireless,fancySection);
Object.extend(sections.galleryWireless,{right:function(g){var e=this.easeOut(g)*this.width();
var h=[];for(var f=this.imgsLength;f>=0;f--){h.push(-Math.round(e*(f+1)*this.multiplier()))
}for(var f=0;f<this.imgsLength;f++){transform2d3d(this.imgs[f],h[f]+"px")}transform2d3d(this.hdr,h[3]+"px");
transform2d3d(this.sub,h[3]+"px");this.sub.style.opacity=1-this.easeOut(g)},left:function(g){var e=this.easeOut(g)*this.width();
var h=[];for(var f=this.imgsLength;f>=0;f--){h[f]=Math.round(e*(f+1)*this.multiplier())
}transform2d3d(this.hdr,h[0]+"px");transform2d3d(this.sub,h[0]+"px");for(var f=this.imgsLength-1;
f>=0;f--){transform2d3d(this.imgs[f],h[f+1]+"px")}this.sub.style.opacity=1-this.easeOut(g)
},show:function(){for(var b=this.imgsLength-1;b>=0;b--){this.imgs[b].setVendorPrefixStyle("transition-duration",(this.duration()-(this.duration()*(this.imgsLength-b)/10))+"ms")
}this.hdr.setVendorPrefixStyle("transition-duration",(this.duration()*0.2)+"ms");
this.sub.setVendorPrefixStyle("transition-duration",(this.duration()*0.4)+"ms")
}});sections.gallerySoftware={};Object.extend(sections.gallerySoftware,fancySection);
Object.extend(sections.gallerySoftware,{right:function(g){var e=this.easeOut(g)*this.width();
var h=[];for(var f=this.imgsLength+1;f>=0;f--){h.push(-Math.round(e*f*this.multiplier()))
}for(var f=this.imgsLength-1;f>=0;f--){transform2d3d(this.imgs[f],h[f]+"px")}this.sub.style.opacity=1-this.easeOut(g)
},left:function(g){var e=this.easeOut(g)*this.width();var h=[];for(var f=this.imgsLength+1;
f>=0;f--){h[f]=Math.round(e*(f+1)*this.multiplier())}transform2d3d(this.hdr,h[0]+"px");
transform2d3d(this.sub,h[0]+"px");for(var f=this.imgsLength-1;f>=0;f--){transform2d3d(this.imgs[f],h[f+1]+"px")
}this.sub.style.opacity=1-this.easeOut(g)},show:function(){for(var b=this.imgsLength-1;
b>=0;b--){this.imgs[b].setVendorPrefixStyle("transition-duration",this.duration()-(b*20)+"ms")
}this.hdr.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms");
this.sub.setVendorPrefixStyle("transition-duration",(this.duration()*0.6)+"ms")
}});fancyGallery=Class.create({options:{duration:1000},fancy:function(){if(this._fancy==undefined){this._fancy=(AC.Detector.isCSSAvailable("transition")&&AC.Detector.isCSSAvailable("transform"))
}return this._fancy},initialize:function(h,g,j){this.element=$(h);this.width=g.getWidth()||0;
if(this.fancy()){this.element.addVendorEventListener("transitionEnd",this.didTouch.bind(this));
this.element.setVendorPrefixStyle("transition-timing-function","cubic-bezier(0.25, 0, 0.25, 1.0)");
transform2d3d(this.element,this.width+"px")}if(!j){j={}}Object.extend(this.options,j);
fancySection.options.duration=this.options.duration;this.view=new AC.ViewMaster.SlideViewer(null,this.element,this.element.id,{silentTriggers:true,continuous:true,discontinuousPreviousNext:true,useKeyboardNav:true});
this.view.setDelegate(this);var i=document.getElementsByTagName("head")[0];var f=document.createElement("script");
f.type="text/javascript";f.setAttribute("src","http://images.apple.com/global/scripts/pagingview.js");
i.appendChild(f);var f=document.createElement("script");f.type="text/javascript";
f.setAttribute("src","http://images.apple.com/global/scripts/reveal.js");i.appendChild(f);document.observe("ac:pagingView:load",this.pagingView.bind(this));
document.observe("ac:reveal:load",this.revealed.bind(this))},pagingView:function(){if(this.element&&!this._pagingView&&this.fancy()){this._pagingView=this.element.pagingView(this.touch.bind(this),this.touch.bind(this),this.touch.bind(this),{preventDefault:"horizontal"})
}},revealed:function(){if(typeof(this.element.pagingView)=="function"){this.pagingView()
}var j=this.element.getElementsByClassName("gallery-content");this.sections=[];
this.totalSections=j.length;for(var f=0;f<this.totalSections;f++){var h=j[f].id.replace("MASKED-","");
var g=h.camelize();if(this.view.currentSection&&h===this.view.currentSection.id){var i=this.view.currentSection;
this.view.orderedSections.shift();this.view.orderedSections.push(i.id)}else{var i=this.view.addSection(j[f])
}Object.extend(i,sections[g]);i.initializeFancySection();this.sections.push(i)}this.currentSectionIndex=0;
this.nextSectionIndex=1;if(this.view.currentSection===this.view.getFirstSection()){this.view.disablePreviousNextIfNeeded()
}this.view.options.animationDuration=(this.options.duration*0.7)/1000;if(!this.view.currentSection||(this.view.currentSection===this.view.getFirstSection()&&this.fancy())){if(this.view.currentSection===this.view.getFirstSection()){transform2d3d(this.element,"0")
}if(!this.view.currentSection){this.slideshow=new AC.ViewMaster.Slideshow(this.view,null,{autoplay:2000,delay:5000,stopOnContentTriggerClick:true,stopAfterReturnToSection:0,discontinuousPreviousNext:false})
}this._showFirst=true;this.view.showFirst()}},stopSlideshow:function(){if(this.slideshow){this.slideshow.stop();
delete this.slideshow}this.stopSlideshow=Prototype.emptyFunction},elementOffset:function(){var b=this.element.style.transform;
if(!b){b=this.element.style.webkitTransform}if(!b){b=this.element.style.MozTransform
}if(!b){b=this.element.style.msTransform}if(!b){b=this.element.style.oTransform
}if(b){return parseInt(b.replace(/.*\(([^,]*).*/,"$1").replace("px",""))}return parseInt(this.element.offsetLeft)
},nextSectionIndex:false,touch:function(t){this.nextSectionIndex=false;this.stopSlideshow();
this.element.setVendorPrefixStyle("transition-duration","0");if(t.startCoords&&t.coords&&t.difference){var r=t.difference.abs.x/this.width;
if(t.startCoords.x>t.coords.x){var m="right";var v=r;var s="left";var u=1-r}else{var m="left";
var v=r;var s="right";var u=1-r}var n=this.currentSectionIndex;var p=this.sections[this.currentSectionIndex];
if(!(s=="left"&&this.currentSectionIndex==this.totalSections-1)&&!(s=="right"&&this.currentSectionIndex==0)){if(s=="left"){this.nextSectionIndex=this.currentSectionIndex+1
}if(s=="right"){this.nextSectionIndex=this.currentSectionIndex-1}}var q=(this.nextSectionIndex!==false)?this.sections[this.nextSectionIndex]:false;
p.resetDuration();p.content.style.opacity=1;p.mode="touch";if(q){q.resetDuration();
q.content.style.opacity=1;q.mode="touch"}if(t.touches.length){p[m](v);if(q){q[s](u)
}}}if(t.difference){transform2d3d(this.element,(this.startOffset-t.difference.x)+"px")
}else{this.startOffset=this.elementOffset()}if(!t.touches.length&&p){this._shouldAnimateContentChange=false;
if(q&&(t.difference.abs.x>this.width/2||t.speed>5)){var l=q;var o=p}else{var l=p;
var o=q;this.nextSectionIndex=false}l.show();if(o){o.resetDuration(o.duration())
}this.element.setVendorPrefixStyle("transition-duration",l.duration()/2+"ms");window.setTimeout(function(){l.resetPosition();
if(o){o.resetPosition()}transform2d3d(this.element,"-"+l.offset()+"px")}.bind(this),1)
}},didTouch:function(b){if(b.target===this.element&&b.propertyName.match("transform")){if(!this._shouldAnimateContentChange){this.element.setVendorPrefixStyle("transition-duration","0");
if(this.nextSectionIndex!==false){this.currentSectionIndex=this.nextSectionIndex
}this.view._currentTrigger=b;this.view.show(this.sections[this.currentSectionIndex]);
this.sections[this.currentSectionIndex].content.style.opacity=1;this._shouldAnimateContentChange=true
}}},_shouldAnimateContentChange:true,shouldAnimateContentChange:function(d,f,e){return this._shouldAnimateContentChange
},willShow:function(e,h,f){this.outgoingSection=h;this.incomingSection=f;this.outgoingSectionIndex=(this.outgoingSection)?this.view.indexOfSection(this.outgoingSection):-1;
this.incomingSectionIndex=(this.incomingSection)?this.view.indexOfSection(this.incomingSection):-1;
this.sectionsToAnimate=[];if(this.outgoingSection){this.sectionsToAnimate.push(this.outgoingSection);
this.outgoingSection.mode="play"}if(this.outgoingSectionIndex<this.incomingSectionIndex){if(this.sectionsToAnimate[0]){this.sectionsToAnimate[0].direction="right"
}for(var g=this.outgoingSectionIndex+1;g<this.incomingSectionIndex+1;g++){this.sections[g].direction="left";
this.sections[g].mode="play";this.sectionsToAnimate.push(this.sections[g])}}else{if(this.outgoingSectionIndex>this.incomingSectionIndex){if(this.sectionsToAnimate[0]){this.sectionsToAnimate[0].direction="left"
}for(var g=this.outgoingSectionIndex-1;g>this.incomingSectionIndex-1;g--){this.sections[g].direction="right";
this.sections[g].mode="play";this.sectionsToAnimate.push(this.sections[g])}}}},willAnimate:function(r,s,w,x,i,v){var t=this.element,z=this.elementOffset()||0,o=(this.incomingSection!==null)?-this.incomingSection.offset():0,y=this.sectionsToAnimate.length;
if(this.fancy()){v=v*1000;for(var u=0;u<y;u++){var p=this.sectionsToAnimate[u];
p.content.style.opacity=1;if(u==0&&y>1){p.resetDuration(v);window.setTimeout(function(){this[this.direction](1)
}.bind(p),1)}else{if(u==y-1){p[p.direction](1);window.setTimeout(function(){this.resetDuration(v);
window.setTimeout(function(){this.resetPosition()}.bind(this),1)}.bind(p),1)}else{p.resetDuration();
p.resetPosition()}}}this.element.setVendorPrefixStyle("transition-duration",(v*0.7)+"ms");
window.setTimeout(function(){transform2d3d(this.element,"-"+this.sectionsToAnimate[y-1].offset()+"px")
}.bind(this),1);var q=function(a){if(a.target==this.element&&a.propertyName.match(/transform$/i)){this.element.removeVendorEventListener("transitionEnd",q,false);
x()}}.bind(this);this.element.addVendorEventListener("transitionEnd",q,false)}else{for(var u=0;
u<y;u++){this.sectionsToAnimate[u].content.setOpacity(1);this.sectionsToAnimate[u].content.style.opacity=1
}return new Effect.Move(t,{x:o-z,y:0,duration:v,afterFinish:function(){x()},queue:{scope:i}})
}},_didShow:function(){this.currentSectionIndex=this.view.indexOfSection(this.view.currentSection)
},didShow:function(){if(this._showFirst){this.view._currentTrigger=null;this.view.options.alwaysShowSection=true;
this.view.show(this.sections[0],true)}this._didShow();this.view.currentSection.content.style.opacity=1;
this.view.options.discontinuousPreviousNext=true;this.view.options.animationDuration=this.options.duration/1000;
this.view.options.alwaysShowSection=false;this.didShow=this._didShow}});var hero=$("hero");
new fancyGallery($("gallery-hero"),hero);hero.down("nav").style.display="block";
if(AC.Detector.isCSSAvailable("border-radius")){hero.className+=" capped"};
