if(typeof AC==="undefined"){AC={}}if(typeof tracker==="undefined"){tracker=false
}AC.Tutorials={};AC.Tutorials.cookie={data:[],name:"tutorials",path:function(){if(!this._path){this._path=document.location.toString();
this._path=this._path.replace(/http:\/\/[^\/]*/,"");this._path=this._path.replace(/\?.*/,"");
this._path=this._path.replace(/#.*/,"")}return this._path},reset:function(){this.data=this.data.sort().uniq()
},read:function(){if(this.data.length==0){var b=document.cookie.split(";");b.each(function(e,f){if(e.match(this.name)){var e=e.toQueryParams();
if(e[this.name]){var a=e[this.name].split(",");this.data=this.data.concat(a);this.reset()
}}}.bind(this))}return this.data},set:function(f){var d=new Date();d.setDate(d.getDate()+7);
d.toGMTString();this.data.push(f);this.reset();var e=this.data.join(",");if(!e.match(f)){e=(e!="")?e+","+f:f
}document.cookie=this.name+"="+e+"; expires="+d+"; path="+this.path()+"; domain=apple.com"
}};AC.Tutorials.TabBrowser=Class.create({tutorialsViewMaster:null,tutorialsView:null,tutorialsTriggerClassName:null,initialize:function(h,i,g,k,l){this.view=h;
this.triggerClassName=i;this.tutorialsView=g;this.tutorialsTriggerClassName=k;this.options=l||{};
AC.Tutorials.cookie.read();var j=new AC.ViewMaster.Viewer(null,this.view,this.triggerClassName,this.options);
this.tabs=j;this.tabs.setDelegate(this);if(!this.url){this.url=document.location.toString().replace(document.location.hash,"")
}this.initializeFromHash();if(!tracker&&AC.ViewMaster.Tracker){tracker=new AC.ViewMaster.Tracker();
tracker.setDelegate(this)}},initializeFromHash:function(){var g=document.location.hash.toString().replace("#","");
if(g!=""){var e="#"+g;var h=g.toQueryParams();if(h.tab&&h.tutorial){e="#"+h.tab+"-"+h.tutorial
}e=e.replace("-mov-","-");e=e.replace("-text-","-");document.location=e}var g=document.location.hash.toString().replace("#","");
var f=(!g.match("-"))?g:g.split("-")[0];if(f&&this.tabs.sectionWithId(f)){this.tabs.show(this.tabs.sectionWithId(f))
}else{this.tabs.addSection($$("a."+this.triggerClassName)[0]);this.tabs.show(this.tabs.sectionWithId(this.tabs.orderedSections[0]))
}},didAppendContent:function(e,h){var g=e.currentSection;if(g&&!this.tutorialsViewMaster){this.tutorialsViewMaster=new AC.Tutorials.TutorialBrowser(this,this.tutorialsView,this.tutorialsTriggerClassName,this.options)
}if(h&&!g.visited){var f=this.tutorialsViewMaster.tutorials;AC.Tutorials.cookie.data.each(function(a){h.select("a."+f.triggerClassName+"[href*="+a+"]").each(function(b){b.addClassName("visited")
})});g.visited=true}},didShow:function(d,f,e){if(e&&this.url&&e.id!="clicktoplay"){document.location=this.url+"#"+e.id
}},trackingNameForSection:function(d,e,f){if(e.match(/-/)){return e}return false
}});AC.Tutorials.TutorialBrowser=Class.create({initialize:function(e,g,h){this.view=e;
this.triggerClassName=g;this.options=h||{};if(arguments.length==4){this.tabDelegate=arguments[0];
this.view=arguments[1];this.triggerClassName=arguments[2];this.options=arguments[3]
}AC.Tutorials.cookie.read();var f=new AC.ViewMaster.Viewer(null,this.view,this.triggerClassName,this.options);
this.tutorials=f;this.tutorials.setDelegate(this);this.initializeSplashFrame();
AC.Tutorials.cookie.data.each(function(a){$$("a."+f.triggerClassName+"[href*="+a+"]").each(function(b){b.addClassName("visited")
})}.bind(this));if(!this.url){this.url=document.location.toString().replace(document.location.hash,"")
}this.initializeFromHash();if(!tracker&&AC.ViewMaster.Tracker){tracker=new AC.ViewMaster.Tracker()
}},initializeSplashFrame:function(){var l=$("clicktoplay");if(l){var k=l.down("."+this.triggerClassName);
if(typeof(AC.QuickTime)!="undefined"&&typeof(AC.QuickTime.Controller)!="undefined"){var g=document.createElement("a");
g.className="controllerPanel "+this.triggerClassName;g.href=k.href;var h=new AC.QuickTime.Controller();
if(typeof(h.render)=="function"){g.appendChild(h.render());k.up("div").appendChild(g)
}}var j=k.href.replace(/.*#/,"");var i=l.select("."+this.triggerClassName);i.each(function(b){var a=b.href.replace(/.*#/,"");
if(a.match(j)){b.addClassName("active")}});l.remove();this.tutorials.addSection(l)
}return l},initializeFromHash:function(){var j=document.location.hash.toString().replace("#","");
if(j!=""){var m="#"+j;var l=j.toQueryParams();if(l.tutorial){m="#"+l.tutorial}m=m.replace("-mov-","-");
m=m.replace("-text-","-");document.location=m}var j=document.location.hash.toString().replace("#","");
if(j!=""){var i=j.split("-");var j=[];for(var n=i.length-1;n>=0;n--){for(var h=0;
h<j.length;h++){j[h]=i[n]+"-"+j[h]}j.push(i[n])}for(var n=0;n<j.length;n++){var k=$$("a."+this.tutorials.triggerClassName+"[href$="+j[n]+"]");
if(k.length>0){k=this.tutorials.addSection(k[0]);if(j[0].match(/-gallery\d*$/)){k.showGallery=j[0]
}this.tutorials.show(k);break}}}if(!this.tutorials.currentSection){this.tutorials.show(this.tutorials.sectionWithId("clicktoplay"))
}},willShow:function(d,f,e){if(this.tabDelegate){this.tabDelegate.tabs.show(this.tabDelegate.tabs.sectionWithId(e.id.split("-")[0]))
}if(e.imageSrc&&!e.image){e.image=document.createElement("img");e.image.className="swapimage";
e.image.src=e.imageSrc;e.content.appendChild(e.image)}},getMovieImagePath:function(h){var g=h.movieLink.getAttribute("href",2).toQueryParams();
var e=g.width||640;var f=g.height||480;return"http://images.apple.com/global/elements/quicktime/qt_endstate"+e+"x"+f+".jpg"
},createPosterLink:function(b){if(!b.posterLink){b.posterLink=document.createElement("a");
b.posterLink.className="posterLink";b.posterLink.href=this.getMovieImagePath(b)
}},createEndState:function(c){if(!c.endState){c.endState=document.createElement("div");
c.endState.className="endState";c.endState.innerHTML='<img src="'+this.getMovieImagePath(c)+'">';
if(this.options.replayButtonText){var d=new Element("a",{className:"replay pillbutton",href:"#"+c.id});
d.innerHTML="<span>"+this.options.replayButtonText+"</span><b>&gt;</b>";if(d){d.observe("click",function(a){a.stop();
this.replayMovie()}.bindAsEventListener(c))}c.endState.appendChild(d)}}},setUpGallery:function(f,g,h){g.relatedGallerySection=h.down("div.gallery");
if(g.relatedGallerySection&&!g.gallery){var e=document.createElement("div");e.id=g.id+"Container";
e.className="galleryContainer";g.relatedGallerySection.appendChild(e);g.gallery=new AC.ViewMaster.Viewer(null,g.id+"Container","gallery-link-"+g.id);
g.gallery.setDelegate(this);g.relatedGallerySection.select("ul.nav li a").each(function(j){var a=j.href.replace(/.*#/,"");
var d=j.href.replace(/#.*/,"");j.addClassName("gallery-link-"+g.id);j.href="#"+a;
var b=document.createElement("div");b.id=a;b.className="swapImage";g.relatedGallerySection.appendChild(b);
var c=g.gallery.addSection(j);c.imageSrc=d});g.gallery.show(g.gallery.sectionWithId(g.gallery.orderedSections[0]))
}},didAppendContent:function(e,d){var f=e.currentSection;if(f){if(f.movieLink){this.createPosterLink(f);
this.createEndState(f)}if(d){this.setUpGallery(e,f,d)}f.triggers().each(function(a){a.addClassName("visited")
});AC.Tutorials.cookie.set(f.id)}},didShow:function(e,h,f){if(f.showGallery){var g=this.tutorials.addSection(f.relatedGallerySection);
this.tutorials.show(g);if(f.gallery.sectionWithId(f.showGallery)){f.gallery.show(f.gallery.sectionWithId(f.showGallery))
}else{f.gallery.show(f.gallery.sectionWithId(f.gallery.orderedSections[0]))}f.showGallery=false
}if(h&&h.id==f.id.replace(/-gallery\d*$/,"")){h.triggers().each(function(a){a.addClassName("active")
})}if(h&&h.id.match(/-gallery\d*$/)&&!h.id.match(f.id)){var h=this.tutorials.sectionWithId(h.id.replace(/-gallery\d*$/,""));
if(h){h.triggers().each(function(a){a.removeClassName("active")})}}if(f&&this.url&&f.id!="clicktoplay"){document.location=this.url+"#"+f.id
}}});
