var tutorials=null;var cookie={data:[],name:"tutorials",path:function(){if(!this._path){this._path=document.location.toString();
this._path="/"+this._path.replace(/http:\/\/[^\/]*\//,"").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"
}};var trackerDelegate={trackingNameForSection:function(e,b,g){var c=g.triggers();
var a=c[c.length-1];var f=a.up("ul");if(f){var d="";if(b.match(/(pages|numbers|keynote)/)){d=f.previous("h5")
}else{d=f.previous("h4")}}if(d){return d.innerHTML.replace(".","")+" - "+b}return b
},QTdidBegin:function(b,a){a.prop8="Video View";return a}};var tutorialsDelegate={url:false,createPosterLink:function(a){if(!a.posterLink){a.posterLink=new Element("a",{className:"posterLink",href:"http://images.apple.com/global/elements/overlay/overlay_movie_endstate_640x400_20081014.jpg"})
}},createEndState:function(b){if(!b.endState){var a=new Element("a",{className:"replay pillbutton",href:"#"+b.id});
a.innerHTML="<span>Watch again</span><b>&gt;</b>";if(a){a.observe("click",function(c){c.stop();
this.replayMovie()}.bindAsEventListener(b))}b.endState=new Element("div",{className:"endState"});
b.endState.appendChild(a)}},createFeaturedNav:function(a,d){if(!this.featuredNav){this.featuredNav=a.sectionWithId(a.orderedSections[0]).content.getElementsByClassName("featurednav")[0]
}d.content.appendChild(this.featuredNav);var c=this.featuredNav.down("a.active");
if(c){c.removeClassName("active")}var b=this.featuredNav.down("a[href*="+d.id+"]");
if(b){b.addClassName("active")}},setVisited:function(a){a.triggers().each(function(b){b.addClassName("visited")
});cookie.set(a.id)},didAppendContent:function(a,b){var c=a.currentSection;if(c){if(c.movieLink){this.createPosterLink(c);
this.createEndState(c);this.createFeaturedNav(a,c)}this.setVisited(c)}},didShow:function(b,c,a){if(!this.url){this.url=document.location.toString().replace(/#.*/,"")
}else{if(a&&a.id&&!a.id.match("clicktoplay")){document.location=this.url+"#"+a.id
}}if(c&&!this.featuredNav){this.featuredNav=c.content.down("#featurednav")}}};Event.onDOMReady(function(){cookie.read();
var c=$("clicktoplay");c.remove();var f=new Element("a",{className:"controllerPanel tutorial-link",href:c.down("a.pillbutton").href});
c.down(".movie").appendChild(f);var b=new AC.QuicktimeController();f.appendChild(b.render());
b=null;tutorials=new AC.ViewMaster.Viewer([c],"tutorial-container","tutorial-link",{shouldAnimateContentChange:false,defaultId:"clicktoplay"});
tutorials.setDelegate(tutorialsDelegate);tracker=new AC.ViewMaster.Tracker();tracker.setDelegate(trackerDelegate);
var e=document.location.hash.toString().replace("#","");if(tutorials.currentSection.id!=e){var d=$$("a.tutorial-link[href*="+e+"]");
tutorials.addSection(d[0]);tutorials.show(tutorials.sectionWithId(e))}else{tutorials.delegate.didAppendContent(tutorials);
tutorials.delegate.didShow(tutorials,null,tutorials.currentSection)}var a=cookie.read();
a.each(function(g){var h=$$("a.tutorial-link[href*="+g+"]");h.each(function(i){i.addClassName("visited")
})})});
