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