function ImageFlow(){this.defaults={aspectRatio:1.964,captions:true,imageCursor:"default",ImageFlowID:"imageflow",imageFocusM:1,imageFocusMax:4,imagesHeight:0.67,imagesM:1,onClick:function(){document.location=this.url;},opacity:false,opacityArray:[10,8,6,4,2],percentLandscape:118,percentOther:100,preloadImages:true,reflections:true,reflectionGET:"",reflectionP:0.5,reflectionPNG:false,scrollbarP:0.6,slider:true,sliderCursor:"e-resize",sliderWidth:14,startID:1,startAnimation:false,xStep:150,scriptPath:""};var A=this;this.init=function(F){var E=new Array("aspectRatio","captions","imageCursor","imagesM","ImageFlowID","imageFocusM","imageFocusMax","imagesHeight","onClick","opacity","opacityArray","percentLandscape","percentOther","preloadImages","reflections","reflectionGET","reflectionP","reflectionPNG","scrollbarP","slider","sliderCursor","sliderWidth","startID","startAnimation","xStep","scriptPath");var C=E.length;for(var G=0;G<C;G++){var D=E[G];this[D]=(F!==undefined&&F[D]!==undefined)?F[D]:A.defaults[D];}var I=document.getElementById(A.ImageFlowID);if(I){I.style.visibility="visible";this.ImageFlowDiv=I;if(this.createStructure()){this.imagesDiv=document.getElementById(A.ImageFlowID+"_images");this.captionDiv=document.getElementById(A.ImageFlowID+"_caption");this.scrollbarDiv=document.getElementById(A.ImageFlowID+"_scrollbar");this.sliderDiv=document.getElementById(A.ImageFlowID+"_slider");this.indexArray=[];this.current=0;this.imageID=0;this.target=0;this.memTarget=0;this.firstRefresh=true;this.firstCheck=true;this.busy=false;if(this.slider===false){this.scrollbarDiv.style.display="none";}var H=this.ImageFlowDiv.offsetWidth;var B=Math.round(H/A.aspectRatio);document.getElementById(A.ImageFlowID+"_loading_txt").style.paddingTop=((B*0.5)-22)+"px";I.style.height=B+"px";this.loadingProgress();}}};this.createStructure=function(){var G=document.createElement("div");G.setAttribute("id",A.ImageFlowID+"_images");G.setAttribute("class","images");G.setAttribute("className","images");var E=null;var L=this.ImageFlowDiv.childNodes.length;for(var J=0;J<L;J++){E=this.ImageFlowDiv.childNodes[J];if(E&&E.nodeType==1&&E.nodeName=="IMG"){if(A.reflections===true){var K="2";if(A.reflectionPNG===true){K="3";}var B=E.getAttribute("src",2);B=A.scriptPath+"reflect"+K+".php?img="+B+A.reflectionGET;E.setAttribute("src",B);}var N=E.cloneNode(true);G.appendChild(N);}}var P=document.createElement("p");var D=document.createTextNode(" ");P.setAttribute("id",A.ImageFlowID+"_loading_txt");P.appendChild(D);var C=document.createElement("div");C.setAttribute("id",A.ImageFlowID+"_loading");C.setAttribute("class","loading");C.setAttribute("className","loading");var F=document.createElement("div");F.setAttribute("id",A.ImageFlowID+"_loading_bar");F.setAttribute("class","loading_bar");F.setAttribute("className","loading_bar");C.appendChild(F);var H=document.createElement("div");H.setAttribute("id",A.ImageFlowID+"_caption");H.setAttribute("class","caption");H.setAttribute("className","caption");var M=document.createElement("div");M.setAttribute("id",A.ImageFlowID+"_scrollbar");M.setAttribute("class","scrollbar");M.setAttribute("className","scrollbar");var I=document.createElement("div");I.setAttribute("id",A.ImageFlowID+"_slider");I.setAttribute("class","slider");I.setAttribute("className","slider");M.appendChild(I);var O=false;if(A.ImageFlowDiv.appendChild(G)&&A.ImageFlowDiv.appendChild(P)&&A.ImageFlowDiv.appendChild(C)&&A.ImageFlowDiv.appendChild(H)&&A.ImageFlowDiv.appendChild(M)){for(J=0;J<L;J++){E=this.ImageFlowDiv.childNodes[J];if(E&&E.nodeType==1&&E.nodeName=="IMG"){this.ImageFlowDiv.removeChild(E);}}O=true;}return O;};this.loadingProgress=function(){var B=A.loadingStatus();if(B<100||A.firstCheck===true&&A.preloadImages===true){if(A.firstCheck===true&&B==100){A.firstCheck=false;window.setTimeout(A.loadingProgress,100);}else{window.setTimeout(A.loadingProgress,40);}}else{document.getElementById(A.ImageFlowID+"_loading_txt").style.display="none";document.getElementById(A.ImageFlowID+"_loading").style.display="none";window.setTimeout(A.addResizeEvent,1000);A.initMouseWheel();A.MouseDrag.init();A.Key.init();A.refresh(true);document.getElementById(A.ImageFlowID+"_scrollbar").style.visibility="visible";var C=A.startID-1;if(C<0){C=0;}if(C>A.max){C=A.max-1;}A.glideTo(C);if(A.startAnimation===true){A.moveTo(5000);}}};this.loadingStatus=function(){var I=A.imagesDiv.childNodes.length;var E=0,D=0;var B=null;for(var G=0;G<I;G++){B=A.imagesDiv.childNodes[G];if(B&&B.nodeType==1&&B.nodeName=="IMG"){if(B.complete===true){D++;}E++;}}var C=Math.round((D/E)*100);var H=document.getElementById(A.ImageFlowID+"_loading_bar");H.style.width=C+"%";var J=document.getElementById(A.ImageFlowID+"_loading_txt");var F=document.createTextNode("loading images "+D+"/"+E);J.replaceChild(F,J.firstChild);return C;};this.refresh=function(){this.iWidth=A.imagesDiv.offsetWidth;this.maxHeight=Math.round(A.iWidth/A.aspectRatio);this.maxFocus=A.imageFocusMax*A.xStep;this.size=A.iWidth*0.5;this.sliderWidth=A.sliderWidth*0.5;this.scrollbarWidth=(A.iWidth-(Math.round(A.sliderWidth)*2))*A.scrollbarP;this.imagesDivHeight=Math.round(A.maxHeight*A.imagesHeight);A.ImageFlowDiv.style.height=A.maxHeight+"px";A.imagesDiv.style.height=A.imagesDivHeight+"px";A.captionDiv.style.width=A.iWidth+"px";A.captionDiv.style.marginTop=Math.round(A.iWidth*0.02)+"px";A.scrollbarDiv.style.width=A.scrollbarWidth+"px";A.scrollbarDiv.style.marginTop=Math.round(A.iWidth*0.02)+"px";A.scrollbarDiv.style.marginLeft=Math.round(A.sliderWidth+((A.iWidth-A.scrollbarWidth)/2))+"px";A.sliderDiv.style.cursor=A.sliderCursor;A.sliderDiv.onmousedown=function(){A.MouseDrag.start(this);return false;};var F=(A.reflections===true)?A.reflectionP+1:1;var B=A.imagesDiv.childNodes.length;var D=0;var E=null;for(var C=0;C<B;C++){E=A.imagesDiv.childNodes[C];if(E!==null&&E.nodeType==1&&E.nodeName=="IMG"){this.indexArray[D]=C;E.url=E.getAttribute("longdesc");E.xPosition=(-D*A.xStep);E.i=D;if(A.firstRefresh){if(E.getAttribute("width")!==null&&E.getAttribute("height")!==null){E.w=E.getAttribute("width");E.h=E.getAttribute("height")*F;}else{E.w=E.width;E.h=E.height;}}if((E.w)>(E.h/(A.reflectionP+1))){E.pc=A.percentLandscape;E.pcMem=A.percentLandscape;}else{E.pc=A.percentOther;E.pcMem=A.percentOther;}E.style.cursor=A.imageCursor;D++;}}this.max=A.indexArray.length;if(A.firstRefresh){A.firstRefresh=false;}A.glideTo(A.imageID);A.moveTo(A.current);};this.moveTo=function(J){this.current=J;this.zIndex=A.max;for(var G=0;G<A.max;G++){var D=A.imagesDiv.childNodes[A.indexArray[G]];var E=G*-A.xStep;if((E+A.maxFocus)<A.memTarget||(E-A.maxFocus)>A.memTarget){D.style.visibility="hidden";D.style.display="none";}else{var H=(Math.sqrt(10000+J*J)+100)*A.imagesM;var C=J/H*A.size+A.size;D.style.display="block";var I=(D.h/D.w*D.pc)/H*A.size;var B=0;switch(I>A.maxHeight){case false:B=D.pc/H*A.size;break;default:I=A.maxHeight;B=D.w*I/D.h;break;}var F=(A.imagesDivHeight-I)+((I/(A.reflectionP+1))*A.reflectionP);D.style.left=C-(D.pc/2)/H*A.size+"px";if(B&&I){D.style.height=I+"px";D.style.width=B+"px";D.style.top=F+"px";}D.style.visibility="visible";switch(J<0){case true:this.zIndex++;break;default:this.zIndex=A.zIndex-1;break;}switch(D.i==A.imageID){case false:D.onclick=function(){A.glideTo(this.i);};break;default:this.zIndex=A.zIndex+1;if(D.url!==""){D.onclick=A.onClick;}break;}D.style.zIndex=A.zIndex;}J+=A.xStep;}};this.glideTo=function(E){var B=-E*A.xStep;this.target=B;this.memTarget=B;this.imageID=E;var D=A.imagesDiv.childNodes[E].getAttribute("alt");if(D===""||A.captions===false){D="&nbsp;";}A.captionDiv.innerHTML=D;if(A.MouseDrag.busy===false){this.newSliderX=(E*A.scrollbarWidth)/(A.max-1)-A.MouseDrag.newX;A.sliderDiv.style.marginLeft=(A.newSliderX-A.sliderWidth)+"px";}if(A.opacity===true||A.imageFocusM!==A.defaults.imageFocusM){A.setOpacity(A.imagesDiv.childNodes[E],A.opacityArray[0]);A.imagesDiv.childNodes[E].pc=A.imagesDiv.childNodes[E].pc*A.imageFocusM;var C=0;var I=0;var G=0;var H=A.opacityArray.length;for(var F=1;F<(A.imageFocusMax+1);F++){if((F+1)>H){C=A.opacityArray[H-1];}else{C=A.opacityArray[F];}I=E+F;G=E-F;if(I<A.max){A.setOpacity(A.imagesDiv.childNodes[I],C);A.imagesDiv.childNodes[I].pc=A.imagesDiv.childNodes[I].pcMem;}if(G>=0){A.setOpacity(A.imagesDiv.childNodes[G],C);A.imagesDiv.childNodes[G].pc=A.imagesDiv.childNodes[G].pcMem;}}}if(A.busy===false){window.setTimeout(A.animate,50);A.busy=true;}};this.animate=function(){switch(A.target<A.current-1||A.target>A.current+1){case true:A.moveTo(A.current+(A.target-A.current)/3);window.setTimeout(A.animate,50);A.busy=true;break;default:A.busy=false;break;}};this.setOpacity=function(B,C){if(A.opacity===true){B.style.opacity=C/10;B.style.filter="alpha(opacity="+C*10+")";}};this.initMouseWheel=function(){if(window.addEventListener){A.ImageFlowDiv.addEventListener("DOMMouseScroll",A.eventMouseWheel,false);}A.ImageFlowDiv.onmousewheel=A.eventMouseWheel;};this.eventMouseWheel=function(B){var C=0;if(!B){B=window.event;}if(B.wheelDelta){C=B.wheelDelta/120;}else{if(B.detail){C=-B.detail/3;}}if(C){A.handleMouseWheel(C);}if(B.preventDefault){B.preventDefault();}B.returnValue=false;};this.handleMouseWheel=function(D){var C=false;var B=0;if(D>0){if(A.imageID>=1){B=A.imageID-1;C=true;}}else{if(A.imageID<(A.max-1)){B=A.imageID+1;C=true;}}if(C===true){A.glideTo(B);}};this.MouseDrag={object:null,objectX:0,mouseX:0,newX:0,busy:false,init:function(){A.addEvent(A.ImageFlowDiv,"mousemove",A.MouseDrag.drag);A.addEvent(A.ImageFlowDiv,"mouseup",A.MouseDrag.stop);A.addEvent(document,"mouseup",A.MouseDrag.stop);A.ImageFlowDiv.onselectstart=function(){var B=true;if(A.MouseDrag.busy===true){B=false;}return B;};},start:function(B){A.MouseDrag.object=B;A.MouseDrag.objectX=A.MouseDrag.mouseX-B.offsetLeft+A.newSliderX;},stop:function(){A.MouseDrag.object=null;A.MouseDrag.busy=false;},drag:function(E){var B=0;if(!E){E=window.event;}if(E.pageX){B=E.pageX;}else{if(E.clientX){B=E.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;}}A.MouseDrag.mouseX=B;if(A.MouseDrag.object!==null){var F=(A.MouseDrag.mouseX-A.MouseDrag.objectX)+A.sliderWidth;if(F<(-A.newSliderX)){F=-A.newSliderX;}if(F>(A.scrollbarWidth-A.newSliderX)){F=A.scrollbarWidth-A.newSliderX;}var D=(F+A.newSliderX)/(A.scrollbarWidth/(A.max-1));var C=Math.round(D);A.MouseDrag.newX=F;A.MouseDrag.object.style.left=F+"px";if(A.imageID!==C){A.glideTo(C);}A.MouseDrag.busy=true;}}};this.Key={init:function(){document.onkeydown=function(B){A.Key.handle(B);};},handle:function(C){var B=A.Key.get(C);switch(B){case 39:A.handleMouseWheel(-1);break;case 37:A.handleMouseWheel(1);break;}},get:function(B){B=B||window.event;return B.keyCode;}};this.addEvent=function(D,C,B){if(D.addEventListener){D.addEventListener(C,B,false);}else{if(D.attachEvent){D["e"+C+B]=B;D[C+B]=function(){D["e"+C+B](window.event);};D.attachEvent("on"+C,D[C+B]);}}};this.addResizeEvent=function(){var B=window.onresize;if(typeof window.onresize!="function"){window.onresize=function(){A.refresh();};}else{window.onresize=function(){if(B){B();}A.refresh();};}};}var domReadyEvent={name:"domReadyEvent",events:{},domReadyID:1,bDone:false,DOMContentLoadedCustom:null,add:function(A){if(!A.$$domReadyID){A.$$domReadyID=this.domReadyID++;if(this.bDone){A();}this.events[A.$$domReadyID]=A;}},remove:function(A){if(A.$$domReadyID){delete this.events[A.$$domReadyID];}},run:function(){if(this.bDone){return ;}this.bDone=true;for(var A in this.events){this.events[A]();}},schedule:function(){if(this.bDone){return ;}if(/KHTML|WebKit/i.test(navigator.userAgent)){if(/loaded|complete/.test(document.readyState)){this.run();}else{setTimeout(this.name+".schedule()",100);}}else{if(document.getElementById("__ie_onload")){return true;}}if(typeof this.DOMContentLoadedCustom==="function"){if(typeof document.getElementsByTagName!=="undefined"&&(document.getElementsByTagName("body")[0]!==null||document.body!==null)){if(this.DOMContentLoadedCustom()){this.run();}else{setTimeout(this.name+".schedule()",250);}}}return true;},init:function(){if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){domReadyEvent.run();},false);}setTimeout("domReadyEvent.schedule()",100);function run(){domReadyEvent.run();}if(typeof addEvent!=="undefined"){addEvent(window,"load",run);}else{if(document.addEventListener){document.addEventListener("load",run,false);}else{if(typeof window.onload==="function"){var oldonload=window.onload;window.onload=function(){domReadyEvent.run();oldonload();};}else{window.onload=run;}}}
/*@cc_on
			@if (@_win32 || @_win64)
			document.write("<script id=__ie_onload defer src=\"//:\"><\/script>");
			var script = document.getElementById("__ie_onload");
			script.onreadystatechange = function()
			{
				if (this.readyState == "complete")
				{
					domReadyEvent.run(); // call the onload handler
				}
			};
			@end
		@*/
}};var domReady=function(A){domReadyEvent.add(A);};domReadyEvent.init();domReady(function(){var A=new ImageFlow();A.init({ImageFlowID:"myImageFlow"});});
