(function(g,a){if(!a)a={};var f=e(a.layout,1),u=e(a.auto,0),E=e(a.prev,"< Previous"),D=e(a.next,"Next >"),v=e(a.pos,"{0} of {1} slides"),F=e(a.sep,"|"),y=e(a.delay,8000),d=Msn.DOM,k=document,w=window,q=0,b=0,c=[],j=[],i=null,h=x();o();if(h>1){if(u&&f!==4)z(g);if(f==4)A(c[0]);else if(f==3){m(c[0]);if(v!==""){i=k.createElement("div");i.className="count";g.insertBefore(i,c[0]);s()}}else if(f==2)m(null);else if(f==1)m(c[0])}function x(){var b=0;for(var h=0;h<g.childNodes.length;++h){var a=g.childNodes[h];if(a.nodeType==1){b++;c.push(a);if(a.style)a.style.display="none";if(f==4)for(var i=0;i<a.childNodes.length;++i){var e=a.childNodes[i];if(e.nodeType==1){if(e.nodeName=="H2"){j.push(d.InnerText(e));break}j.push(b);break}}}}return b}function m(b){var a=k.createElement("div");a.className=b?"controls cf before":"controls cf after";g.insertBefore(a,b);C.hook(p(a,E,"prev"),"click");B.hook(p(a,D,"next"),"click")}function A(d){var c=0,b=k.createElement("div");b.className=d?"controls before":"controls after";g.insertBefore(b,d);for(var a=0;a<j.length;a++){c=a+1==j.length?0:1;H.hook(p(b,j[a],a,c),"click")}}function B(a){n(1,null);a=d.Event(a);return d.CancelEvent(a)}function C(a){n(h-1,null);a=d.Event(a);return d.CancelEvent(a)}function H(a){a=d.Event(a);n(null,a);return d.CancelEvent(a)}function n(a,c){t();if(a)b=(b+a)%h;else b=parseInt(d.Target(c).className);o();if(u&&f!==4)l()}function s(){if(i)i.innerHTML=v.format(b+1,h)}function r(a){if(c[b])c[b].style.display=a}function o(){r("block");s()}function t(){r("none")}function p(b,f,d,e){var a=k.createElement("a");a.href="#";a.className=d;a.innerHTML=f;b.appendChild(a);if(e){var c=k.createElement("span");c.innerHTML=F;b.appendChild(c)}return a}function z(a){l.hook(a,"mousemove");a=0;l()}function l(){if(q)w.clearTimeout(q);q=w.setTimeout(G,y)}function G(){t();b=(b+1)%h;I()}function I(){o();l()}this.dispose=function(){g=null;c=0};function e(a,b){return typeof a!="undefined"?a:b}}).as("Msn.Slideshow")