Re-uploading www directory: 02 Sep 2010 19:05 GTM+1
[dtn] / www / DTN_Technical_Details / Scripts / iWPopUpSlideshow.js
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 //  iWeb - iWPopUpSlideshow.js
4 //  Copyright (c) 2007-2008 Apple Inc. All rights reserved.
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 var slideWidth;var slideHeight;var frameHeight;var frameWidth;var scroller;var slideshow;var thumbnails;var hud;var thumbMatte=89;var pickerHeight=100;var browser;var baseURL="http://www.me.com/1/slideshow/";var windowWidth=800;var windowHeight=800;function initSlideshow(imageStream,index,parameters){browser=new BrowserDetectLite();if(checkBrowser())
9 {alphaRules();if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)
10 {windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}
11 else if(self.innerWidth&&self.innerHeight)
12 {windowWidth=self.innerWidth;windowHeight=self.innerHeight;}
13 else if(document.body&&document.body.clientWidth&&document.body.clientHeight)
14 {windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
15 slideWidth=windowWidth-200;slideHeight=windowHeight-290;frameHeight=slideHeight+50;frameWidth=slideWidth-20;var frame=appendDiv(document.body,'frame',frameWidth,frameHeight);var frameTop=Math.max(Math.round((windowHeight-frameHeight)/2),0);frame.style.marginTop=frameTop+'px';var slideMatte=appendDiv(frame,'matte',slideWidth,frameHeight);slideMatte.style.marginLeft=Math.round((frameWidth-slideWidth)/2)+"px";slideMatte.style.marginRight=Math.round((frameWidth-slideWidth)/2)+"px";var photos=[];for(var i=0;i<imageStream.length;++i)
16 {photos.push(imageStream[i].slideshowValue("image"));}
17 function onchange(index)
18 {selectThumb(index);}
19 parameters.movieMode=kAutoplayMovie;slideshow=new Slideshow(slideMatte,photos,onchange,parameters);if(parameters.hasOwnProperty("transitionIndex"))
20 {slideshow.setTransitionIndex(parameters.transitionIndex,0);}
21 initControls();var initThumbFade=function(){thumbnails.fadeHandler=null;thumbnails.fade(0.80,0,4000);};var initControlFade=function(){hud.fadeHandler=null;hud.fade(0.80,0,4000);};initThumbnailPicker(index!=null?index:0,imageStream);thumbnails.fadeHandler=setTimeout(initThumbFade,1000);hud.fadeHandler=setTimeout(initControlFade,1000);slideshow.playHandler=setTimeout(beginPlay.bind(null,index),0);addEvent(document,'onkeydown',arrowKeyDown,true);addEvent(document,'onkeyup',arrowKeyUp,true);}}
22 function beginPlay(index)
23 {clearInterval(slideshow.playHandler);slideshow.playHandler=null;if(index!=null&&index>0)
24 {slideshow.paused=false;slideshow.showPhotoNumber(index,true);}
25 else
26 {slideshow.start();}}
27 function initThumbnailPicker(startPoint,imageStream)
28 {var thumbnailZone=appendDiv(document.body,'thumbnailZone');var thumbnailPicker=appendDiv(thumbnailZone,'thumbnailPicker');var thumbStrip=appendDiv(thumbnailPicker,'thumbStrip');var pickerWidth=Math.min((imageStream.length*89)+2,frameWidth);thumbnailZone.style.width=windowWidth+"px";thumbnailZone.style.height=pickerHeight+25+"px";thumbnailZone.style.top="10px";thumbnailPicker.style.width=pickerWidth+"px";thumbnailPicker.style.height=pickerHeight+"px";thumbnailPicker.style.left=Math.round((windowWidth-pickerWidth)/2)+"px";thumbStrip.style.left='0px';$(thumbnailPicker).setOpacity(thumbnailPicker,0.8);addEvent(thumbnailZone,'onmouseover',thumbnailFadeIn,false);addEvent(thumbnailZone,'onmouseout',thumbnailFadeOut,false);var results=generateThumbs(imageStream);selectThumb(startPoint);initScroller(startPoint);thumbnails=new hoverControls('thumbnailPicker');}
29 function initControls(){var controlZone=appendDiv(document.body,'controlZone');var controls=appendDiv(controlZone,'controls');var backButton;var forwardButton;var playButton;var pauseButton;var frameTop=Math.max(Math.round((windowHeight-frameHeight)/2),0);controlZone.style.top=frameTop+frameHeight+"px";if($('matte').style.marginLeft){controls.style.left=Math.round((windowWidth-177)/2)+parseInt($('matte').style.marginLeft,10)+"px";}else{controls.style.left=Math.round((windowWidth-177)/2)+parseInt($('matte').offsetLeft,10)+"px";}
30 if(browser.supportsPNGs){backButton=appendImage(controls,baseURL+'images/arrow_left.png','backbutton');playButton=appendImage(controls,baseURL+'images/play.png','playbutton',null,null,true);pauseButton=appendImage(controls,baseURL+'images/pause.png','pausebutton');forwardButton=appendImage(controls,baseURL+'images/arrow_right.png','forwardbutton');}else{controls.style.background='url('+baseURL+'images/controls.gif) center center no-repeat';backButton=appendImage(controls,baseURL+'images/arrow_left.gif','backbutton');playButton=appendImage(controls,baseURL+'images/play.gif','playbutton',null,null,true);pauseButton=appendImage(controls,baseURL+'images/pause.gif','pausebutton');forwardButton=appendImage(controls,baseURL+'images/arrow_right.gif','forwardbutton');}
31 $(controls).setOpacity(0.8);addEvent(backButton,'onmousedown',backClick,false);addEvent(backButton,'onmouseup',previous,false);addEvent(playButton,'onmousedown',playClick,false);addEvent(playButton,'onmouseup',restart,false);addEvent(pauseButton,'onmousedown',pauseClick,false);addEvent(pauseButton,'onmouseup',stop,false);addEvent(forwardButton,'onmousedown',forwardClick,false);addEvent(forwardButton,'onmouseup',next,false);addEvent(controlZone,'onmouseover',hudFadeIn);addEvent(controlZone,'onmouseout',hudFadeOut);hud=new hoverControls('controls');}
32 function selectThumb(index)
33 {var thumbPicker=$('thumbStrip');var thumbs=thumbPicker.select('img');for(var i=0;i<thumbs.length;++i)
34 {var thumb=thumbs[i];var className=(i==index)?'selectedthumb':'thumb';if(thumb.className!=className)
35 {thumb.className=className;}}}
36 var thumbWidth=69;var thumbHeight=69;function thumbnailLoaded(thumbnail,index)
37 {var thumbPicker=$('thumbStrip');var thumbPickerPlaceholder=$('thumb'+index);if(thumbPickerPlaceholder)
38 {var naturalSize=thumbnail.naturalSize();var imageScale=thumbWidth/naturalSize.width<thumbHeight/naturalSize.height?thumbWidth/naturalSize.width:thumbHeight/naturalSize.height;var scaledWidth=naturalSize.width*imageScale;var scaledHeight=naturalSize.height*imageScale;var horizontalMargin=px(Math.round((thumbWidth-scaledWidth)/2)+7);var verticalMargin=px(Math.round((thumbHeight-scaledHeight)/2));thumbPickerPlaceholder.width=scaledWidth;thumbPickerPlaceholder.height=scaledHeight;thumbPickerPlaceholder.setStyle({margin:verticalMargin+" "+horizontalMargin});thumbPickerPlaceholder.src=thumbnail.sourceURL();}
39 else
40 {setTimeout(thumbnailLoaded.bind(null,thumbnail,index),100);}}
41 function generateThumbs(imageStream)
42 {var thumbPicker=$('thumbStrip');thumbPicker.style.width=(imageStream.length*89)+"px";var markup="";for(var i=0,len=imageStream.length;i<len;++i)
43 {markup+='<img width="'+thumbWidth+'" height="'+thumbHeight+'" id="thumb'+i+'" style="margin: 0 7px" onclick="selectThumb('+i+'); slideshow.showPhotoNumber('+i+', true);" onfocus="blur()">';}
44 thumbPicker.innerHTML=markup;var index=0;$A(imageStream).invoke('micro').each(function(thumbnail){thumbnail.load(thumbnailLoaded.bind(null,thumbnail,index),index>=10);index++;});return true;}
45 function initScroller(startPoint){var thumbZone=$('thumbnailPicker');var scrollbar=appendDiv(thumbZone,"scrollbar");scrollbar.style.top="84px";scrollbar.style.left=0;scrollbar.style.width=thumbZone.getWidth()-2+"px";scrollbar.style.height="15px";var bar=appendDiv(scrollbar,"bar");bar.style.top=0;bar.style.left=0;bar.style.width="100%";bar.style.height="13px";var dragTool=appendDiv(scrollbar,"dragtool");dragTool.style.top="1px";dragTool.style.left=0;dragTool.style.width="26px";dragTool.style.height="13px";dragTool=$(appendImage(dragTool,'http://www.me.com/1/slideshow/images/dragger.gif',null,24,13));dragTool.setStyle({margin:'0 1px'});var ruler=appendDiv(scrollbar,"ruler");ruler.style.top=0;ruler.style.left=0;scroller=new Scroller();if(startPoint!=null){scroller.jumpTo(startPoint);}
46 if(browser.isIE6x&&browser.isWin){scrollbar.style.top=parseInt(scrollbar.style.top,10)-2+'px';bar.style.height=parseInt(bar.style.height,10)+2+'px';scrollbar.style.width=parseInt(scrollbar.style.width,10)+2+'px';}else if(browser.isSafariJaguar){bar.style.width=$('thumbnailPicker').getWidth()-3+'px';}}
47 function checkBrowser(){var languageinfo=getLanguage();if(browser.isSafari||browser.isFirefox1up||browser.isNS7up||browser.isIE55up||browser.isCamino){return true;}else if(getCookie('browsewarning')=='true'){return true;}else{setCookie('browsewarning','true');setCookie('continue',window.location.href);switch(languageinfo){case'de':window.location=baseURL+'messaging/4/browser_req.html';break;case'fr':window.location=baseURL+'messaging/3/browser_req.html';break;case'ja':window.location=baseURL+'messaging/2/browser_req.html';break;default:window.location=baseURL+'messaging/1/browser_req.html';}
48 return false;}}
49 function thumbnailFadeIn(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseEnter($('thumbnailZone'),evt)){if(!thumbnails.holdFade){scroller.jumpTo(slideshow.currentPhotoNumber);slideshow.pause();thumbnails.fade(0.90,0.90,0);}}}catch(e){}}
50 function thumbnailFadeOut(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseLeave($('thumbnailZone'),evt)){if(!thumbnails.holdFade){thumbnails.fade(0.30,0,2000);if(slideshow.playHandler===null){slideshow.resume();}}}}catch(e){}}
51 function hudFadeIn(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseEnter($('controlZone'),evt)){hud.fade(0.80,0.80,0);}}catch(e){}}
52 function hudFadeOut(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseLeave($('controlZone'),evt)&&$(controls).getOpacity()>0.05){hud.fade(0.40,0,2000);if(slideshow.playHandler===null){slideshow.resume();}}}catch(e){}}
53 function stop(){slideshow.pause();slideshow.playHandler=-1;$('playbutton').style.display='';$('pausebutton').src=browser.supportsPNGs?baseURL+'images/pause.png':baseURL+'images/pause.gif';$('pausebutton').style.display='none';return false;}
54 function pauseClick(){$('pausebutton').src=browser.supportsPNGs?baseURL+'images/pause_on.png':baseURL+'images/pause_on.gif';return false;}
55 function restart(){slideshow.playHandler=null;$('pausebutton').style.display='';$('playbutton').src=browser.supportsPNGs?baseURL+'images/play.png':baseURL+'images/play.gif';$('playbutton').style.display='none';if($('controls').getOpacity()>0.05)
56 {hud.fade(0.90,0,5000);}
57 slideshow.playHandler=setTimeout(function(){slideshow.resume();},1500);}
58 function playClick(){$('playbutton').src=browser.supportsPNGs?baseURL+'images/play_on.png':baseURL+'images/play_on.gif';return false;}
59 function forwardClick(){$('forwardbutton').src=browser.supportsPNGs?baseURL+'images/arrow_right_on.png':baseURL+'images/arrow_right_on.gif';return false;}
60 function next(){$('forwardbutton').src=browser.supportsPNGs?baseURL+'images/arrow_right.png':baseURL+'images/arrow_right.gif';slideshow.advance();return false;}
61 function backClick(){$('backbutton').src=browser.supportsPNGs?baseURL+'images/arrow_left_on.png':baseURL+'images/arrow_left_on.gif';return false;}
62 function previous(){$('backbutton').src=browser.supportsPNGs?baseURL+'images/arrow_left.png':baseURL+'images/arrow_left.gif';slideshow.goBack();return false;}
63 function arrowKeyDown(evt){evt=(evt)?evt:((window.event)?window.event:"");var keyCode=evt.which?evt.which:evt.keyCode;switch(keyCode){case 39:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
64 forwardClick();break;case 34:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
65 forwardClick();break;case 37:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
66 backClick();break;case 33:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
67 backClick();break;case 32:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
68 if(slideshow.playHandler==-1){playClick();}else{pauseClick();}
69 break;}
70 if((slideshow.photos.length*thumbMatte)>(scroller.getContentClipW()-scroller.getContentL())){scroller.jumpTo(slideshow.currentPhotoNumber,'left');}else if((slideshow.photos.length*thumbMatte)<-scroller.getContentL()){scroller.jumpTo(slideshow.currentPhotoNumber,'right');}}
71 function arrowKeyUp(evt){evt=(evt)?evt:((window.event)?window.event:"");var keyCode=evt.which?evt.which:evt.keyCode;switch(keyCode){case 39:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
72 next();break;case 34:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
73 next();break;case 37:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
74 previous();break;case 33:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
75 previous();break;case 32:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
76 if(slideshow.playHandler==-1){restart();}else{stop();}
77 break;case 36:slideshow.pause();slideshow.resetSlideshow(0);if(slideshow.playHandler!=-1){slideshow.play();}
78 break;case 35:slideshow.pause();slideshow.resetSlideshow(slideshow.photos.length-1);if(slideshow.playHandler!=-1){slideshow.play();}
79 break;}
80 if((slideshow.currentPhotoNumber*thumbMatte)>(scroller.getContentClipW()-scroller.getContentL())){scroller.jumpTo(slideshow.currentPhotoNumber,'left');}else if((slideshow.currentPhotoNumber*thumbMatte)<-scroller.getContentL()){scroller.jumpTo(slideshow.currentPhotoNumber,'right');}}
81 function heightOffset(browser){if(browser.isIE5xMac){return 15;}else if(browser.isSafari){return 23;}else if(browser.isFirefox&&browser.isWin){return 25;}else if(browser.isNS6up&&browser.isWin){return 30;}else if(browser.isCamino){return 40;}else if(browser.isMozilla){return 42;}else if(browser.isIEWin){return 49;}else{return 0;}}
82 function widthOffset(browser){if(browser.isIE5xMac){return 5;}else{return 0;}}
83 function BrowserDetectLite(){var ua=navigator.userAgent.toLowerCase();this.ua=ua;this.isGecko=(ua.indexOf('gecko')!=-1);this.isMozilla=(this.isGecko&&ua.indexOf("gecko/")+14==ua.length);this.isFirefox=(this.isGecko&&ua.indexOf("firefox")!=-1);this.isCamino=(this.isGecko&&ua.indexOf("camino")!=-1);this.isSafari=(this.isGecko&&ua.indexOf("safari")!=-1);this.isNS=((this.isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('opera')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));this.isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));this.isOpera=(ua.indexOf("opera")!=-1);this.isKonqueror=(ua.indexOf("konqueror")!=-1);this.isIcab=(ua.indexOf("icab")!=-1);this.isAol=(ua.indexOf("aol")!=-1);this.isWebtv=(ua.indexOf("webtv")!=-1);this.isOmniweb=(ua.indexOf("omniweb")!=-1);this.isDreamcast=(ua.indexOf("dreamcast")!=-1);this.isIECompatible=((ua.indexOf("msie")!=-1)&&!this.isIE);this.isNSCompatible=((ua.indexOf("mozilla")!=-1)&&!this.isNS&&!this.isMozilla);this.versionMinor=parseFloat(navigator.appVersion);if(this.isNS&&this.isGecko){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
84 else if(this.isFirefox){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
85 else if(this.isSafari){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
86 else if(this.isIE&&this.versionMinor>=4){this.versionMinor=parseFloat(ua.substring(ua.indexOf('msie ')+5));}
87 else if(this.isOpera){if(ua.indexOf('opera/')!=-1){this.versionMinor=parseFloat(ua.substring(ua.indexOf('opera/')+6));}
88 else{this.versionMinor=parseFloat(ua.substring(ua.indexOf('opera ')+6));}}
89 else if(this.isKonqueror){this.versionMinor=parseFloat(ua.substring(ua.indexOf('konqueror/')+10));}
90 else if(this.isIcab){if(ua.indexOf('icab/')!=-1){this.versionMinor=parseFloat(ua.substring(ua.indexOf('icab/')+6));}
91 else{this.versionMinor=parseFloat(ua.substring(ua.indexOf('icab ')+6));}}
92 else if(this.isWebtv){this.versionMinor=parseFloat(ua.substring(ua.indexOf('webtv/')+6));}
93 this.versionMajor=parseInt(this.versionMinor,10);this.geckoVersion=((this.isGecko)?ua.substring((ua.lastIndexOf('gecko/')+6),(ua.lastIndexOf('gecko/')+14)):-1);this.isWin=(ua.indexOf('win')!=-1);this.isWin32=(this.isWin&&(ua.indexOf('95')!=-1||ua.indexOf('98')!=-1||ua.indexOf('nt')!=-1||ua.indexOf('win32')!=-1||ua.indexOf('32bit')!=-1));this.isMac=(ua.indexOf('mac')!=-1);this.isUnix=(ua.indexOf('unix')!=-1||ua.indexOf('linux')!=-1||ua.indexOf('sunos')!=-1||ua.indexOf('bsd')!=-1||ua.indexOf('x11')!=-1);this.isNS4below=(this.isNS&&this.versionMajor<=4);this.isNS4x=(this.isNS&&this.versionMajor==4);this.isNS40x=(this.isNS4x&&this.versionMinor<4.5);this.isNS47x=(this.isNS4x&&this.versionMinor>=4.7);this.isNS4up=(this.isNS&&this.versionMinor>=4);this.isNS6x=(this.isNS&&this.versionMajor==6);this.isNS6up=(this.isNS&&this.versionMajor>=6);this.isNS7up=(this.isNS&&this.versionMajor>=7);this.isIEWin=(this.isIE&this.isWin);this.isIE4below=(this.isIE&&this.versionMajor<=4);this.isIE4x=(this.isIE&&this.versionMajor==4);this.isIE4up=(this.isIE&&this.versionMajor>=4);this.isIE5x=(this.isIE&&this.versionMajor==5);this.isIE55=(this.isIE&&this.versionMinor==5.5);this.isIE5up=(this.isIE&&this.versionMajor>=5);this.isIE55up=(this.isIE&&this.versionMinor>=5.5);this.isIE6x=(this.isIE&&this.versionMajor==6);this.isIE6up=(this.isIE&&this.versionMajor>=6);this.isIE7x=(this.isIE&&this.versionMajor==7);this.isIE7up=(this.isIE&&this.versionMajor>=7);this.isIE8x=(this.isIE&&this.versionMajor==8);this.isIE8up=(this.isIE&&this.versionMajor>=8);this.isSafariJaguar=(this.isSafari&&this.versionMajor<100);this.isFirefox1up=(this.isFirefox&&this.versionMinor>=1);this.isIE4xMac=(this.isIE4x&&this.isMac);this.isIE5xMac=(this.isIE5up&&this.isMac);this.supportsOnload=(!this.isOpera&&!this.isIcab&&!this.isIE4below&&!this.isNS4below);this.supportsPNGs=(!this.isIE||this.versionMajor>=8);}
94 function getLanguage(){var languageInfo;languageInfo=navigator.language?navigator.language:(navigator.userLanguage?navigator.userLanguage:"");if(languageInfo.indexOf('-')>-1){languageInfo=languageInfo.substr(0,2);}
95 return languageInfo;}
96 function alphaRules(){if(browser===null){browser=new BrowserDetectLite();}
97 if(browser.isWin&&browser.isIE){document.styleSheets[0].addRule("img","filter: alpha(opacity=100)",0);}}
98 function appendDiv(parentObj,divId,width,height,makeInvisible){var divObj=document.createElement('div');if(width!=null){divObj.style.width=width+'px';}
99 if(height!=null){divObj.style.height=height+'px';}
100 if(makeInvisible){divObj.style.display='none';}
101 divObj=parentObj.appendChild(divObj);if(divId!=null){divObj.setAttribute('id',divId);}
102 return divObj;}
103 function appendImage(parentObj,src,imgId,width,height,makeInvisible){var imgObj=document.createElement('img');imgObj.src=src;if(width!=null){imgObj.style.width=width+'px';}
104 if(height!=null){imgObj.style.height=height+'px';}
105 if(makeInvisible){imgObj.style.display='none';}
106 imgObj=parentObj.appendChild(imgObj);if(imgId!=null){imgObj.setAttribute('id',imgId);}
107 return imgObj;}
108 function addEvent(object,event,functionName,capture)
109 {if(object.addEventListener)
110 {event=event.length>2?event.substring(2):event;capture=capture?capture:false;object.addEventListener(event,functionName,capture);}
111 else if(object.attachEvent)
112 {object.attachEvent(event,functionName);}
113 else
114 {try
115 {object.setAttribute(event,functionName);}
116 catch(e)
117 {}}}
118 function hoverControls(divId){this.timer=1;this.fadeHandler=null;this.divId=divId;this.start=null;this.end=null;this.holdFade=false;this.restartFade=false;var me=this;this.fade=function(start,end,ms)
119 {start=$(this.divId).getOpacity();if(this.animation)
120 {this.animation.stop();}
121 if(this.fadeHandler)
122 {clearInterval(this.fadeHandler);}
123 this.animation=new SimpleAnimation(function(){});this.animation.startOpacity=start;this.animation.endOpacity=end;this.animation.duration=ms;this.animation.pre=function()
124 {$(me.divId).setOpacity(this.startOpacity);}
125 this.animation.post=function()
126 {$(me.divId).setOpacity(this.endOpacity);}
127 this.animation.update=function(now)
128 {$(me.divId).setOpacity(this.startOpacity+now*(this.endOpacity-this.startOpacity));}
129 this.animation.start();}}
130 function Scroller(){var scrollW=$('thumbnailPicker').getWidth();var speed=4;var mouseY;var mouseX;var clickLeft=false;var clickRight=false;var clickDrag=false;var timer=setTimeout(function(){},500);var leftL;var leftT;var rightL;var rightT;var dragL;var dragT;var rulerL;var rulerT;var contentL;var contentW;var contentClipW;var scrollLength;var startX;var scrollbarOffset;var leftH;var leftW;var rightH;var rightW;var dragH;var dragW;var me=this;var eventLoader=function eventLoader(){scrollbarOffset=IWChildOffset($('scrollbar'),document.body);dragL=parseInt($('dragtool').style.left,10);dragT=parseInt($('dragtool').style.top,10);rulerT=parseInt($('ruler').style.top,10);rulerL=parseInt($('ruler').style.left,10);contentW=$('thumbStrip').getWidth();contentClipW=$('thumbnailPicker').getWidth();dragH=$('dragtool').getHeight();dragW=$('dragtool').getWidth();scrollLength=((scrollW-dragW)/(contentW-contentClipW));window.onresize=me.resetPosition;if(contentW<contentClipW){$('scrollbar').style.display='none';}
131 document.onmousedown=down;document.onmousemove=move;document.onmouseup=up;};this.resetPosition=function resetPosition(){scrollbarOffset=IWChildOffset($('scrollbar'),document.body);};var down=function down(e){getMouse(e);startX=(mouseX-dragL);if(mouseX>=leftL&&(mouseX<=(leftL+leftW))&&mouseY>=leftT&&(mouseY<=(leftT+leftH))){clickLeft=true;return me.scrollLeft();}
132 else if(mouseX>=rightL&&(mouseX<=(rightL+rightW))&&mouseY>=rightT&&(mouseY<=(rightT+rightH))){clickRight=true;return me.scrollRight();}
133 else if(mouseY>=dragT&&(mouseY<=(dragT+dragH+4))&&mouseX>=rulerL&&(mouseX<=(rulerL+scrollW))){clickDrag=true;if(thumbnails){thumbnails.holdFade=true;}
134 return move(e);}
135 else{return true;}};var move=function move(e){if(clickDrag&&contentW>contentClipW){getMouse(e);dragL=mouseX-(dragW/2);if(dragL<(rulerL)){dragL=rulerL;}
136 if(dragL>(rulerL+scrollW-dragW)){dragL=(rulerL+scrollW-dragW);}
137 contentL=-((dragL-rulerL)*(1/scrollLength));moveTo();return false;}};var up=function(e){clearTimeout(timer);clickLeft=false;clickRight=false;clickDrag=false;if(thumbnails&&thumbnails.holdFade){thumbnails.holdFade=false;getMouse(e);var thumbZone=$('thumbnailZone');var zoneOffset=IWChildOffset(thumbZone,document.body);var zoneR=zoneOffset.x+thumbZone.getWidth();var zoneB=zoneOffset.y+thumbZone.getHeight();if((mouseX+scrollbarOffset.x)>zoneOffset.x&&(mouseX+scrollbarOffset.x)<zoneR&&(mouseY+scrollbarOffset.y)>zoneOffset.y&&(mouseY+scrollbarOffset.y)<zoneB){}else{thumbnails.fade(0.30,0,2000);slideshow.resume();}}
138 return true;};var getL=function getL(){contentL=parseInt($('thumbStrip').style.left,10);};var getMouse=function getMouse(e){if(typeof scrollbarOffset=='undefined'||typeof rightOffset=='undefined'){me.resetPosition();}
139 if(typeof event!='undefined'){mouseY=event.clientY+document.body.scrollTop-scrollbarOffset.y;mouseX=event.clientX+document.body.scrollLeft-scrollbarOffset.x;}else{mouseY=e.pageY-scrollbarOffset.y;mouseX=e.pageX-scrollbarOffset.x;}};this.jumpTo=function jumpTo(slideCount,slidePosition){if(contentW>contentClipW){getL();if(slidePosition=='left'){contentL=(-slideCount*thumbMatte);}else if(slidePosition=='right'){contentL=(-slideCount*thumbMatte)+contentClipW;}else{contentL=Math.round((contentClipW/2)-(slideCount*thumbMatte)-(thumbMatte/2));}
140 if(contentL<scrollW-contentW){contentL=scrollW-contentW;}else if(contentL>0){contentL=0;}
141 dragL=contentL*(scrollW-dragW)/(scrollW-contentW);if(dragL<0){dragL=0;}
142 return moveTo();}else{return false;}};var moveTo=function moveTo(){$('thumbStrip').style.left=contentL+"px";$('dragtool').style.left=dragL+"px";$('ruler').style.left=dragL+"px";return true;};this.scrollLeft=function scrollLeft(){getL();if(clickLeft&&contentW>contentClipW){if(contentL<0){dragL=dragL-(speed*scrollLength);if(dragL<(rulerL))
143 {dragL=rulerL;}
144 contentL=contentL+speed;if(contentL>0)
145 {contentL=0;}
146 moveTo();timer=setTimeout(me.scrollLeft,25);}}
147 return false;};this.scrollRight=function scrollRight(){getL();if(clickRight&&contentW>contentClipW){if(contentL>-(contentW-contentClipW)){dragL=dragL+(speed*scrollLength);if(dragL>(rulerL+scrollW-dragH))
148 {dragL=(rulerL+scrollW-dragH);}
149 contentL=contentL-speed;if(contentL<-(contentW-contentClipW))
150 {contentL=-(contentW-contentClipW);}
151 moveTo();timer=setTimeout(me.scrollRight,25);}}
152 return false;};this.getContentL=function getContentL(){return contentL;};this.getContentW=function getContentW(){return contentW;};this.getContentClipL=function getContentClipL(){return contentClipL;};this.getContentClipW=function getContentClipW(){return contentClipW;};eventLoader();}
153 function isParent(container,containee){var isParentBool=false;while(!isParentBool&&containee){isParentBool=container==containee;containee=containee.parentNode;}
154 return isParentBool;}
155 function checkMouseEnter(element,evt){if(evt.fromElement){return!isParent(element,evt.fromElement);}
156 else if(evt.relatedTarget){return!isParent(element,evt.relatedTarget);}
157 else{return true;}}
158 function checkMouseLeave(element,evt){if(evt.toElement){return!isParent(element,evt.toElement);}
159 else if(evt.relatedTarget){return!isParent(element,evt.relatedTarget);}
160 else{return true;}}
161 function setCookie(c_name,value)
162 {document.cookie=c_name+"="+escape(value);}
163 function getCookie(c_name)
164 {if(document.cookie.length>0)
165 {c_start=document.cookie.indexOf(c_name+"=")
166 if(c_start!=-1)
167 {c_start=c_start+c_name.length+1
168 c_end=document.cookie.indexOf(";",c_start)
169 if(c_end==-1)c_end=document.cookie.length
170 return unescape(document.cookie.substring(c_start,c_end))}}
171 return""}