function ImageFlow(){this.defaults={aspectRatio:1.964,buttons:false,captions:true,imageCursor:"default",ImageFlowID:"imageflow",imageFocusM:1,imageFocusMax:4,imageScaling:true,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};var a=this;this.init=function(f){var e=["aspectRatio","buttons","captions","imageCursor","imagesM","ImageFlowID","imageFocusM","imageFocusMax","imagesHeight","onClick","opacity","opacityArray","percentLandscape","percentOther","preloadImages","reflections","reflectionGET","reflectionP","reflectionPNG","imageScaling","scrollbarP","slider","sliderCursor","sliderWidth","startID","startAnimation","xStep"];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 j=document.getElementById(a.ImageFlowID);if(j){j.style.visibility="visible";this.ImageFlowDiv=j;if(this.createStructure()){this.imagesDiv=document.getElementById(a.ImageFlowID+"_images");this.captionDiv=document.getElementById(a.ImageFlowID+"_caption");this.navigationDiv=document.getElementById(a.ImageFlowID+"_navigation");this.scrollbarDiv=document.getElementById(a.ImageFlowID+"_scrollbar");this.sliderDiv=document.getElementById(a.ImageFlowID+"_slider");this.buttonNextDiv=document.getElementById(a.ImageFlowID+"_next");this.buttonPreviousDiv=document.getElementById(a.ImageFlowID+"_previous");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";j.style.height=b+"px";this.loadingProgress()}}};this.createStructure=function(){var k=a.Helper.createDocumentElement("div","images");var n=null;var p=this.ImageFlowDiv.childNodes.length;for(var e=0;e<p;e++){n=this.ImageFlowDiv.childNodes[e];if(n&&n.nodeType==1&&n.nodeName=="IMG"){if(a.reflections===true){var c="2";if(a.reflectionPNG===true){c="3"}var f=n.getAttribute("src",2);f="/share/asset/imageflow/reflect"+c+".php?img="+f+a.reflectionGET;n.setAttribute("src",f)}var j=n.cloneNode(true);k.appendChild(j)}}var l=a.Helper.createDocumentElement("p","loading_txt");var d=document.createTextNode(" ");l.appendChild(d);var s=a.Helper.createDocumentElement("div","loading");var o=a.Helper.createDocumentElement("div","loading_bar");s.appendChild(o);var m=a.Helper.createDocumentElement("div","caption");var r=a.Helper.createDocumentElement("div","scrollbar");var i=a.Helper.createDocumentElement("div","slider");r.appendChild(i);if(a.buttons){var b=a.Helper.createDocumentElement("div","previous","button");var q=a.Helper.createDocumentElement("div","next","button");r.appendChild(b);r.appendChild(q)}var h=a.Helper.createDocumentElement("div","navigation");h.appendChild(m);h.appendChild(r);var g=false;if(a.ImageFlowDiv.appendChild(k)&&a.ImageFlowDiv.appendChild(l)&&a.ImageFlowDiv.appendChild(s)&&a.ImageFlowDiv.appendChild(h)){for(e=0;e<p;e++){n=this.ImageFlowDiv.childNodes[e];if(n&&n.nodeType==1&&n.nodeName=="IMG"){this.ImageFlowDiv.removeChild(n)}}g=true}return g};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.Helper.addResizeEvent,1000);a.MouseWheel.init();a.MouseDrag.init();a.Touch.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 j=a.imagesDiv.childNodes.length;var e=0,d=0;var b=null;for(var g=0;g<j;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 k=document.getElementById(a.ImageFlowID+"_loading_txt");var f=document.createTextNode("loading images "+d+"/"+e);k.replaceChild(f,k.firstChild);return c};this.refresh=function(){this.imagesDivWidth=a.imagesDiv.offsetWidth+a.imagesDiv.offsetLeft;this.maxHeight=255;this.maxFocus=a.imageFocusMax*a.xStep;this.size=a.imagesDivWidth*0.5;this.sliderWidth=a.sliderWidth*0.5;this.scrollbarWidth=(a.imagesDivWidth-(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.navigationDiv.style.height=(a.maxHeight-a.imagesDivHeight)+"px";a.captionDiv.style.width=a.imagesDivWidth+"px";a.captionDiv.style.paddingTop=Math.round(a.imagesDivWidth*0.02)+"px";a.scrollbarDiv.style.width=a.scrollbarWidth+"px";a.scrollbarDiv.style.marginTop=Math.round(a.imagesDivWidth*0.02)+"px";a.scrollbarDiv.style.marginLeft=Math.round(a.sliderWidth+((a.imagesDivWidth-a.scrollbarWidth)/2))+"px";a.sliderDiv.style.cursor=a.sliderCursor;a.sliderDiv.onmousedown=function(){a.MouseDrag.start(this);return false};if(a.buttons){a.buttonPreviousDiv.onclick=function(){a.MouseWheel.handle(1)};a.buttonNextDiv.onclick=function(){a.MouseWheel.handle(-1)}}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){e.w=162;e.h=255}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}if(a.imageScaling===false){e.style.position="relative";e.style.display="inline"}e.style.cursor=a.imageCursor;d++}}this.max=a.indexArray.length;if(a.imageScaling===false){e=a.imagesDiv.childNodes[a.indexArray[0]];this.totalImagesWidth=e.w*a.max;e.style.paddingLeft=(a.imagesDivWidth/2)+(e.w/2)+"px";a.imagesDiv.style.height=e.h+"px";a.navigationDiv.style.height=(a.maxHeight-e.h)+"px"}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(a.imageScaling){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}}else{if((e+a.maxFocus)<a.memTarget||(e-a.maxFocus)>a.memTarget){d.style.visibility="hidden"}else{d.style.visibility="visible";switch(d.i==a.imageID){case false:d.onclick=function(){a.glideTo(this.i)};break;default:if(d.url!==""){d.onclick=a.onClick}break}}a.imagesDiv.style.marginLeft=(j-a.totalImagesWidth)+"px"}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.Helper.setOpacity(a.imagesDiv.childNodes[e],a.opacityArray[0]);a.imagesDiv.childNodes[e].pc=a.imagesDiv.childNodes[e].pc*a.imageFocusM;var c=0;var j=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]}j=e+f;g=e-f;if(j<a.max){a.Helper.setOpacity(a.imagesDiv.childNodes[j],c);a.imagesDiv.childNodes[j].pc=a.imagesDiv.childNodes[j].pcMem}if(g>=0){a.Helper.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.MouseWheel={init:function(){if(window.addEventListener){a.ImageFlowDiv.addEventListener("DOMMouseScroll",a.MouseWheel.get,false)}a.Helper.addEvent(a.ImageFlowDiv,"mousewheel",a.MouseWheel.get)},get: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.MouseWheel.handle(c)}a.Helper.suppressBrowserDefault(b)},handle: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.Helper.addEvent(a.ImageFlowDiv,"mousemove",a.MouseDrag.drag);a.Helper.addEvent(a.ImageFlowDiv,"mouseup",a.MouseDrag.stop);a.Helper.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(f){var b=0;if(!f){f=window.event}if(f.pageX){b=f.pageX}else{if(f.clientX){b=f.clientX+document.body.scrollLeft+document.documentElement.scrollLeft}}a.MouseDrag.mouseX=b;if(a.MouseDrag.object!==null){var g=(a.MouseDrag.mouseX-a.MouseDrag.objectX)+a.sliderWidth;if(g<(-a.newSliderX)){g=-a.newSliderX}if(g>(a.scrollbarWidth-a.newSliderX)){g=a.scrollbarWidth-a.newSliderX}var d=(g+a.newSliderX)/(a.scrollbarWidth/(a.max-1));var c=Math.round(d);a.MouseDrag.newX=g;a.MouseDrag.object.style.left=g+"px";if(a.imageID!==c){a.glideTo(c)}a.MouseDrag.busy=true}}};this.Touch={x:0,startX:0,stopX:0,busy:false,first:true,init:function(){a.Helper.addEvent(a.navigationDiv,"touchstart",a.Touch.start);a.Helper.addEvent(document,"touchmove",a.Touch.handle);a.Helper.addEvent(document,"touchend",a.Touch.stop)},isOnNavigationDiv:function(d){var b=false;if(d.touches){var c=d.touches[0].target;if(c===a.navigationDiv||c===a.sliderDiv||c===a.scrollbarDiv){b=true}}return b},getX:function(c){var b=0;if(c.touches){b=c.touches[0].pageX}return b},start:function(b){a.Touch.startX=a.Touch.getX(b);a.Touch.busy=true;a.Helper.suppressBrowserDefault(b)},isBusy:function(){var b=false;if(a.Touch.busy===true){b=true}return b},handle:function(c){if(a.Touch.isBusy&&a.Touch.isOnNavigationDiv(c)){if(a.Touch.first){a.Touch.stopX=((a.max-1)-a.imageID)*(a.imagesDivWidth/(a.max-1));a.Touch.first=false}var d=-(a.Touch.getX(c)-a.Touch.startX-a.Touch.stopX);if(d<0){d=0}if(d>a.imagesDivWidth){d=a.imagesDivWidth}a.Touch.x=d;var b=Math.round(d/(a.imagesDivWidth/(a.max-1)));b=(a.max-1)-b;if(a.imageID!==b){a.glideTo(b)}a.Helper.suppressBrowserDefault(c)}},stop:function(){a.Touch.stopX=a.Touch.x;a.Touch.busy=false}};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.MouseWheel.handle(-1);break;case 37:a.MouseWheel.handle(1);break}},get:function(b){b=b||window.event;return b.keyCode}};this.Helper={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])}}},setOpacity:function(b,c){if(a.opacity===true){b.style.opacity=c/10;b.style.filter="alpha(opacity="+c*10+")"}},createDocumentElement:function(c,e,d){var b=document.createElement(c);b.setAttribute("id",a.ImageFlowID+"_"+e);if(d!==undefined){e+=" "+d}b.setAttribute("class",e);b.setAttribute("className",e);return b},suppressBrowserDefault:function(b){if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}return false},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"})});