if(typeof(tracker)=="undefined"){tracker=false}iPhoneOverlays={};Object.extend(iPhoneOverlays,Event.Listener);
Object.extend(iPhoneOverlays,{initialize:function(a){Event.observe(document,"click",this._triggerClicked.bindAsEventListener(this));
this.listenForEvent(AC.ViewMaster,"ViewMasterWillShowNotification",false,this.willShow);
this.listenForEvent(AC.OverlayPanel.overlay,"afterClose",false,this.afterClose)
},trackingNameForSection:function(a,c,b){a.count++;if(!c.match("video")){if(a.count<2||c.match("overlay")||c.match("-slideshow")){return false
}}return c},_triggerClicked:function(a){var b=a.findElement("a");if(!b||!b.hasClassName("OverlayPanel")){return
}if(b.target){this.initialId=b.target.replace(/.*#/,"")}},willShow:function(a){var b=a.event_data.data.sender;
var c=a.event_data.data.incomingView;tracker.setDelegate(this);if(typeof(AC.OverlayPanel.overlay.slideshows)!="undefined"&&c&&c.id){if(c.id.match("hasslideshow")){AC.OverlayPanel.overlay.slideshows.each(function(d){d.start()
})}else{if(!c.id.match("slideshow")){AC.OverlayPanel.overlay.slideshows.each(function(d){d.stop();
d.contentController.show(d.contentController.sectionWithId(d.contentController.orderedSections[0]))
})}}}if(b.overlayId=="OverlayPanel"){this.overlay=b;if(c&&c.id){if(c.id.match("gallery")){this.gallery(c)
}else{if(c.id.match("howto")){this.howTo(c)}}}}this.initialId=null},gallery:function(c){this.overlay.overlay.addClassName("galleryoverlay");
this.overlay.setOverlayShadowImageSrc("http://images.apple.com/iphone/images/overlay-gallery-bg-20090608.png");
if(!c.gallery){c.content.addClassName("galleryoverlay");var b=c.content.select("a");
b.each(function(d){d.addClassName(c.id+"Trigger")});var a=document.createElement("div");
a.id=c.id+"SwapView";a.className="gallerySwapView";c.content.appendChild(a);if(!this.initialId){this.initialId=b[0].href.replace(/.*#/,"")
}c.gallery=new AC.ViewMaster.Viewer(b,c.id+"SwapView",c.id+"Trigger",{initialId:this.initialId,silentTriggers:true,shouldAnimateContentChange:!(AC.Detector.isIE())})
}else{if(this.initialId){c.gallery.show(c.gallery.sectionWithId(this.initialId),true)
}}},howTo:function(b){this.preloadScrollbarImages();this.overlay.overlay.addClassName("howtooverlay");
this.overlay.setOverlayShadowImageSrc("http://images.apple.com/iphone/images/overlay-howto-bg-20090608.png");
if(!b.howto){b.content.addClassName("howtooverlay");var a=b.content.down("div");
a.addClassName("overflow");var c=document.createElement("div");c.className="footer";
c.innerHTML='<a class="more" href="/ca/fr/iphone/how-to/">View all iPhone How-tos</a>';
b.content.appendChild(c);b.howto=true}},preloadScrollbarImages:function(b){if(!this.imagesHaveBeenPreloaded){var a=["http://images.apple.com/iphone/images/scrollbar-handle-20090608.png","http://images.apple.com/iphone/images/scrollbar-handle-hover-20090608.png","http://images.apple.com/iphone/images/scrollbar-handle-active-20090608.png","http://images.apple.com/iphone/images/scrollbar-20090608.png","http://images.apple.com/iphone/images/scrollbar-hover-20090608.png","http://images.apple.com/iphone/images/scrollbar-active-20090608.png"];
a.each(function(c){(new Image()).src=c});this.imagesHaveBeenPreloaded=true}},afterClose:function(a){var b=a.event_data.data;
b.overlay.removeClassName("howtooverlay");b.overlay.removeClassName("galleryoverlay");
if(typeof(AC.OverlayPanel.overlay.slideshows)!="undefined"){AC.OverlayPanel.overlay.slideshows.each(function(c){c.stop()
})}b.setOverlayShadowImageSrc(null)}});Event.onDOMReady(function(){iPhoneOverlays.initialize();
if(tracker==false){tracker=new AC.ViewMaster.Tracker("click")}});
