function ImageFlow(){
this.defaults={aspectRatio:1.964,buttons:true,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:false,reflectionGET:"",reflectionP:0.5,reflectionPNG:false,scrollbarP:0.6,slider:true,sliderCursor:"e-resize",sliderWidth:14,startID:4,startAnimation:false,xStep:150,onSelectionChanged:function(_1){
}};
var _2=this;
this.init=function(_3){
var _4=["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","onSelectionChanged"];
var _5=_4.length;
for(var i=0;i<_5;i++){
var _6=_4[i];
this[_6]=(_3!==undefined&&_3[_6]!==undefined)?_3[_6]:_2.defaults[_6];
}
var _7=document.getElementById(_2.ImageFlowID);
if(_7){
_7.style.visibility="visible";
this.ImageFlowDiv=_7;
if(this.createStructure()){
this.imagesDiv=document.getElementById(_2.ImageFlowID+"_images");
this.captionDiv=document.getElementById(_2.ImageFlowID+"_caption");
this.navigationDiv=document.getElementById(_2.ImageFlowID+"_navigation");
this.scrollbarDiv=document.getElementById(_2.ImageFlowID+"_scrollbar");
this.sliderDiv=document.getElementById(_2.ImageFlowID+"_slider");
this.buttonNextDiv=document.getElementById(_2.ImageFlowID+"_next");
this.buttonPreviousDiv=document.getElementById(_2.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 _8=this.ImageFlowDiv.offsetWidth;
var _9=Math.round(_8/_2.aspectRatio);
document.getElementById(_2.ImageFlowID+"_loading_txt").style.paddingTop=((_9*0.5)-22)+"px";
_7.style.height=_9+"px";
this.loadingProgress();
}
}
};
this.createStructure=function(){
var _a=_2.Helper.createDocumentElement("div","images");
var _b=null;
var _c=this.ImageFlowDiv.childNodes.length;
for(var _d=0;_d<_c;_d++){
_b=this.ImageFlowDiv.childNodes[_d];
if(_b&&_b.nodeType==1&&_b.nodeName=="IMG"){
if(_2.reflections===true){
var _e="2";
if(_2.reflectionPNG===true){
_e="3";
}
var _f=_b.getAttribute("src",2);
_f="../javascripts/game-zone/reflect.aspx?img="+_f+_2.reflectionGET;
_b.setAttribute("src",_f);
}
var _10=_b.cloneNode(true);
_a.appendChild(_10);
}
}
var _11=_2.Helper.createDocumentElement("p","loading_txt");
var _12=document.createTextNode(" ");
_11.appendChild(_12);
var _13=_2.Helper.createDocumentElement("div","loading");
var _14=_2.Helper.createDocumentElement("div","loading_bar");
_13.appendChild(_14);
var _15=_2.Helper.createDocumentElement("div","caption");
var _16=_2.Helper.createDocumentElement("div","scrollbar");
var _17=_2.Helper.createDocumentElement("div","slider");
_16.appendChild(_17);
if(_2.buttons){
var _18=_2.Helper.createDocumentElement("div","previous","button");
var _19=_2.Helper.createDocumentElement("div","next","button");
_16.appendChild(_18);
_16.appendChild(_19);
}
var _1a=_2.Helper.createDocumentElement("div","navigation");
_1a.appendChild(_15);
_1a.appendChild(_16);
var _1b=false;
if(_2.ImageFlowDiv.appendChild(_a)&&_2.ImageFlowDiv.appendChild(_11)&&_2.ImageFlowDiv.appendChild(_13)&&_2.ImageFlowDiv.appendChild(_1a)){
for(_d=0;_d<_c;_d++){
_b=this.ImageFlowDiv.childNodes[_d];
if(_b&&_b.nodeType==1&&_b.nodeName=="IMG"){
this.ImageFlowDiv.removeChild(_b);
}
}
_1b=true;
}
return _1b;
};
this.loadingProgress=function(){
var p=_2.loadingStatus();
if(p<100||_2.firstCheck===true&&_2.preloadImages===true){
if(_2.firstCheck===true&&p==100){
_2.firstCheck=false;
window.setTimeout(_2.loadingProgress,100);
}else{
window.setTimeout(_2.loadingProgress,40);
}
}else{
document.getElementById(_2.ImageFlowID+"_loading_txt").style.display="none";
document.getElementById(_2.ImageFlowID+"_loading").style.display="none";
window.setTimeout(_2.Helper.addResizeEvent,1000);
_2.MouseWheel.init();
_2.MouseDrag.init();
_2.Touch.init();
_2.Key.init();
_2.refresh(true);
document.getElementById(_2.ImageFlowID+"_scrollbar").style.visibility="visible";
var _1c=_2.startID-1;
if(_1c<0){
_1c=0;
}
if(_1c>_2.max){
_1c=_2.max-1;
}
_2.glideTo(_1c);
if(_2.startAnimation===true){
_2.moveTo(5000);
}
}
};
this.loadingStatus=function(){
var max=_2.imagesDiv.childNodes.length;
var i=0,_1d=0;
var _1e=null;
for(var _1f=0;_1f<max;_1f++){
_1e=_2.imagesDiv.childNodes[_1f];
if(_1e&&_1e.nodeType==1&&_1e.nodeName=="IMG"){
if(_1e.complete===true){
_1d++;
}
i++;
}
}
var _20=Math.round((_1d/i)*100);
var _21=document.getElementById(_2.ImageFlowID+"_loading_bar");
_21.style.width=_20+"%";
var _22=document.getElementById(_2.ImageFlowID+"_loading_txt");
var _23=document.createTextNode("loading images "+_1d+"/"+i);
_22.replaceChild(_23,_22.firstChild);
return _20;
};
this.refresh=function(){
this.imagesDivWidth=_2.imagesDiv.offsetWidth+_2.imagesDiv.offsetLeft;
this.maxHeight=Math.round(_2.imagesDivWidth/_2.aspectRatio);
this.maxFocus=_2.imageFocusMax*_2.xStep;
this.size=_2.imagesDivWidth*0.5;
this.sliderWidth=_2.sliderWidth*0.5;
this.scrollbarWidth=(_2.imagesDivWidth-(Math.round(_2.sliderWidth)*2))*_2.scrollbarP;
this.imagesDivHeight=Math.round(_2.maxHeight*_2.imagesHeight);
_2.ImageFlowDiv.style.height=_2.maxHeight+"px";
_2.imagesDiv.style.height=_2.imagesDivHeight+"px";
_2.navigationDiv.style.height=(_2.maxHeight-_2.imagesDivHeight)+"px";
_2.captionDiv.style.width=_2.imagesDivWidth+"px";
_2.captionDiv.style.paddingTop=Math.round(_2.imagesDivWidth*0.02)+"px";
_2.scrollbarDiv.style.width=_2.scrollbarWidth+"px";
_2.scrollbarDiv.style.marginTop=Math.round(_2.imagesDivWidth*0.02)+"px";
_2.scrollbarDiv.style.marginLeft=Math.round(_2.sliderWidth+((_2.imagesDivWidth-_2.scrollbarWidth)/2))+"px";
_2.sliderDiv.style.cursor=_2.sliderCursor;
_2.sliderDiv.onmousedown=function(){
_2.MouseDrag.start(this);
return false;
};
if(_2.buttons){
_2.buttonPreviousDiv.onclick=function(){
_2.MouseWheel.handle(1);
};
_2.buttonNextDiv.onclick=function(){
_2.MouseWheel.handle(-1);
};
}
var _24=(_2.reflections===true)?_2.reflectionP+1:1;
var max=_2.imagesDiv.childNodes.length;
var i=0;
var _25=null;
for(var _26=0;_26<max;_26++){
_25=_2.imagesDiv.childNodes[_26];
if(_25!==null&&_25.nodeType==1&&_25.nodeName=="IMG"){
this.indexArray[i]=_26;
_25.url=_25.getAttribute("longdesc");
_25.xPosition=(-i*_2.xStep);
_25.i=i;
if(_2.firstRefresh){
if(_25.getAttribute("width")!==null&&_25.getAttribute("height")!==null){
_25.w=_25.getAttribute("width");
_25.h=_25.getAttribute("height")*_24;
}else{
_25.w=_25.width;
_25.h=_25.height;
}
}
if((_25.w)>(_25.h/(_2.reflectionP+1))){
_25.pc=_2.percentLandscape;
_25.pcMem=_2.percentLandscape;
}else{
_25.pc=_2.percentOther;
_25.pcMem=_2.percentOther;
}
if(_2.imageScaling===false){
_25.style.position="relative";
_25.style.display="inline";
}
_25.style.cursor=_2.imageCursor;
i++;
}
}
this.max=_2.indexArray.length;
if(_2.imageScaling===false){
_25=_2.imagesDiv.childNodes[_2.indexArray[0]];
this.totalImagesWidth=_25.w*_2.max;
_25.style.paddingLeft=(_2.imagesDivWidth/2)+(_25.w/2)+"px";
_2.imagesDiv.style.height=_25.h+"px";
_2.navigationDiv.style.height=(_2.maxHeight-_25.h)+"px";
}
if(_2.firstRefresh){
_2.firstRefresh=false;
}
_2.glideTo(_2.imageID);
_2.moveTo(_2.current);
};
this.moveTo=function(x){
this.current=x;
this.zIndex=_2.max;
for(var _27=0;_27<_2.max;_27++){
var _28=_2.imagesDiv.childNodes[_2.indexArray[_27]];
var _29=_27*-_2.xStep;
if(_2.imageScaling){
if((_29+_2.maxFocus)<_2.memTarget||(_29-_2.maxFocus)>_2.memTarget){
_28.style.visibility="hidden";
_28.style.display="none";
}else{
var z=(Math.sqrt(10000+x*x)+100)*_2.imagesM;
var xs=x/z*_2.size+_2.size;
_28.style.display="block";
var _2a=(_28.h/_28.w*_28.pc)/z*_2.size;
var _2b=0;
switch(_2a>_2.maxHeight){
case false:
_2b=_28.pc/z*_2.size;
break;
default:
_2a=_2.maxHeight;
_2b=_28.w*_2a/_28.h;
break;
}
var _2c=(_2.imagesDivHeight-_2a)+((_2a/(_2.reflectionP+1))*_2.reflectionP);
_28.style.left=xs-(_28.pc/2)/z*_2.size+"px";
if(_2b&&_2a){
_28.style.height=_2a+"px";
_28.style.width=_2b+"px";
_28.style.top=_2c+"px";
}
_28.style.visibility="visible";
switch(x<0){
case true:
this.zIndex++;
break;
default:
this.zIndex=_2.zIndex-1;
break;
}
switch(_28.i==_2.imageID){
case false:
_28.onclick=function(){
_2.glideTo(this.i);
};
break;
default:
this.zIndex=_2.zIndex+1;
if(_28.url!==""){
_28.onclick=_2.onClick;
}
break;
}
_28.style.zIndex=_2.zIndex;
}
}else{
if((_29+_2.maxFocus)<_2.memTarget||(_29-_2.maxFocus)>_2.memTarget){
_28.style.visibility="hidden";
}else{
_28.style.visibility="visible";
switch(_28.i==_2.imageID){
case false:
_28.onclick=function(){
_2.glideTo(this.i);
};
break;
default:
if(_28.url!==""){
_28.onclick=_2.onClick;
}
break;
}
}
_2.imagesDiv.style.marginLeft=(x-_2.totalImagesWidth)+"px";
}
x+=_2.xStep;
}
};
this.glideTo=function(_2d){
var x=-_2d*_2.xStep;
this.target=x;
this.memTarget=x;
this.imageID=_2d;
var _2e=_2.imagesDiv.childNodes[_2d].getAttribute("alt");
if(_2e===""||_2.captions===false){
_2e="&nbsp;";
}
_2.captionDiv.innerHTML=_2e;
_2.onSelectionChanged(_2d);
if(_2.MouseDrag.busy===false){
this.newSliderX=(_2d*_2.scrollbarWidth)/(_2.max-1)-_2.MouseDrag.newX;
_2.sliderDiv.style.marginLeft=(_2.newSliderX-_2.sliderWidth)+"px";
}
if(_2.opacity===true||_2.imageFocusM!==_2.defaults.imageFocusM){
_2.Helper.setOpacity(_2.imagesDiv.childNodes[_2d],_2.opacityArray[0]);
_2.imagesDiv.childNodes[_2d].pc=_2.imagesDiv.childNodes[_2d].pc*_2.imageFocusM;
var _2f=0;
var _30=0;
var _31=0;
var _32=_2.opacityArray.length;
for(var i=1;i<(_2.imageFocusMax+1);i++){
if((i+1)>_32){
_2f=_2.opacityArray[_32-1];
}else{
_2f=_2.opacityArray[i];
}
_30=_2d+i;
_31=_2d-i;
if(_30<_2.max){
_2.Helper.setOpacity(_2.imagesDiv.childNodes[_30],_2f);
_2.imagesDiv.childNodes[_30].pc=_2.imagesDiv.childNodes[_30].pcMem;
}
if(_31>=0){
_2.Helper.setOpacity(_2.imagesDiv.childNodes[_31],_2f);
_2.imagesDiv.childNodes[_31].pc=_2.imagesDiv.childNodes[_31].pcMem;
}
}
}
if(_2.busy===false){
window.setTimeout(_2.animate,50);
_2.busy=true;
}
};
this.animate=function(){
switch(_2.target<_2.current-1||_2.target>_2.current+1){
case true:
_2.moveTo(_2.current+(_2.target-_2.current)/3);
window.setTimeout(_2.animate,50);
_2.busy=true;
break;
default:
_2.busy=false;
break;
}
};
this.MouseWheel={init:function(){
if(window.addEventListener){
_2.ImageFlowDiv.addEventListener("DOMMouseScroll",_2.MouseWheel.get,false);
}
_2.Helper.addEvent(_2.ImageFlowDiv,"mousewheel",_2.MouseWheel.get);
},get:function(_33){
var _34=0;
if(!_33){
_33=window.event;
}
if(_33.wheelDelta){
_34=_33.wheelDelta/120;
}else{
if(_33.detail){
_34=-_33.detail/3;
}
}
if(_34){
_2.MouseWheel.handle(_34);
}
_2.Helper.suppressBrowserDefault(_33);
},handle:function(_35){
var _36=false;
var _37=0;
if(_35>0){
if(_2.imageID>=1){
_37=_2.imageID-1;
_36=true;
}
}else{
if(_2.imageID<(_2.max-1)){
_37=_2.imageID+1;
_36=true;
}
}
if(_36===true){
_2.glideTo(_37);
}
}};
this.MouseDrag={object:null,objectX:0,mouseX:0,newX:0,busy:false,init:function(){
_2.Helper.addEvent(_2.ImageFlowDiv,"mousemove",_2.MouseDrag.drag);
_2.Helper.addEvent(_2.ImageFlowDiv,"mouseup",_2.MouseDrag.stop);
_2.Helper.addEvent(document,"mouseup",_2.MouseDrag.stop);
_2.ImageFlowDiv.onselectstart=function(){
var _38=true;
if(_2.MouseDrag.busy===true){
_38=false;
}
return _38;
};
},start:function(o){
_2.MouseDrag.object=o;
_2.MouseDrag.objectX=_2.MouseDrag.mouseX-o.offsetLeft+_2.newSliderX;
},stop:function(){
_2.MouseDrag.object=null;
_2.MouseDrag.busy=false;
},drag:function(e){
var _39=0;
if(!e){
e=window.event;
}
if(e.pageX){
_39=e.pageX;
}else{
if(e.clientX){
_39=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
}
}
_2.MouseDrag.mouseX=_39;
if(_2.MouseDrag.object!==null){
var _3a=(_2.MouseDrag.mouseX-_2.MouseDrag.objectX)+_2.sliderWidth;
if(_3a<(-_2.newSliderX)){
_3a=-_2.newSliderX;
}
if(_3a>(_2.scrollbarWidth-_2.newSliderX)){
_3a=_2.scrollbarWidth-_2.newSliderX;
}
var _3b=(_3a+_2.newSliderX)/(_2.scrollbarWidth/(_2.max-1));
var _3c=Math.round(_3b);
_2.MouseDrag.newX=_3a;
_2.MouseDrag.object.style.left=_3a+"px";
if(_2.imageID!==_3c){
_2.glideTo(_3c);
}
_2.MouseDrag.busy=true;
}
}};
this.Touch={x:0,startX:0,stopX:0,busy:false,first:true,init:function(){
_2.Helper.addEvent(_2.navigationDiv,"touchstart",_2.Touch.start);
_2.Helper.addEvent(document,"touchmove",_2.Touch.handle);
_2.Helper.addEvent(document,"touchend",_2.Touch.stop);
},isOnNavigationDiv:function(e){
var _3d=false;
if(e.touches){
var _3e=e.touches[0].target;
if(_3e===_2.navigationDiv||_3e===_2.sliderDiv||_3e===_2.scrollbarDiv){
_3d=true;
}
}
return _3d;
},getX:function(e){
var x=0;
if(e.touches){
x=e.touches[0].pageX;
}
return x;
},start:function(e){
_2.Touch.startX=_2.Touch.getX(e);
_2.Touch.busy=true;
_2.Helper.suppressBrowserDefault(e);
},isBusy:function(){
var _3f=false;
if(_2.Touch.busy===true){
_3f=true;
}
return _3f;
},handle:function(e){
if(_2.Touch.isBusy&&_2.Touch.isOnNavigationDiv(e)){
if(_2.Touch.first){
_2.Touch.stopX=((_2.max-1)-_2.imageID)*(_2.imagesDivWidth/(_2.max-1));
_2.Touch.first=false;
}
var _40=-(_2.Touch.getX(e)-_2.Touch.startX-_2.Touch.stopX);
if(_40<0){
_40=0;
}
if(_40>_2.imagesDivWidth){
_40=_2.imagesDivWidth;
}
_2.Touch.x=_40;
var _41=Math.round(_40/(_2.imagesDivWidth/(_2.max-1)));
_41=(_2.max-1)-_41;
if(_2.imageID!==_41){
_2.glideTo(_41);
}
_2.Helper.suppressBrowserDefault(e);
}
},stop:function(){
_2.Touch.stopX=_2.Touch.x;
_2.Touch.busy=false;
}};
this.Key={init:function(){
document.onkeydown=function(_42){
_2.Key.handle(_42);
};
},handle:function(_43){
var _44=_2.Key.get(_43);
switch(_44){
case 39:
_2.MouseWheel.handle(-1);
break;
case 37:
_2.MouseWheel.handle(1);
break;
}
},get:function(_45){
_45=_45||window.event;
return _45.keyCode;
}};
this.Helper={addEvent:function(obj,_46,fn){
if(obj.addEventListener){
obj.addEventListener(_46,fn,false);
}else{
if(obj.attachEvent){
obj["e"+_46+fn]=fn;
obj[_46+fn]=function(){
obj["e"+_46+fn](window.event);
};
obj.attachEvent("on"+_46,obj[_46+fn]);
}
}
},setOpacity:function(_47,_48){
if(_2.opacity===true){
_47.style.opacity=_48/10;
_47.style.filter="alpha(opacity="+_48*10+")";
}
},createDocumentElement:function(_49,id,_4a){
var _4b=document.createElement(_49);
_4b.setAttribute("id",_2.ImageFlowID+"_"+id);
if(_4a!==undefined){
id+=" "+_4a;
}
_4b.setAttribute("class",id);
_4b.setAttribute("className",id);
return _4b;
},suppressBrowserDefault:function(e){
if(e.preventDefault){
e.preventDefault();
}else{
e.returnValue=false;
}
return false;
},addResizeEvent:function(){
var _4c=window.onresize;
if(typeof window.onresize!="function"){
window.onresize=function(){
_2.refresh();
};
}else{
window.onresize=function(){
if(_4c){
_4c();
}
_2.refresh();
};
}
}};
};
var domReadyEvent={name:"domReadyEvent",events:{},domReadyID:1,bDone:false,DOMContentLoadedCustom:null,add:function(_4d){
if(!_4d.$$domReadyID){
_4d.$$domReadyID=this.domReadyID++;
if(this.bDone){
_4d();
}
this.events[_4d.$$domReadyID]=_4d;
}
},remove:function(_4e){
if(_4e.$$domReadyID){
delete this.events[_4e.$$domReadyID];
}
},run:function(){
if(this.bDone){
return;
}
this.bDone=true;
for(var i in this.events){
this.events[i]();
}
},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 _4f=window.onload;
window.onload=function(){
domReadyEvent.run();
_4f();
};
}else{
window.onload=run;
}
}
}
}};
var domReady=function(_50){
domReadyEvent.add(_50);
};
domReadyEvent.init();

