var NavToggle=Class.create({active:false,duration:0.5,initialize:function(a,c,b){this.container=$(a);
this.button=$(c);this.fromTop=b?true:false;if(AC.Detector.isiPad()||AC.Detector.isiPhone()){this.container.addClassName("mobile");
this.container.show()}else{if(this.fromTop){this.height=this.container.getHeight();
this.container.setStyle("height: 0; overflow: hidden;");this.container.show()}}this.button.observe("click",function(d){d.stop();
if(AC.Detector.isiPad()||AC.Detector.isiPhone()){this.onTap()}else{this.toggle()
}}.bind(this));this.boundDocumentClickClose=this.documentClickClose.bind(this).bindAsEventListener()
},onTap:function(){this.container.removeClassName("active");if(this.active){this.container.addClassName("closed");
this.container.removeClassName("open");this.active=false;document.stopObserving("touchend",this.boundDocumentClickClose)
}else{this.container.addClassName("open");this.container.removeClassName("closed");
this.active=true;(function(){this.container.addClassName("active")}.bind(this)).delay(0.31);
document.observe("touchend",this.boundDocumentClickClose)}},documentClickClose:function(a){if(!a.findElement("div.open")&&!a.findElement("a.browse-button")){this.onTap()
}},toggle:function(){if(!this.fromTop){new Effect.toggle(this.container,"slide",{duration:this.duration})
}if(this.active){if(this.fromTop){this.container.morph("height: 0px;",{duration:this.duration})
}Element.removeClassName(this.button,"active");this.active=false}else{if(this.fromTop){this.container.morph("height: "+this.height+"px;",{duration:this.duration})
}Element.addClassName(this.button,"active");this.active=true}if(this.fromTop&&HoverZooms){(function(){if(HoverZooms.HoverZoom1){HoverZooms.HoverZoom1.updateRelativeOrigin()
}if(HoverZooms.HoverZoom3gs){HoverZooms.HoverZoom3gs.updateRelativeOrigin()}if(HoverZooms.HoverZoom4){HoverZooms.HoverZoom4.updateRelativeOrigin()
}if(HoverZooms.HoverZoom2){HoverZooms.HoverZoom2.updateRelativeOrigin()}if(HoverZooms.HoverZoom3){HoverZooms.HoverZoom3.updateRelativeOrigin()
}}).delay(this.duration)}}});var HoverZooms=false;Event.onDOMReady(function(){$$(".previous").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=footer nav; domain=.apple.com; path=/"
})});$$(".next").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=footer nav; domain=.apple.com; path=/"
})});$$("#features-nav-top a").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=browse all - header; domain=.apple.com; path=/"
})});$$("#features-nav-bottom a").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=browse all - footer; domain=.apple.com; path=/"
})});$$("#footernav a").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=more apps - footer; domain=.apple.com; path=/"
})});$$("#header-nav-content a").each(function(a){a.observe("mousedown",function(b){document.cookie="s_iphone_nav=more apps - header; domain=.apple.com; path=/"
})});$$("#browse-bottom").each(function(a){a.observe("mousedown",function(b){if(!b.target.className.match(/active/)){AC.Tracking.trackClick({prop3:AC.Tracking.pageName()+" - browse all features - footer"},this,"o",AC.Tracking.pageName()+" - browse all features - bottom")
}})});$$("#browse-top").each(function(a){a.observe("mousedown",function(b){if(!b.target.className.match(/active/)){AC.Tracking.trackClick({prop3:AC.Tracking.pageName()+" - browse all features - header"},this,"o",AC.Tracking.pageName()+" - browse all features - top")
}})});$$("#headernav").each(function(a){a.observe("mousedown",function(b){if(b.target.className!="active"){AC.Tracking.trackClick({prop3:AC.Tracking.pageName()+" - more apps for everything - header"},this,"o",AC.Tracking.pageName()+" - more apps for everything - header")
}})})});
