/**
 * jQuery Templates
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Written by: Stan Lemon <stanlemon@mac.com>
 */
(function($){$.template=function(html,options){return new $.template.instance(html,options);};$.template.instance=function(html,options){if(options&&options.regx){options.regx=this.regx[options.regx];}this.options=$.extend({compile:false,regx:this.regx.standard},options||{});this.html=html;if(this.options.compile){this.compile();}this.isTemplate=true;};$.template.regx=$.template.instance.prototype.regx={jsp:/\$\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,ext:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,jtemplates:/\{\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}\}/g};$.template.regx.standard=$.template.regx.jsp;$.template.helpers=$.template.instance.prototype.helpers={substr:function(value,start,length){return String(value).substr(start,length);}};$.extend($.template.instance.prototype,{apply:function(values){if(this.options.compile){return this.compiled(values);}else{var tpl=this;var fm=this.helpers;var fn=function(m,name,format,args){if(format){if(format.substr(0,5)=="this."){return tpl.call(format.substr(5),values[name],values);}else{if(args){var re=/^\s*['"](.*)["']\s*$/;args=args.split(",");for(var i=0,len=args.length;i<len;i++){args[i]=args[i].replace(re,"$1");}args=[values[name]].concat(args);}else{args=[values[name]];}return fm[format].apply(fm,args);}}else{return values[name]!==undefined?values[name]:"";}};return this.html.replace(this.options.regx,fn);}},compile:function(){var sep=$.browser.mozilla?"+":",";var fm=this.helpers;var fn=function(m,name,format,args){if(format){args=args?","+args:"";if(format.substr(0,5)!="this."){format="fm."+format+"(";}else{format='this.call("'+format.substr(5)+'", ';args=", values";}}else{args="";format="(values['"+name+"'] == undefined ? '' : ";}return"'"+sep+format+"values['"+name+"']"+args+")"+sep+"'";};var body;if($.browser.mozilla){body="this.compiled = function(values){ return '"+this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.options.regx,fn)+"';};";}else{body=["this.compiled = function(values){ return ['"];body.push(this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.options.regx,fn));body.push("'].join('');};");body=body.join("");}eval(body);return this;}});var $_old={domManip:$.fn.domManip,text:$.fn.text,html:$.fn.html};$.fn.domManip=function(args,table,reverse,callback){if(args[0].isTemplate){args[0]=args[0].apply(args[1]);delete args[1];}var r=$_old.domManip.apply(this,arguments);return r;};$.fn.html=function(value,o){if(value&&value.isTemplate){var value=value.apply(o);}var r=$_old.html.apply(this,[value]);return r;};$.fn.text=function(value,o){if(value&&value.isTemplate){var value=value.apply(o);}var r=$_old.text.apply(this,[value]);return r;};})(jQuery);
/** DigitalStories Modal  */
var DigitalStories=function(X){var P="digitalstories";var R=function(){};var W=function(){};var K={};var M={enumeratorText:"of",all:"Asset",image:"Image",videolist:"Videolist",text:"Text"};var k=!(X(new Image()).get(0)==null);var H={};var d="all";var V=false;var a=false;var O=1;var I="all";var G=[];var A={};var i=false;var E={};E.isOpera=(window.opera||null);E.isIE=false;E.isIE6=false;E.isIE7=false;E.isIE8=false;if(window.ActiveXObject){var T=-1;var c=navigator.userAgent;var b=new RegExp("Trident/([0-9]{1,}[.0-9]{0,})");if(b.exec(c)!=null){T=parseFloat(RegExp.$1);}E.isIE8=(T==4);E.isIE7=((window.XMLHttpRequest&&!E.isIE8)?true:false);E.isIE6=!(E.isIE7||E.isIE8);E.isIE=true;}var e=location.href.split("/");while(e.length>3){e.pop();}E.location=e.join("/");A.image=X.template('<div id="ds-panel-${id}" class="ds-panel ds-panel-image" style="display: none; margin-top: ${marginTop}px"><img src="${url}" width="${width}" height="${height}" /></div>');A.text=X.template('<div id="ds-panel-${id}" class="ds-panel ds-panel-text"  style="display: none;">${content}</div>');A.videolist=X.template('<div id="ds-panel-${id}" class="ds-panel ds-panel-video" style="display: none;margin-top: ${marginTop}px"><object " type="application/x-shockwave-flash" data="${location}/${assetsPath}/videoplayer.swf?xml=${source}" width="${width}" height="${height}"><param name="allowfullscreen" value="true" /><param name="autoplay" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="${location}/${assetsPath}/videoplayer.swf?xml=${source}" /><param name="flashvars" value="xml=${source}" /></object></div>');function Z(s,q){s=h(s);G=[];for(var p=0,t=1,n=s.length,r=null,o="";p<n;p++,t++){r=s[p];switch(r.type){case"image":X("#ds-content").append(A.image,{id:t,url:r.url,width:r.width,height:r.height,marginTop:(r.height>=470?0:Math.round((470-r.height)/2))});m(t,r);break;case"text":X("#ds-content").append(A.text,{id:t,content:r.content});break;case"videolist":X("#ds-content").append(A.videolist,{id:t,source:r.url,location:E.location,assetsPath:B(),width:r.width,height:r.height,marginTop:(r.height>=470?0:Math.round((470-r.height)/2))});break;}G.push(r);}F(s);f(D(q));}function m(p,o){if(k&&typeof (H[o.url])=="undefined"){X("#ds-content #ds-panel-"+p+".ds-panel-image").addClass("loader");var n=new Image();n.onload=function(){H[n.src]=true;X("#ds-content #ds-panel-"+p+".ds-panel-image").removeClass("loader");};n.src=o.url;}else{}}function h(o){if(o.length>1){var n=[];X(["image","videolist","text"]).each(function(p,q){X(o).each(function(r,s){if(s.type==q){n[n.length]=s;}});});o=n;}return o;}function D(n){var o=1;if(n=="all"||Y()!="all"){return o;}X(G).each(function(p,q){if((q.type==n)){o=(p+1);return ;}});return o;}function f(n){if((n==0)||(n>G.length)){return ;}X("#ds-content #ds-panel-"+J()).hide();X("#ds-content #ds-panel-"+n).show();X("#ds-options .ds-description").html(G[n-1]["description"]);X("#ds-options .ds-enumerator").html(M[Y()]+" "+n+" "+M.enumeratorText+" "+X("#ds-content .ds-panel").length);if(G[n-1]["type"]=="videolist"){X("#ds-options").addClass("videolist");X("#ds-options .ds-prev-button").addClass("ds-prev-button-hover");X("#ds-options .ds-next-button").addClass("ds-next-button-hover");window.setTimeout(function(){X("#ds-options .ds-prev-button").fadeOut((a==false?925:250),function(){X("#ds-options .ds-prev-button").fadeIn();X("#ds-options .ds-prev-button").removeClass("ds-prev-button-hover");});X("#ds-options .ds-next-button").fadeOut((a==false?925:250),function(){X("#ds-options .ds-next-button").fadeIn();X("#ds-options .ds-next-button").removeClass("ds-next-button-hover");});if(a==false){a=true;}},(V==false?1850:250));}else{X("#ds-options").removeClass("videolist");}if(X("#ds-content .ds-panel").length>1){X("#ds-options .ds-prev-button").removeClass("hidden");X("#ds-options .ds-next-button").removeClass("hidden");if(n==1){X("#ds-options .ds-prev-button").addClass("hidden");}else{if(n==G.length){X("#ds-options .ds-next-button").addClass("hidden");}}}l(n);}function N(){if(E.isIE6){j();}X("#ds-overlay").css("opacity",0.85);X("#ds-lightbox").show();if(V==false){X("#ds-container").animate({height:520,top:0,width:700},800,"swing",function(){X("#ds-content").removeClass("hidden");X("#ds-options").removeClass("hidden");});V=true;}S(true);}function j(){var n=document.body.scrollHeight>=document.body.clientHeight?document.body.scrollHeight:document.body.clientHeight;X(["#ds-overlay","#ds-lightbox"]).each(function(p,o){X(o).css("position","absolute");X(o).height(n);});if(X(document).scrollTop()>0){X(document).scrollTop(0);}}function J(){return O;}function l(n){O=n;}function U(){return I;}function F(p){var o="all";if(p.length>1){var n=[];X(p).each(function(q,r){if(X.inArray(r.type,n)==-1){n[n.length]=r.type;}});o=(n.length>1?o:n[0]);}d=o;}function Y(){return d;}function S(n){i=n;}function g(){return(i==true?true:null);}function Q(n){P=n;}function B(){return P;}function L(o){if(!g()){return ;}try{switch(o.keyCode){case 39:DigitalStories.next();break;case 37:DigitalStories.prev();break;case 27:DigitalStories.close();break;}}catch(n){}}function C(){X("#ds-lightbox").hide();X("#ds-overlay").hide();X("#ds-content").html("");try{W();}catch(n){}}return{initialize:function(n){n=n||{};if(typeof (n.assetsPath)!="undefined"){Q(n.assetsPath);}if(typeof (n.onOpen)!="undefined"){R=n.onOpen;}if(typeof (n.onClose)!="undefined"){W=n.onClose;}X(document.body).append('<div id="ds-overlay" style="display: none; opacity: 0.85;"></div>');X(document.body).append('<div id="ds-lightbox" style="display: none;"><div id="ds-container" style="width: 350px; height: 260px; top: 200px;"><div id="ds-content" class="hidden"></div></div></div>');X("#ds-container").append('<div id="ds-options" class="hidden"><p class="ds-enumerator">Asset 1 of 3</p><p class="ds-description">This is my description</p><a href="#close" class="ds-close-button" onclick="DigitalStories.close(); return false;"><!-- close --></a><a href="#prev" class="ds-prev-button hidden" onclick="DigitalStories.prev(); return false;" onfocus="$(this).doBlurAndHidefocus();" onmousedown="$(this).doBlurAndHidefocus();" onmouseup="$(this).doBlur();" onmouseout="$(this).doBlur();"><!-- prev --></a><a href="#next" class="ds-next-button hidden" onclick="DigitalStories.next(); return false;" onfocus="$(this).trigger(\'blur\');$(this).doBlurAndHidefocus();" onmousedown="$(this).doBlurAndHidefocus();" onmouseup="$(this).doBlur();" onmouseout="$(this).doBlur();"><!-- next --></a></div>');if(E.isIE){X("#ds-container").addClass("isIE");X(["isIE8","isIE7","isIE6"]).each(function(o,p){if(E[p]==true){X("#ds-container").addClass(p);}});}if(E.isIE6){X(document.body).addClass("ds-enabled");}X(document).bind("keydown",L);X("#ds-content").bind("keydown",L);},openLightbox:function(n){DigitalStories.openLightboxWithType(n,"all");},openLightboxWithType:function(p,n){Z(p,n);try{R();}catch(o){}X("#ds-overlay").fadeIn("normal",N);},close:function(){S(false);C();return false;},prev:function(){if(!i){return ;}f(J()-1);},next:function(){if(!i){return ;}f(J()+1);},setLabel:function(n,o){M[n]=o;},getLabel:function(n){return(typeof (M[n])!="undefined"?M[n]:"");}};}(jQuery);jQuery.fn.doBlurAndHidefocus=function(){try{this.blur();this.hideFocus=true;this.style.outline="none";}catch(A){}};jQuery.fn.doBlur=function(){try{this.blur();this.hideFocus=false;this.style.outline=null;}catch(A){}};
// Initialize.
// jQuery(document).ready(function(){ DigitalStories.initialize({}); });

jQuery(document).ready(function(){ DigitalStories.initialize({
	"assetsPath": "assets",
	onOpen: function(){ if(window.ActiveXObject){ $('.content-object object').css('visibility', 'hidden'); }}, 
	onClose: function(){ if(window.ActiveXObject){ $('.content-object object').css('visibility', 'visible'); }}
}); });