startList=function(){if(document.all&&document.getElementById){navRoot=document.getElementById("navigation").getElementsByTagName("ul")[0];for(i=0;i<navRoot.childNodes.length;i++){node=navRoot.childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over"};node.onmouseout=function(){this.className=this.className.replace(" over","")}}}}};startList2=function(){if(document.all&&document.getElementById){navRoot=document.getElementById("egonav").getElementsByTagName("ul")[0];for(i=0;i<navRoot.childNodes.length;i++){node=navRoot.childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over"};node.onmouseout=function(){this.className=this.className.replace(" over","")}}}}};var Mediabox;(function(){var A,h,P,H,O,n,F,l,m,k,J,y,t,z=new Image(),V=new Image(),r=false,w=false,S,b,j,c,U,E,M,T,W,e,D,Q,G,x,B,o,i="none",f,d="mediaBox",C;window.addEvent("domready",function(){$(document.body).adopt($$([S=new Element("div",{id:"mbOverlay"}).addEvent("click",N),b=new Element("div",{id:"mbCenter"})]).setStyle("display","none"));j=new Element("div",{id:"mbImage"}).injectInside(b);c=new Element("div",{id:"mbBottom"}).injectInside(b).adopt(new Element("a",{id:"mbCloseLink",href:"#"}).addEvent("click",N),e=new Element("a",{id:"mbNextLink",href:"#"}).addEvent("click",g),T=new Element("a",{id:"mbPrevLink",href:"#"}).addEvent("click",K),E=new Element("div",{id:"mbTitle"}),W=new Element("div",{id:"mbNumber"}),M=new Element("div",{id:"mbCaption"}));y={overlay:new Fx.Tween(S,{property:"opacity",duration:360}).set(0),image:new Fx.Tween(j,{property:"opacity",duration:360,onComplete:I}),bottom:new Fx.Tween(c,{property:"opacity",duration:240}).set(0)}});Mediabox={close:function(){N()},open:function(Z,Y,X){A=$extend({loop:false,stopKey:true,overlayOpacity:0.7,resizeOpening:true,resizeDuration:240,resizeTransition:false,initialWidth:320,initialHeight:180,defaultWidth:640,defaultHeight:360,showCaption:true,showCounter:true,counterText:"",imgBackground:false,imgPadding:70,scriptaccess:"true",fullscreen:"true",fullscreenNum:"1",autoplay:"true",autoplayNum:"1",autoplayYes:"yes",bgcolor:"#000000",wmode:"opaque",playerpath:"/js/player.swf",backcolor:"000000",frontcolor:"999999",lightcolor:"000000",screencolor:"000000",controlbar:"over",useNB:true,NBpath:"/js/NonverBlaster.swf",NBloop:"true",controllerColor:"0x777777",showTimecode:"false",controller:"true",flInfo:"true",revverID:"187866",revverFullscreen:"true",revverBack:"000000",revverFront:"ffffff",revverGrad:"000000",usViewers:"true",ytBorder:"0",ytColor1:"000000",ytColor2:"333333",ytQuality:"&ap=%2526fmt%3D18",ytRel:"0",ytInfo:"1",ytSearch:"0",vuPlayer:"basic",vmTitle:"1",vmByline:"1",vmPortrait:"1",vmColor:"ffffff"},X||{});if((Browser.Engine.gecko)&&(Browser.Engine.version<19)){r=true;A.overlayOpacity=1;S.className="mbOverlayFF"}if(typeof Z=="string"){Z=[[Z,Y,X]];Y=0}h=Z;A.loop=A.loop&&(h.length>1);if((Browser.Engine.trident)&&(Browser.Engine.version<5)){w=true;S.className="mbOverlayIE";S.setStyle("position","absolute");L()}q();s(true);n=window.getScrollTop()+(window.getHeight()/2);l=window.getScrollLeft()+(window.getWidth()/2);y.resize=new Fx.Morph(b,$extend({duration:A.resizeDuration,onComplete:R},A.resizeTransition?{transition:A.resizeTransition}:{}));b.setStyles({top:n,left:l,width:A.initialWidth,height:A.initialHeight,marginTop:-(A.initialHeight/2),marginLeft:-(A.initialWidth/2),display:""});y.overlay.start(A.overlayOpacity);return a(Y)}};Element.implement({mediabox:function(X,Y){$$(this).mediabox(X,Y);return this}});Elements.implement({mediabox:function(X,aa,Z){aa=aa||function(ab){x=ab.rel.split(/[\[\]]/);x=x[1];return[ab.href,ab.title,x]};Z=Z||function(){return true};var Y=this;Y.addEvent("contextmenu",function(ab){if(this.toString().match(/\.gif|\.jpg|\.png/i)){ab.stop()}});Y.removeEvents("click").addEvent("click",function(){var ac=Y.filter(Z,this);var ad=[];var ab=[];ac.each(function(af,ae){if(ab.indexOf(af.toString())<0){ad.include(ac[ae]);ab.include(ac[ae].toString())}});return Mediabox.open(ad.map(aa),ab.indexOf(this.toString()),X)});return Y}});function L(){S.setStyles({top:window.getScrollTop(),left:window.getScrollLeft()})}function q(){k=window.getWidth();J=window.getHeight();S.setStyles({width:k,height:J})}function s(X){["object",window.ie?"select":"embed"].forEach(function(Z){Array.forEach(document.getElementsByTagName(Z),function(aa){if(X){aa._mediabox=aa.style.visibility}aa.style.visibility=X?"hidden":aa._mediabox})});S.style.display=X?"":"none";var Y=X?"addEvent":"removeEvent";if(w){window[Y]("scroll",L)}window[Y]("resize",q);document[Y]("keydown",u)}function u(X){switch(X.code){case 27:case 88:case 67:N();break;case 37:case 80:K();break;case 39:case 78:g()}if(A.stopKey){return false}}function K(){return a(H)}function g(){return a(O)}function a(X){if(X>=0){j.set("html","");P=X;H=((P||!A.loop)?P:h.length)-1;O=P+1;if(O==h.length){O=A.loop?0:-1}v();b.className="mbLoading";Q=h[X][2].split(" ");G=Q.length;if(G>1){B=(Q[G-2].match("%"))?(window.getWidth()*("0."+(Q[G-2].replace("%",""))))+"px":Q[G-2]+"px";o=(Q[G-1].match("%"))?(window.getHeight()*("0."+(Q[G-1].replace("%",""))))+"px":Q[G-1]+"px"}else{B="";o=""}D=h[X][0];D=encodeURI(D).replace("(","%28").replace(")","%29");U=h[P][1].split("::");if(D.match(/quietube\.com/i)){f=D.split("v.php/");D=f[1]}else{if(D.match(/\/\/yfrog/i)){i=(D.substring(D.length-1));if(i.match(/b|g|j|p|t/i)){i="image"}if(i=="s"){i="flash"}if(i.match(/f|z/i)){i="video"}D=D+":iphone"}}if(D.match(/\.gif|\.jpg|\.png|twitpic\.com/i)||i=="image"){i="img";D=D.replace(/twitpic\.com/i,"twitpic.com/show/full");t=new Image();t.onload=p;t.src=D}else{if(D.match(/\.flv|\.mp4/i)||i=="video"){i="obj";B=B||A.defaultWidth;o=o||A.defaultHeight;if(A.useNB){t=new Swiff(""+A.NBpath+"?mediaURL="+D+"&allowSmoothing=true&autoPlay="+A.autoplay+"&buffer=6&showTimecode="+A.showTimecode+"&loop="+A.NBloop+"&controlColour="+A.controllerColor+"&scaleIfFullScreen=true&showScalingButton=true",{id:"MediaboxSWF",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}})}else{t=new Swiff(""+A.playerpath+"?file="+D+"&backcolor="+A.backcolor+"&frontcolor="+A.frontcolor+"&lightcolor="+A.lightcolor+"&screencolor="+A.screencolor+"&autostart="+A.autoplay+"&controlbar="+A.controlbar,{id:"MediaboxSWF",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}})}p()}else{if(D.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i)||i=="audio"){i="obj";B=B||A.defaultWidth;o=o||"20px";if(D.match(/tweetmic\.com|tmic\.fm/i)){D=D.split("/");D[4]=D[4]||D[3];D="http://media4.fjarnet.net/tweet/tweetmicapp-"+D[4]+".mp3"}t=new Swiff(""+A.playerpath+"?file="+D+"&backcolor="+A.backcolor+"&frontcolor="+A.frontcolor+"&lightcolor="+A.lightcolor+"&screencolor="+A.screencolor+"&autostart="+A.autoplay,{id:"MediaboxSWF",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/\.swf/i)||i=="flash"){i="obj";B=B||A.defaultWidth;o=o||A.defaultHeight;t=new Swiff(D,{id:"MediaboxSWF",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/blip\.tv/i)){i="obj";B=B||"640px";o=o||"390px";t=new Swiff(D,{src:D,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/break\.com/i)){i="obj";B=B||"464px";o=o||"376px";d=D.match(/\d{6}/g);t=new Swiff("http://embed.break.com/"+d,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/dailymotion\.com/i)){i="obj";B=B||"480px";o=o||"381px";t=new Swiff(D,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/facebook\.com/i)){i="obj";B=B||"320px";o=o||"240px";f=D.split("v=");f=f[1].split("&");d=f[0];t=new Swiff("http://www.facebook.com/v/"+d,{movie:"http://www.facebook.com/v/"+d,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/flickr\.com/i)){i="obj";B=B||"500px";o=o||"375px";f=D.split("/");d=f[5];t=new Swiff("http://www.flickr.com/apps/video/stewart.swf",{id:d,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:o,params:{flashvars:"photo_id="+d+"&amp;show_info_box="+A.flInfo,wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/fliggo\.com/i)){i="obj";B=B||"425px";o=o||"355px";D=D.replace("/video/","/embed/");t=new Swiff(D,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/gametrailers\.com/i)){i="obj";B=B||"480px";o=o||"392px";d=D.match(/\d{5}/g);t=new Swiff("http://www.gametrailers.com/remote_wrap.php?mid="+d,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/google\.com\/videoplay/i)){i="obj";B=B||"400px";o=o||"326px";f=D.split("=");d=f[1];t=new Swiff("http://video.google.com/googleplayer.swf?docId="+d+"&autoplay="+A.autoplayNum,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/justin\.tv/i)){i="obj";B=B||"353px";o=o||"295px";f=D.split("/");d=f[3];t=new Swiff("http://www.justin.tv/widgets/jtv_player.swf",{id:"jtv_player_flash",width:B,height:o,params:{flashvars:"channel="+d,wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/megavideo\.com/i)){i="obj";B=B||"640px";o=o||"360px";f=D.split("=");d=f[1];t=new Swiff("http://wwwstatic.megavideo.com/mv_player.swf?v="+d,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/metacafe\.com\/watch/i)){i="obj";B=B||"400px";o=o||"345px";f=D.split("/");d=f[4];t=new Swiff("http://www.metacafe.com/fplayer/"+d+"/.swf?playerVars=autoPlay="+A.autoplayYes,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/myspacetv\.com|vids\.myspace\.com/i)){i="obj";B=B||"425px";o=o||"360px";f=D.split("=");d=f[2];t=new Swiff("http://lads.myspace.com/videos/vplayer.swf?m="+d+"&v=2&a="+A.autoplayNum+"&type=video",{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/revver\.com/i)){i="obj";B=B||"480px";o=o||"392px";f=D.split("/");d=f[4];t=new Swiff("http://flash.revver.com/player/1.0/player.swf?mediaId="+d+"&affiliateId="+A.revverID+"&allowFullScreen="+A.revverFullscreen+"&autoStart="+A.autoplay+"&backColor=#"+A.revverBack+"&frontColor=#"+A.revverFront+"&gradColor=#"+A.revverGrad+"&shareUrl=revver",{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/rutube\.ru/i)){i="obj";B=B||"470px";o=o||"353px";f=D.split("=");d=f[1];t=new Swiff("http://video.rutube.ru/"+d,{movie:"http://video.rutube.ru/"+d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/seesmic\.com/i)){i="obj";B=B||"435px";o=o||"355px";f=D.split("/");d=f[5];t=new Swiff("http://seesmic.com/Standalone.swf?video="+d,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/tudou\.com/i)){i="obj";B=B||"400px";o=o||"340px";f=D.split("/");d=f[5];t=new Swiff("http://www.tudou.com/v/"+d,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/twitcam\.com/i)){i="obj";B=B||"320px";o=o||"265px";f=D.split("/");d=f[3];t=new Swiff("http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash="+d,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/twitvid\.com/i)){i="obj";B=B||"600px";o=o||"338px";f=D.split("/");d=f[3];t=new Swiff("http://www.twitvid.com/player/"+d,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/twitvid\.io/i)){i="obj";B=B||"580px";o=o||"323px";f=D.split("/");d=f[3];t=new Swiff("http://twitvid.io/embed/"+d,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/ustream\.tv/i)){i="obj";B=B||"400px";o=o||"326px";t=new Swiff(D+"&amp;viewcount="+A.usViewers+"&amp;autoplay="+A.autoplay,{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/youku\.com/i)){i="obj";B=B||"480px";o=o||"400px";f=D.split("id_");d=f[1];t=new Swiff("http://player.youku.com/player.php/sid/"+d+"=/v.swf",{width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/youtube\.com\/watch/i)){i="obj";f=D.split("v=");d=f[1];if(d.match(/fmt=18/i)){C="&ap=%2526fmt%3D18";B=B||"560px";o=o||"345px"}else{if(d.match(/fmt=22/i)){C="&ap=%2526fmt%3D22";B=B||"640px";o=o||"385px"}else{C=A.ytQuality;B=B||"480px";o=o||"295px"}}t=new Swiff("http://www.youtube.com/v/"+d+"&autoplay="+A.autoplayNum+"&fs="+A.fullscreenNum+C+"&border="+A.ytBorder+"&color1=0x"+A.ytColor1+"&color2=0x"+A.ytColor2+"&rel="+A.ytRel+"&showinfo="+A.ytInfo+"&showsearch="+A.ytSearch,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/youtube\.com\/view/i)){i="obj";f=D.split("p=");d=f[1];B=B||"480px";o=o||"385px";t=new Swiff("http://www.youtube.com/p/"+d+"&autoplay="+A.autoplayNum+"&fs="+A.fullscreenNum+C+"&border="+A.ytBorder+"&color1=0x"+A.ytColor1+"&color2=0x"+A.ytColor2+"&rel="+A.ytRel+"&showinfo="+A.ytInfo+"&showsearch="+A.ytSearch,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/veoh\.com/i)){i="obj";B=B||"410px";o=o||"341px";f=D.split("videos/");d=f[1];t=new Swiff("http://www.veoh.com/videodetails2.swf?permalinkId="+d+"&player=videodetailsembedded&videoAutoPlay="+A.AutoplayNum,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/viddler\.com/i)){i="obj";B=B||"437px";o=o||"370px";f=D.split("/");d=f[4];t=new Swiff(D,{id:"viddler_"+d,movie:D,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen,id:"viddler_"+d,movie:D}});p()}else{if(D.match(/viddyou\.com/i)){i="obj";B=B||"416px";o=o||"312px";f=D.split("=");d=f[1];t=new Swiff("http://www.viddyou.com/get/v2_"+A.vuPlayer+"/"+d+".swf",{id:d,movie:"http://www.viddyou.com/get/v2_"+A.vuPlayer+"/"+d+".swf",width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/vimeo\.com/i)){i="obj";B=B||"640px";o=o||"360px";f=D.split("/");d=f[3];t=new Swiff("http://www.vimeo.com/moogaloop.swf?clip_id="+d+"&amp;server=www.vimeo.com&amp;fullscreen="+A.fullscreenNum+"&amp;autoplay="+A.autoplayNum+"&amp;show_title="+A.vmTitle+"&amp;show_byline="+A.vmByline+"&amp;show_portrait="+A.vmPortrait+"&amp;color="+A.vmColor,{id:d,width:B,height:o,params:{wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/12seconds\.tv/i)){i="obj";B=B||"430px";o=o||"360px";f=D.split("/");d=f[5];t=new Swiff("http://embed.12seconds.tv/players/remotePlayer.swf",{id:d,width:B,height:o,params:{flashvars:"vid="+d+"",wmode:A.wmode,bgcolor:A.bgcolor,allowscriptaccess:A.scriptaccess,allowfullscreen:A.fullscreen}});p()}else{if(D.match(/\#mb_/i)){i="inline";B=B||A.defaultWidth;o=o||A.defaultHeight;URLsplit=D.split("#");t=$(URLsplit[1]).get("html");p()}else{i="url";B=B||A.defaultWidth;o=o||A.defaultHeight;d="mediaId_"+new Date().getTime();t=new Element("iframe",{src:D,id:d,width:B,height:o,frameborder:0});p()}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return false}function p(){if(i=="img"){B=t.width;o=t.height;if(A.imgBackground){j.setStyles({backgroundImage:"url("+D+")",display:""})}else{if(o>=J-A.imgPadding){o=J-A.imgPadding;B=t.width=parseInt((o/t.height)*B);t.height=o}else{if(B>=k-A.imgPadding){B=k-A.imgPadding;o=t.height=parseInt((B/t.width)*o);t.width=B}}if(Browser.Engine.trident){t=$(t)}t.addEvent("mousedown",function(X){X.stop()}).addEvent("contextmenu",function(X){X.stop()});j.setStyles({backgroundImage:"none",display:""});t.inject(j)}}else{if(i=="obj"){if(Browser.Plugins.Flash.version<8){j.setStyles({backgroundImage:"none",display:""});j.set("html",'<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');B=A.DefaultWidth;o=A.DefaultHeight}else{j.setStyles({backgroundImage:"none",display:""});t.inject(j)}}else{if(i=="inline"){j.setStyles({backgroundImage:"none",display:""});j.set("html",t)}else{if(i=="url"){j.setStyles({backgroundImage:"none",display:""});t.inject(j)}else{j.setStyles({backgroundImage:"none",display:""});j.set("html",'<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');B=A.defaultWidth;o=A.defaultHeight}}}}j.setStyles({width:B,height:o});E.set("html",(A.showCaption)?U[0]:"");M.set("html",(A.showCaption&&(U.length>1))?U[1]:"");W.set("html",(A.showCounter&&(h.length>1))?A.counterText.replace(/{x}/,P+1).replace(/{y}/,h.length):"");if((H>=0)&&(h[H][0].match(/\.gif|\.jpg|\.png|twitpic\.com/i))){z.src=h[H][0].replace(/twitpic\.com/i,"twitpic.com/show/full")}if((O>=0)&&(h[O][0].match(/\.gif|\.jpg|\.png|twitpic\.com/i))){V.src=h[O][0].replace(/twitpic\.com/i,"twitpic.com/show/full")}B=j.offsetWidth;o=j.offsetHeight+c.offsetHeight;if(o>=n+n-10){F=-(n-10)}else{F=-(o/2)}if(B>=l+l-10){m=-(l-10)}else{m=-(B/2)}if(A.resizeOpening){y.resize.start({width:B,height:o,marginTop:F,marginLeft:m})}else{b.setStyles({width:B,height:o,marginTop:F,marginLeft:m});R()}}function R(){y.image.start(1)}function I(){b.className="";if(H>=0){T.style.display=""}if(O>=0){e.style.display=""}y.bottom.start(1)}function v(){if(t){t.onload=$empty}y.resize.cancel();y.image.cancel().set(0);y.bottom.cancel().set(0);$$(T,e).setStyle("display","none")}function N(){if(P>=0){t.onload=$empty;j.set("html","");for(var X in y){y[X].cancel()}b.setStyle("display","none");y.overlay.chain(s).start(0)}return false}})();Mediabox.scanPage=function(){var a=$$("a").filter(function(b){return b.rel&&b.rel.test(/^lightbox/i)});$$(a).mediabox({},null,function(c){var b=this.rel.replace(/[[]|]/gi," ");var d=b.split(" ");return(this==c)||((this.rel.length>8)&&c.rel.match(d[1]))})};window.addEvent("domready",Mediabox.scanPage);var Clientcide={version:"2.1.0",setAssetLocation:function(b){var a=function(c){return c.replace(/\/\//g,"/")};if(window.StickyWin&&StickyWin.UI){StickyWin.UI.implement({options:{baseHref:a(b+"/stickyWinHTML/")}});if(StickyWin.Alert){StickyWin.Alert.implement({options:{baseHref:b+"/simple.error.popup"}})}if(StickyWin.UI.Pointy){StickyWin.UI.Pointy.implement({options:{baseHref:a(b+"/PointyTip/")}})}}if(window.TagMaker){TagMaker.implement({options:{baseHref:a(b+"/tips/")}})}if(window.ProductPicker){ProductPicker.implement({options:{baseHref:a(b+"/Picker")}})}if(window.Autocompleter){Autocompleter.Base.implement({options:{baseHref:a(b+"/autocompleter/")}})}if(window.Lightbox){Lightbox.implement({options:{assetBaseUrl:a(b+"/slimbox/")}})}if(window.Waiter){Waiter.implement({options:{baseHref:a(b+"/waiter/")}})}},preLoadCss:function(){if(window.StickyWin&&StickyWin.ui){StickyWin.ui()}if(window.StickyWin&&StickyWin.pointy){StickyWin.pointy()}Clientcide.preloaded=true;return true},preloaded:false};(function(){if(!window.addEvent){return}var a=function(){if(window.dbug){dbug.log("preloading clientcide css")}if(!Clientcide.preloaded){Clientcide.preLoadCss()}};window.addEvent("domready",a);window.addEvent("load",a)})();setCNETAssetBaseHref=Clientcide.setAssetLocation;var MooScroller=new Class({Implements:[Options,Events],options:{maxThumbSize:10,mode:"vertical",width:0,scrollSteps:10,wheel:true,scrollLinks:{forward:"scrollForward",back:"scrollBack"},hideWhenNoOverflow:true},initialize:function(d,a,b){this.setOptions(b);this.horz=(this.options.mode=="horizontal");this.content=document.id(d).setStyle("overflow","hidden");this.knob=document.id(a);this.track=this.knob.getParent();this.setPositions();if(this.horz&&this.options.width){this.wrapper=new Element("div");this.content.getChildren().each(function(e){this.wrapper.adopt(e)},this);this.wrapper.inject(this.content).setStyle("width",this.options.width)}this.bound={start:this.start.bind(this),end:this.end.bind(this),drag:this.drag.bind(this),wheel:this.wheel.bind(this),page:this.page.bind(this)};this.position={};this.mouse={};this.update();this.attach();var c=function(){$clear(this.scrolling)}.bind(this);["forward","back"].each(function(e){var f=document.id(this.options.scrollLinks[e]);if(f){f.addEvents({mousedown:function(){this.scrolling=this[e].periodical(50,this)}.bind(this),mouseup:c.bind(this),click:c.bind(this)})}},this);this.knob.addEvent("click",c.bind(this));window.addEvent("domready",function(){try{document.id(document.body).addEvent("mouseup",c.bind(this))}catch(f){}}.bind(this))},setPositions:function(){[this.track,this.knob].each(function(a){if(a.getStyle("position")=="static"){a.setStyle("position","relative")}})},toElement:function(){return this.content},update:function(){var a=this.horz?"Width":"Height";this.contentSize=this.content["offset"+a];this.contentScrollSize=this.content["scroll"+a];this.trackSize=this.track["offset"+a];this.contentRatio=this.contentSize/this.contentScrollSize;this.knobSize=(this.trackSize*this.contentRatio).limit(this.options.maxThumbSize,this.trackSize);if(this.options.hideWhenNoOverflow){this.hidden=this.knobSize==this.trackSize;this.track.setStyle("opacity",this.hidden?0:1)}this.scrollRatio=this.contentScrollSize/this.trackSize;this.knob.setStyle(a.toLowerCase(),this.knobSize);this.updateThumbFromContentScroll();this.updateContentFromThumbPosition()},updateContentFromThumbPosition:function(){this.content[this.horz?"scrollLeft":"scrollTop"]=this.position.now*this.scrollRatio},updateThumbFromContentScroll:function(){this.position.now=(this.content[this.horz?"scrollLeft":"scrollTop"]/this.scrollRatio).limit(0,(this.trackSize-this.knobSize));this.knob.setStyle(this.horz?"left":"top",this.position.now)},attach:function(){this.knob.addEvent("mousedown",this.bound.start);if(this.options.scrollSteps){this.content.addEvent("mousewheel",this.bound.wheel)}this.track.addEvent("mouseup",this.bound.page)},wheel:function(a){if(this.hidden){return}this.scroll(-(a.wheel*this.options.scrollSteps));this.updateThumbFromContentScroll();a.stop()},scroll:function(a){a=a||this.options.scrollSteps;this.content[this.horz?"scrollLeft":"scrollTop"]+=a;this.updateThumbFromContentScroll();this.fireEvent("onScroll",a)},forward:function(a){this.scroll(a)},back:function(a){a=a||this.options.scrollSteps;this.scroll(-a)},page:function(c){var b=this.horz?"x":"y";var a=(c.page[b]>this.knob.getPosition()[b]);this.scroll((a?1:-1)*this.content["offset"+(this.horz?"Width":"Height")]);this.updateThumbFromContentScroll();this.fireEvent("onPage",a);c.stop()},start:function(b){var a=this.horz?"x":"y";this.mouse.start=b.page[a];this.position.start=this.knob.getStyle(this.horz?"left":"top").toInt();document.addEvent("mousemove",this.bound.drag);document.addEvent("mouseup",this.bound.end);this.knob.addEvent("mouseup",this.bound.end);b.stop()},end:function(a){document.removeEvent("mousemove",this.bound.drag);document.removeEvent("mouseup",this.bound.end);this.knob.removeEvent("mouseup",this.bound.end);a.stop()},drag:function(b){var a=this.horz?"x":"y";this.mouse.now=b.page[a];this.position.now=(this.position.start+(this.mouse.now-this.mouse.start)).limit(0,(this.trackSize-this.knobSize));this.updateContentFromThumbPosition();this.updateThumbFromContentScroll();b.stop()}});var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:"inherit",maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:"autocompleter-choices",zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:", ",separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(b,a){this.element=$(b);this.setOptions(a);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({delay:this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter){this.filter=this.options.filter.bind(this)}var c=this.options.selectMode;this.typeAhead=(c=="type-ahead");this.selectMode=(c===true)?"selection":c;this.cached=[]},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices}else{this.choices=new Element("ul",{"class":this.options.className,styles:{zIndex:this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,"after");this.relative=this.element.getOffsetParent()}this.fix=new OverlayFix(this.choices)}if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator}this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({property:"opacity",link:"cancel",duration:200},this.options.fxOptions)).addEvent("onStart",Chain.prototype.clearChain).set(0);this.element.setProperty("autocomplete","off").addEvent((Browser.Engine.trident||Browser.Engine.webkit)?"keydown":"keypress",this.onCommand.bind(this)).addEvent("click",this.onCommand.bind(this,[false])).addEvent("focus",this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent("blur",this.toggleFocus.create({bind:this,arguments:false,delay:100}))},destroy:function(){if(this.fix){this.fix.destroy()}this.choices=this.selected=this.choices.destroy()},toggleFocus:function(a){this.focussed=a;if(!a){this.hideChoices(true)}this.fireEvent((a)?"onFocus":"onBlur",[this.element])},onCommand:function(b){if(!b&&this.focussed){return this.prefetch()}if(b&&b.key&&!b.shift){switch(b.key){case"enter":if(this.element.value!=this.opted){return true}if(this.selected&&this.visible){this.choiceSelect(this.selected);return !!(this.options.autoSubmit)}break;case"up":case"down":if(!this.prefetch()&&this.queryValue!==null){var a=(b.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((a)?"getPrevious":"getNext"):((a)?"getLast":"getFirst")](this.options.choicesMatch),true)}return false;case"esc":case"tab":this.hideChoices(true);break}}return true},setSelection:function(f){var g=this.selected.inputValue,h=g;var a=this.queryValue.length,c=g.length;if(g.substr(0,a).toLowerCase()!=this.queryValue.toLowerCase()){a=0}if(this.options.multiple){var e=this.options.separatorSplit;h=this.element.value;a+=this.queryIndex;c+=this.queryIndex;var b=h.substr(this.queryIndex).split(e,1)[0];h=h.substr(0,this.queryIndex)+g+h.substr(this.queryIndex+b.length);if(f){var d=h.split(this.options.separatorSplit).filter(function(j){return this.test(j)},/[^\s,]+/);if(!this.options.allowDupes){d=[].combine(d)}var i=this.options.separator;h=d.join(i)+i;c=h.length}}this.observer.setValue(h);this.opted=h;if(f||this.selectMode=="pick"){a=c}this.element.selectRange(a,c);this.fireEvent("onSelection",[this.element,this.selected,h,g])},showChoices:function(){var c=this.options.choicesMatch,b=this.choices.getFirst(c);this.selected=this.selectedValue=null;if(this.fix){var e=this.element.getCoordinates(this.relative),a=this.options.width||"auto";this.choices.setStyles({left:e.left,top:e.bottom,width:(a===true||a=="inherit")?e.width:a})}if(!b){return}if(!this.visible){this.visible=true;this.choices.setStyle("display","");if(this.fx){this.fx.start(1)}this.fireEvent("onShow",[this.element,this.choices])}if(this.options.selectFirst||this.typeAhead||b.inputValue==this.queryValue){this.choiceOver(b,this.typeAhead)}var d=this.choices.getChildren(c),f=this.options.maxChoices;var i={overflowY:"hidden",height:""};this.overflown=false;if(d.length>f){var j=d[f-1];i.overflowY="scroll";i.height=j.getCoordinates(this.choices).bottom;this.overflown=true}this.choices.setStyles(i);this.fix.show();if(this.options.visibleChoices){var h=document.getScroll(),k=document.getSize(),g=this.choices.getCoordinates();if(g.right>h.x+k.x){h.x=g.right-k.x}if(g.bottom>h.y+k.y){h.y=g.bottom-k.y}window.scrollTo(Math.min(h.x,g.left),Math.min(h.y,g.top))}},hideChoices:function(a){if(a){var c=this.element.value;if(this.options.forceSelect){c=this.opted}if(this.options.autoTrim){c=c.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator)}this.observer.setValue(c)}if(!this.visible){return}this.visible=false;if(this.selected){this.selected.removeClass("autocompleter-selected")}this.observer.clear();var b=function(){this.choices.setStyle("display","none");this.fix.hide()}.bind(this);if(this.fx){this.fx.start(0).chain(b)}else{b()}this.fireEvent("onHide",[this.element,this.choices])},prefetch:function(){var f=this.element.value,e=f;if(this.options.multiple){var c=this.options.separatorSplit;var a=f.split(c);var b=this.element.getSelectedRange().start;var g=f.substr(0,b).split(c);var d=g.length-1;b-=g[d].length;e=a[d]}if(e.length<this.options.minLength){this.hideChoices()}else{if(e===this.queryValue||(this.visible&&e==this.selectedValue)){if(this.visible){return false}this.showChoices()}else{this.queryValue=e;this.queryIndex=b;if(!this.fetchCached()){this.query()}}}return true},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue){return false}this.update(this.filter(this.cached));return true},update:function(b){this.choices.empty();this.cached=b;var a=b&&$type(b);if(!a||(a=="array"&&!b.length)||(a=="hash"&&!b.getLength())){(this.options.emptyChoices||this.hideChoices).call(this)}else{if(this.options.maxChoices<b.length&&!this.options.overflow){b.length=this.options.maxChoices}b.each(this.options.injectChoice||function(d){var c=new Element("li",{html:this.markQueryValue(d)});c.inputValue=d;this.addChoiceEvents(c).inject(this.choices)},this);this.showChoices()}},choiceOver:function(c,d){if(!c||c==this.selected){return}if(this.selected){this.selected.removeClass("autocompleter-selected")}this.selected=c.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,d]);if(!this.selectMode){this.opted=this.element.value}if(!d){return}this.selectedValue=this.selected.inputValue;if(this.overflown){var f=this.selected.getCoordinates(this.choices),e=this.options.overflowMargin,g=this.choices.scrollTop,a=this.choices.offsetHeight,b=g+a;if(f.top-e<g&&g){this.choices.scrollTop=Math.max(f.top-e,0)}else{if(f.bottom+e>b){this.choices.scrollTop=Math.min(f.bottom-a+e,b)}}}if(this.selectMode){this.setSelection()}},choiceSelect:function(a){if(a){this.choiceOver(a)}this.setSelection(true);this.queryValue=false;this.hideChoices()},filter:function(a){return(a||this.tokens).filter(function(b){return this.test(b)},new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i"))},markQueryValue:function(a){return(!this.options.markQuery||!this.queryValue)?a:a.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",(this.options.filterCase)?"":"i"),'<span class="autocompleter-queried">$1</span>')},addChoiceEvents:function(a){return a.addEvents({mouseover:this.choiceOver.bind(this,[a]),click:this.choiceSelect.bind(this,[a])})}});var OverlayFix=new Class({initialize:function(a){if(Browser.Engine.trident){this.element=$(a);this.relative=this.element.getOffsetParent();this.fix=new Element("iframe",{frameborder:"0",scrolling:"no",src:"javascript:false;",styles:{position:"absolute",border:"none",display:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}}).inject(this.element,"after")}},show:function(){if(this.fix){var a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles($extend(a,{display:"",zIndex:(this.element.getStyle("zIndex")||1)-1}))}return this},hide:function(){if(this.fix){this.fix.setStyle("display","none")}return this},destroy:function(){if(this.fix){this.fix=this.fix.destroy()}}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident){return{start:this.selectionStart,end:this.selectionEnd}}var e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length}else{var b=this.value;var d=b.length-b.match(/[\n\r]*$/)[0].length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length}return e},selectRange:function(d,a){if(Browser.Engine.trident){var c=this.value.substr(d,a-d).replace(/\r/g,"").length;d=this.value.substr(0,d).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);b.moveEnd("character",d+c);b.moveStart("character",d);b.select()}else{this.focus();this.setSelectionRange(d,a)}return this}});Autocompleter.Base=Autocompleter;Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:"value"},query:function(){var c=$unlink(this.options.postData)||{};c[this.options.postVar]=this.queryValue;var b=$(this.options.indicator);if(b){b.setStyle("display","")}var a=this.options.indicatorClass;if(a){this.element.addClass(a)}this.fireEvent("onRequest",[this.element,this.request,c,this.queryValue]);this.request.send({data:c})},queryResponse:function(){var b=$(this.options.indicator);if(b){b.setStyle("display","none")}var a=this.options.indicatorClass;if(a){this.element.removeClass(a)}return this.fireEvent("onComplete",[this.element,this.request])}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.JSON($merge({url:b,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(a){this.parent();this.update(a)}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.HTML($merge({url:b,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(a,b){this.parent();if(!b||!b.length){this.hideChoices()}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(c){var d=c.innerHTML;c.inputValue=d;this.addChoiceEvents(c.set("html",this.markQueryValue(d)))},this);this.showChoices()}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(c,a,b){this.element=$(c)||$$(c);this.addEvent("onFired",a);this.setOptions(b);this.bound=this.changed.bind(this);this.resume()},changed:function(){var a=this.element.get("value");if($equals(this.value,a)){return}this.clear();this.value=a;this.timeout=this.onFired.delay(this.options.delay,this)},setValue:function(a){this.value=a;this.element.set("value",a);return this.clear()},onFired:function(){this.fireEvent("onFired",[this.value,this.element])},clear:function(){$clear(this.timeout||null);return this},pause:function(){if(this.timer){$clear(this.timer)}else{this.element.removeEvent("keyup",this.bound)}return this.clear()},resume:function(){this.value=this.element.get("value");if(this.options.periodical){this.timer=this.changed.periodical(this.options.periodical,this)}else{this.element.addEvent("keyup",this.bound)}return this}});var $equals=function(b,a){return(b==a||JSON.encode(b)==JSON.encode(a))};

var ImageScrOOler = new Class({
    Implements: [Options, Events],
    moveDirection: "right",
    moveOffset: 0,
    options: {
        // set defaults here
        targetElement: $empty,  // you NEED the target element to be an object
        imagePath: "",          // prefix images with this
        imageSpacing: 10,       // margin between scrolling images
        imageOpacity: .8,
        clickEvent: function(clickObj) {
            window.location.href = escape(clickObj.url);
        },     // this can open a url or call
        moveDelay: 16,          // animation delay between frames, in ms
        moveSteps: 1,           // move by number of pixels
        imageHeight: 70,        // default image height
        imageWidth: 0,        // default image width
        showProgress: true,     // show a 'status' like layer
        defaultMessage: 'Click on the images below',
        showMessage: ' Show me items from ',
        imageClass: 'cur',      // css class to apply to each image, for example, with cursor: pointer
        EOL: 1000,              // delay after eaching END-OF-LINE in ms
        carousel: !true         // if true, it just recycles images and no EOL is reached, works left to right.
    },
    initialize: function(data, options) {

        this.setOptions(options);

        if ($type(this.options.targetElement) != "element")
            return false;

        if(!data.length)
            return false;

        this.data = data;
        this.options.targetElement.empty();

        // setup our elements
        if (this.options.showProgress) // progress / mouseover status element, style #moostats via css
            this.stats = new Element("span", {id: 'moostats', html: "Initialising..."}).inject(this.options.targetElement);

        // containing titles layer
        this.container = new Element("div", {
            styles: {
                overflow: "hidden",
                height: this.options.imageHeight,
                visibility: "hidden",
                width: this.options.targetElement.getSize().x,
                float: "left"
            }
        }).inject(this.options.targetElement);

        this.subcontainer = new Element("div", {
            styles: {
                overflow: "hidden",
                height: this.options.imageHeight,
                visibility: "hidden",
                width: this.options.targetElement.getSize().x,
                "white-space": "nowrap"
            }
        }).inject(this.container);

        // load images and start moving.
        this.loadAssets();

        // prepare containers and make visible
        this.container.setStyles({
            visibility: "visible",
            opacity: 0.1
        }).fade(0,1);

        this.subcontainer.addEvents({
            mouseleave: function() {
                //this.move();
            }.bind(this),
            mouseenter: function() {
                this.stop();
            }.bind(this)
        }).setStyle("visibility", "visible");

        if (this.options.showProgress)
            this.stats.set("html", this.options.defaultMessage);
        // get going!
        this.stop(); // clear up reload issues
        this.subcontainer.scrollTo(0,0);
        //this.move();
    },
    loadAssets: function() {
        // injects images into our containers.
        var _this = this; // can't bind this for the images onload so save a ref.

        this.subcontainer.empty();
        // loop array
        this.data.each(function(el, i) {
        		var mylink = new Element('a',{'href':el.url,'rel':el.rel,'title':el.title});
            var myimg = new Asset.image(_this.options.imagePath + el.image, {
                title: el.title,
                "class": "mOOimage",
                "border": "0",
                //"rel": el.rel,
                onload: function() {
                    if (i < _this.data.length)
                        this.setStyle("margin-right", _this.options.imageSpacing);

                    // add css settings to images here or change / force height.
                    this.set({
                        styles: {
                            height: _this.options.imageHeight,
                            width: _this.options.imageWidth
                        },
                        opacity: _this.options.imageOpacity
                    }).addClass(_this.options.imageClass);

                    
                }
            });
            
            _this.addImageEvents(myimg);
            myimg.inject(mylink);
            mylink.inject(_this.subcontainer);

            if (_this.options.showProgress) {
                // output how many loaded
                if (i < _this.data.length)
                    _this.stats.set("html", i + ' loaded...');
            }
           
            
           
        }); // each

        this.subcontainer.scrollTo(0,0);
    },
    addImageEvents: function(img) {
        return img.set({
            events: {
            		
                mouseenter: function() {
                    if (this.options.showProgress && img.get("title") != null)
                        this.stats.set("html", " <span style='color:#666'>" + img.get("title") + "</span>");
                    img.set("opacity", 1);
                }.bind(this),
                mouseleave: function() {
                    if (this.options.showProgress)
                        this.stats.set("html", this.options.defaultMessage);
                    img.set("opacity", this.options.imageOpacity);
                }.bind(this)
            }
        });
    },
    getSize: function() {
        // based on mootools 1.11 getSize, gets the subcontainer size and scroll data
        this.subSize = {
            'scroll': {'x': this.subcontainer.scrollLeft, 'y': this.subcontainer.scrollTop},
            'size': {'x': this.subcontainer.offsetWidth, 'y': this.subcontainer.offsetHeight},
            'scrollSize': {'x': this.subcontainer.scrollWidth, 'y': this.subcontainer.scrollHeight}
        };
    },
    frame: function() {
        // move one frame in whatever direction and handle stop/turn around.
        if (this.moveDirection == "right") {
            this.getSize();
            this.subcontainer.scrollTo(this.subSize.scroll.x+this.options.moveSteps, 0); // number of pixels

            if (this.options.carousel) 
            {
            	var first = this.subcontainer.getElements("img.mOOimage")[0];
              if (first) 
              {
              	var firstWidth = first.getStyle("width").toInt() + this.options.imageSpacing;
              	if (this.subSize.scroll.x >= firstWidth + this.moveOffset) 
              	{
              		this.moveOffset += firstWidth;
              		this.addImageEvents(first.clone()).inject(this.subcontainer); 
              		first.removeEvents().removeClass("mOOimage").setOpacity(0.1);
              	}
              }
              return false;
            }
              	
            
            
            this.getSize();
            if (this.subSize.size.x + this.subSize.scroll.x >= this.subSize.scrollSize.x && this.subSize.scroll.x > 0) {
               
            }


        }
        else {
            this.getSize();
            this.subcontainer.scrollTo(this.subSize.scroll.x-this.options.moveSteps, 0); // move nn pixels

            this.getSize();
            if (this.subSize.scroll.x <= 0) {
                
            };
        }
    },
    move: function() {
        // drives moving
        this.stop();
        this.moveTimer = (function() {
            this.frame();
        }).periodical(this.options.moveDelay, this);
    },
    stop: function() {
        // stop moving.
        $clear(this.moveTimer);
    },
    turn: function() {
        // swap direction
        this.moveDirection = (this.moveDirection == "right") ? "left" : "right";
        this.subcontainer.getElements("img").filter(function(el) {
            return !el.hasClass("mOOimage"); // remove ghost images
        }).dispose();
    }
});

/*
 * Mooquee 	  - mootools <marquee> tag replacement
 * Version	  - 1.1
 * Created By - Robert Inglin
 * Homepage   - http://robert.ingl.in/mooquee
 * Thanks to  - *mltsy* of Mooforum.net who wrote rewrote the 
		    transition system to allow in and out style 
		    transitions and included the fade transition
 * License    - MIT License Agreement

Copyright (c) 2008 Robert Inglin

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
 */

Mooquee = new Class({
	Implements: [Options],

	options: {
		element: 'mooquee',
		cssitem: 'mooquee_item',
		firstitem:0,
		trans:{'tin':'up', 'tout':'fade'}, //each transition is up, down, left, right, fade
		pause: 1, //seconds (keep pause equal or higher to duration to allow time for items to reset) -1 = infinite pause/no loop
		duration: 1, //number of seconds to move marquee items
		overflow:'hidden', //if your item flows over how do you want to handle it. Auto(scroll) or Hidden work best...
		startOnLoad:true, // will start marquee when loaded
		pauseOnHover: true, //if true will pause all animations while mouse is hovering
		onTransitionStart: function(){},// Executes on transition start
		onTransitionComplete: function(){} // Executes on transition completion
	},
	initialize: function(options){
		this.setOptions(options);
        	this.itemFXs = [];
       	this.outDelay = 0;
        	this.inDelay = 0;
		this.started = false;
		this.currentitem = this.options.firstitem;
		if(this.options.pause!=-1)
			this.loop = true;
		else{
			this.loop = false;
			this.options.pause =2;	
		}
		this.previousitem=-1;
		if (typeof(this.options.trans) == "string") this.options.trans = {'tin':this.options.trans, 'tout':this.options.trans};
		
		window.addEvent('domready', function() {
			//get all mooqueeItems
			
			this.items = $$('#' + this.options.element + ' .' + this.options.cssitem);
			this.totalitems = this.items.length;
			if($(this.options.element).style.overflow != 'hidden')
				$(this.options.element).style.overflow = 'hidden';
			if($(this.options.element).style.position != 'relative')
				$(this.options.element).style.position = 'relative'; 

			this.setMooqueeFXs();
			this.setTrans(this.options.trans);//has setMooqueeItems in it

			if(this.options.startOnLoad)
				this.loopTimer = this.mooveAll.delay(this.options.pause*1000 ,this);
			if(this.options.pauseOnHover){
				$(this.options.element).addEvent('mouseover',function(){this.pauseMooquee()}.bind(this));
				$(this.options.element).addEvent('mouseout',function(){this.resumeMooquee()}.bind(this));
			}
		}.bind(this));
		
		
	},
	setMooqueeItems: function(){
		this.resetting =true;
		var i=0;
		
		this.items.each(function (element){
			if($(element).style.position != 'absolute')
				$(element).style.position = 'absolute';
			$(element).style.width = $(this.options.element).clientWidth + 'px';
			$(element).style.overflow = this.options.overflow;

			if(i == this.currentitem)
				this.itemFXs[i].set(this.resetStyle).set(this.inStyle);
			else
				this.itemFXs[i].set(this.resetStyle).set(this.startStyle);
           
			i++;
		}.bind(this));

		this.resetting =false;
	},
	setMooqueeFXs: function(){
		var i=0;
		this.items.each(function (element){
			this.itemFXs[i] = new Fx.Morph(element,{duration:(this.options.duration*1000)});
			i++;
		}.bind(this));
	},
	mooveAll: function(){
		if((this.currentitem + 1) == this.totalitems)
			citem = 0;
		else
			citem = this.currentitem + 1;
		this.moove(citem);

	},
	moove: function(itemnumber){
		if(itemnumber < this.totalitems)
		if(!this.mousedOver){
		if(itemnumber != this.currentitem){
			
			$clear(this.loopTimer);
			
			if(this.previousitem != -1){
				this.itemFXs[this.previousitem].cancel().set(this.resetStyle).set(this.startStyle);
				this.itemFXs[this.currentitem].cancel().set(this.resetStyle).set(this.inStyle);
				this.previousitem=-1;
			}

			this.returnpreviousitem = this.previousitem = this.currentitem;
			this.returncurrentitem = this.currentitem = itemnumber;
			this.options.onTransitionStart(this.returncurrentitem,this.returnpreviousitem);

				this.itemFXs[this.previousitem].start(this.outStyle).chain(function(){
					if(!this.resetting){
						this.itemFXs[this.previousitem].set(this.resetStyle).set(this.startStyle);
						this.previousitem=-1;
					}
				}.bind(this));

				(function(){ 
					this.itemFXs[this.currentitem].start(this.inStyle).chain(function(){
						this.options.onTransitionComplete(this.returncurrentitem,this.returnpreviousitem);
						if(this.loop == true)
							this.loopTimer = this.mooveAll.delay(this.options.pause*1000 ,this);
					}.bind(this));
				}).delay(this.inDelay*this.options.pause*1000 ,this);
			
		}
		}else{
			this.moove.delay(50 ,this,itemnumber);	
		}
		
	},
    setTrans: function(newTrans){
        this.startStyle = {}
        this.inStyle = {};
        this.outStyle = {};
        this.resetStyle = {};
        this.inDelay = 0;
        switch(newTrans.tin){
                case 'up':
                    this.startStyle = {'top': $(this.options.element).clientHeight};
                    this.inStyle = {'top': 0};
                break;
                case 'down':
                    this.startStyle = {'top': $(this.options.element).clientHeight * -1};
                    this.inStyle = {'top': 0};
                break;
                case 'left':
                    this.startStyle = {'left': $(this.options.element).clientWidth};
                    this.inStyle = {'left': 0};
                break;
                case 'right':
                    this.startStyle = {'left': $(this.options.element).clientWidth * -1};
                    this.inStyle = {'left': 0};
                break;
                case 'fade':
                    this.startStyle = {'opacity': 0};
                    this.inStyle = {'opacity': 1};
                break;
        }
        switch(newTrans.tout){
                case 'up':
                    this.outStyle = {'top': $(this.options.element).clientHeight * -1};
                    this.resetStyle = {'top': 0};
                break;
                case 'down':
                    this.outStyle = {'top': $(this.options.element).clientHeight};
                    this.resetStyle = {'top': 0};
                break;
                case 'left':
                    this.outStyle = {'left': $(this.options.element).clientWidth * -1};
                    this.resetStyle = {'left': 0};
                break;
                case 'right':
                    this.outStyle = {'left': $(this.options.element).clientWidth};
                    this.resetStyle = {'left': 0};
                break;
                case 'fade':
                    this.outStyle = {'opacity': 0};
                    this.resetStyle = {'opacity': 1};
                    this.inDelay = .5;
                break;
        }
        this.setMooqueeItems();
    },
	pauseMooquee: function(){
		if(this.previousitem != -1){
			this.itemFXs[this.previousitem].pause();
			this.itemFXs[this.currentitem].pause();
		}
		this.mousedOver = true;
	},
	resumeMooquee: function(){
		if(this.previousitem != -1){
			this.itemFXs[this.previousitem].resume();
			this.itemFXs[this.currentitem].resume();
		}
		this.mousedOver = false;
	},
	stopMooqueeLoop: function(){
		this.loop = false;
		this.options.pause = 2;
	}
});

