/* ContentFlow, version 1.0.2 fixed | (c) 2007 - 2010 Sebastian Kutsch | <http://www.jacksasylum.eu/ContentFlow/> | ContentFlow is distributed under the terms of the MIT license. | (see http://www.jacksasylum.eu/ContentFlow/LICENSE) */
var ContentFlowGlobal={Flows:[],AddOns:{},scriptName:"contentflow.js",scriptElement:null,Browser:new function(){this.Opera=window.opera?true:false;this.IE6=(this.IE=document.all&&!this.Opera?true:false)&&typeof window.XMLHttpRequest=="undefined"?true:false;this.IE8=this.IE&&typeof document.querySelectorAll!="undefined"?true:false;this.IE7=this.IE&&!this.IE6&&!this.IE8?true:false;this.WebKit=/WebKit/i.test(navigator.userAgent)?true:false;this.iPhone=/iPhone|iPod/i.test(navigator.userAgent)?true:false;
this.Chrome=/Chrome/i.test(navigator.userAgent)?true:false;this.Safari=/Safari/i.test(navigator.userAgent)&&!this.Chrome?true:false;this.Konqueror4=(this.Konqueror=navigator.vendor=="KDE"?true:false)&&/native code/.test(document.getElementsByClassName)?true:false;this.Gecko19=(this.Gecko=!this.WebKit&&navigator.product=="Gecko"?true:false)&&Array.reduce?true:false},getAddOnConf:function(a){return this.AddOns[a]?this.AddOns[a].conf:{}},setAddOnConf:function(a,b){this.AddOns[a].setConfig(b)},getScriptElement:function(a){a=
RegExp(a);for(var b=document.getElementsByTagName("script"),d=0;d<b.length;d++)if(b[d].src&&a.test(b[d].src))return b[d];return""},getScriptPath:function(a,b){return a.src.replace(RegExp(b+".*"),"")},addScript:function(a){if(this.Browser.IE||this.Browser.WebKit||this.Browser.Konqueror)document.write('<script type="text/javascript" src="'+a+'"><\/script>');else{var b=document.createElement("script");b.src=a;b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b)}},
addScripts:function(a,b){for(var d=0;d<filename.length;d++)this.addScript(basepath+b[d])},addStylesheet:function(a){if(this.Browser.Gecko19){var b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);b.setAttribute("type","text/css");b.setAttribute("media","screen");document.getElementsByTagName("head")[0].appendChild(b)}else document.write('<link rel="stylesheet" href="'+a+'" type="text/css" media="screen" />')},addStylesheets:function(a,b){for(var d=0;d<filename.length;d++)this.addStylesheet(basepath+
b[d])},initPath:function(){this.scriptElement=this.getScriptElement(this.scriptName);if(!this.scriptElement){this.scriptName="contentflow_src.js";this.scriptElement=this.getScriptElement(this.scriptName)}this.BaseDir=this.getScriptPath(this.scriptElement,this.scriptName);if(!this.AddOnBaseDir)this.AddOnBaseDir=this.BaseDir;if(!this.CSSBaseDir)this.CSSBaseDir=this.BaseDir},init:function(){this.addStylesheet(this.CSSBaseDir+"contentflow.css");this.addStylesheet(this.CSSBaseDir+"mycontentflow.css");
this.loadAddOns=[];if(this.scriptElement.getAttribute("load"))for(var a=this.loadAddOns=this.scriptElement.getAttribute("load").replace(/\ +/g," ").split(" "),b=0;b<a.length;b++)a[b]!=""&&this.addScript(this.AddOnBaseDir+"ContentFlowAddOn_"+a[b]+".js");var d=this;if(document.addEventListener)if(this.Browser.WebKit)var g=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(g);d.onloadInit()}},10);else document.addEventListener("DOMContentLoaded",d.onloadInit,false);
else if(this.Browser.IE){document.write("<script id=__ie_cf_onload defer src=javascript:void(0)><\/script>");document.getElementById("__ie_cf_onload").onreadystatechange=function(){this.readyState=="complete"&&d.onloadInit()}}window.addEvent("load",d.onloadInit,false)},onloadInit:function(){if(!arguments.callee.done){for(var a=0;a<ContentFlowGlobal.loadAddOns.length;a++)if(!ContentFlowGlobal.AddOns[ContentFlowGlobal.loadAddOns[a]]){window.setTimeout(ContentFlowGlobal.onloadInit,10);return}arguments.callee.done=
true;if(window.Element&&Element.implement&&document.all&&!window.opera)for(var b in window.CFElement.prototype)if(!window.Element.prototype[b]){a={};a[b]=window.CFElement.prototype[b];Element.implement(a)}for(a=0;a<ContentFlowGlobal.Flows.length;a++)ContentFlowGlobal.Flows[a].init();b=document.getElementsByTagName("div");a=0;a:for(;a<b.length;a++)if(b[a].className.match(/\bContentFlow\b/)){for(var d=0;d<ContentFlowGlobal.Flows.length;d++)if(b[a]==ContentFlowGlobal.Flows[d].Container)continue a;(new ContentFlow(b[a],
{},false)).init()}}}};ContentFlowGlobal.initPath();var ContentFlowAddOn=function(a,b,d){if(typeof d=="undefined"||d!=false)ContentFlowGlobal.AddOns[a]=this;this.name=a;b||(b={});this.methods=b;this.conf={};if(this.methods.conf){this.setConfig(this.methods.conf);delete this.methods.conf}this.scriptpath=ContentFlowGlobal.AddOnBaseDir;b.init&&b.init.bind(this)(this)};
ContentFlowAddOn.prototype={Browser:ContentFlowGlobal.Browser,addScript:ContentFlowGlobal.addScript,addScripts:ContentFlowGlobal.addScripts,addStylesheet:function(a){a||(a=this.scriptpath+"ContentFlowAddOn_"+this.name+".css");ContentFlowGlobal.addStylesheet(a)},addStylesheets:ContentFlowGlobal.addStylesheets,setConfig:function(a){for(var b in a)this.conf[b]=a[b]},_init:function(a){this.methods.ContentFlowConf&&a.setConfig(this.methods.ContentFlowConf)}};
var ContentFlowGUIElement=function(a,b){b.setDimensions=function(){this.dimensions=this.getDimensions();this.center={x:this.dimensions.width/2,y:this.dimensions.height/2};this.position=this.findPos()};b.addObserver=function(d,g){var f=this.eventMethod=g.bind(a);this.observedEvent=d;this.addEvent(d,f,false)};b.makeDraggable=function(d,g,f){this.stopDrag=function(e){if(!e)e=window.event;if(this.Browser.iPhone){window.removeEvent("touchemove",d,false);if(!this.ontochmove){var i=e.target;if(i.firstChild)i=
i.firstChild;var j=document.createEvent("MouseEvents");j.initEvent("click",true,true);i.dispatchEvent(j)}}else window.removeEvent("mousemove",d,false);f(e)}.bind(this);this.initDrag=function(e){if(!e)e=window.event;var i=e;if(e.touches)i=e.touches[0];this.mouseX=i.clientX;this.mouseY=i.clientY;g(e)}.bind(this);var h=this.startDrag=function(e){if(!e)e=window.event;var i=this.stopDrag;if(this.Browser.iPhone){var j=this;j.ontouchmove=false;window.addEvent("touchmove",function(k){j.ontouchmove=true;d(k)},
false);e.preventDefault();window.addEvent("touchend",i,false)}else{window.addEvent("mousemove",d,false);window.addEvent("mouseup",i,false)}e.preventDefault&&e.preventDefault()}.bind(this);this.Browser.iPhone?this.addEventListener("touchstart",h,false):this.addEvent("mousedown",h,false)};b.Browser=ContentFlowGlobal.Browser;$CF(b).setDimensions();return b},ContentFlowItem=function(a,b,d){this.CFobj=a;this._activeElement=a.conf.activeElement;this.next=this.pre=null;this.clickItem=function(h){if(!h)h=
window.event;h=h.target?h.target:h.srcElement;h=h.itemIndex?h.itemIndex:h.parentNode.itemIndex;var e=this.items[h];if(this._activeItem==e)this.conf.onclickActiveItem(e);else this.conf.onclickInactiveItem(e)!=false&&this.moveToIndex(h)}.bind(a);this.setIndex=function(h){this.index=h;this.element.itemIndex=h};this.getIndex=function(){return this.index};if($CF(b).nodeName=="IMG"){var g=document.createElement("div");g.className="item";var f=b.parentNode.replaceChild(g,b);f.className="content";g.appendChild(f);
if(b.title){f=document.createElement("div");f.className="caption";f.innerHTML=b.title;g.appendChild(f)}b=g}this.element=$CF(b);this.item=b;typeof d!="undefined"&&this.setIndex(d);this.content=this.element.getChildrenByClassName("content")[0];this.caption=this.element.getChildrenByClassName("caption")[0];this.label=this.element.getChildrenByClassName("label")[0];if(this.content.nodeName=="IMG"){a._imagesToLoad++;b=function(){a._imagesToLoad--;this.image=this.content;this.setImageFormat(this.image);
a.conf.reflectionHeight>0&&this.addReflection();this.initClick();a._addItemCueProcess(true)}.bind(this);if(this.content.complete&&this.content.width>0)window.setTimeout(b,100);else if(this.content.addEventListener)this.content.addEventListener("load",b,false);else if(this.content.attachEvent)this.content.attachEvent("onload",b);else this.content.onload=window.setTimeout(b,100)}else{this.initClick();a._addItemCueProcess(true)}};
ContentFlowItem.prototype={Browser:ContentFlowGlobal.Browser,makeActive:function(){this.element.addClassName("active");this.CFobj.conf.onMakeActive(this)},makeInactive:function(){this.element.removeClassName("active");this.CFobj.conf.onMakeInactive(this)},initClick:function(){this[this._activeElement].addEvent("click",this.clickItem,false)},setImageFormat:function(a){if(this.Browser.IE6||this.Browser.IE7)a.style.width="auto";a.origProportion=a.width/a.height;a.setAttribute("origProportion",a.width/
a.height);if(this.Browser.IE6||this.Browser.IE7)a.style.width="";a.origProportion<=1?a.addClassName("portray"):a.addClassName("landscape")},addReflection:function(){var a=this.CFobj,b,d=this.content;if(this.Browser.IE){var g="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";if(a._reflectionColorRGB){if(a.conf.reflectionColor=="transparent"){var f=b=this.reflection=document.createElement("img");b.src=d.src}else{b=this.reflection=document.createElement("div");f=document.createElement("img");
f.src=d.src;b.width=f.width;b.height=f.height;f.style.width="100%";f.style.height="100%";var h=a._reflectionColorRGB;b.style.backgroundColor="#"+h.hR+h.hG+h.hB;b.appendChild(f)}g+=" progid:DXImageTransform.Microsoft.Alpha(opacity=0, finishOpacity=50, style=1, finishX=0, startY="+a.conf.reflectionHeight*100+" finishY=0)"}else{f=b=this.reflection=document.createElement("img");b.src=d.src}g+=" progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22="+1/a.conf.reflectionHeight+")";if(ContentFlowGlobal.Browser.IE6)if(d.src.match(/\.png$/)){d.style.filter=
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+d.src+"', sizingMethod=scale )";d.filterString="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+d.src+"', sizingMethod=scale )";g+=" progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+d.src+"', sizingMethod=scale )";d.origSrc=d.src;d.src="img/blank.gif";f.src="img/blank.gif"}b.filterString=g;f.style.filter=g}else{g=a._reflectionWithinImage?this.canvas=$CF(document.createElement("canvas")):b=this.reflection=document.createElement("canvas");
if(g.getContext){if(a._reflectionWithinImage)for(f=0;f<d.attributes.length;f++)g.setAttributeNode(d.attributes[f].cloneNode(true));f=g.getContext("2d");h=a.maxHeight;h=a._scaleImageSize(this,{width:h,height:h},h);var e=h.width;h=h.height;if(a._reflectionWithinImage){g.width=e;g.height=h;this.setImageFormat(g);g.height=h*(1+a.conf.reflectionHeight+a.conf.reflectionGap)}else{g.width=e;g.height=h*a.conf.reflectionHeight}f.save();a._reflectionWithinImage&&f.drawImage(d,0,0,e,h);var i=a._reflectionWithinImage?
h*(1+a.conf.reflectionGap/2)*2:d.height;i-=1;f.translate(0,i);f.scale(1,-1);f.drawImage(d,0,0,e,h);f.restore();if(a._reflectionColorRGB){e=f.createLinearGradient(0,0,0,g.height);i=[0,0.5,1];if(a._reflectionColor=="transparent"){f.globalCompositeOperation="destination-in";i=[1,0.5,0]}var j=a._reflectionColorRGB.iR,k=a._reflectionColorRGB.iG,l=a._reflectionColorRGB.iB;if(a._reflectionWithinImage){e.addColorStop(0,"rgba("+j+","+k+","+l+","+i[0]+")");e.addColorStop(h/g.height,"rgba("+j+","+k+","+l+","+
i[0]+")");e.addColorStop(h/g.height,"rgba("+j+","+k+","+l+","+i[1]+")")}else e.addColorStop(0,"rgba("+j+","+k+","+l+","+i[1]+")");e.addColorStop(1,"rgba("+j+","+k+","+l+","+i[2]+")");f.fillStyle=e;f.fillRect(0,0,g.width,g.height)}if(a._reflectionWithinImage){d.parentNode.replaceChild(g,d);this.origContent=this.content=g;delete this.image}}else{a._reflectionWithinImage=false;delete this.reflection}}if(b){b.className="reflection";this.element.appendChild(b);this.caption&&this.element.appendChild(this.caption)}}};
var ContentFlow=function(a,b){if(a){ContentFlowGlobal.Flows.push(this);this.Container=a;this._userConf=b?b:{};this.conf={};this._loadedAddOns=[]}else throw"ContentFlow ERROR: No flow container node or id given";};
ContentFlow.prototype={_imagesToLoad:0,_activeItem:0,_currentPosition:0,_targetPosition:0,_stepLock:false,_millisecondsPerStep:40,_reflectionWithinImage:true,Browser:ContentFlowGlobal.Browser,_defaultConf:{useAddOns:"all",biggestItemPos:0,loadingTimeout:3E4,activeElement:"content",maxItemHeight:0,scaleFactor:1,scaleFactorLandscape:1.33,scaleFactorPortrait:1,fixItemSize:false,relativeItemPosition:"top center",circularFlow:true,verticalFlow:false,visibleItems:-1,endOpacity:1,startItem:"center",scrollInFrom:"pre",
flowSpeedFactor:1,flowDragFriction:1,scrollWheelSpeed:1,keys:{13:function(){this.conf.onclickActiveItem(this._activeItem)},37:function(){this.moveTo("pre")},38:function(){this.moveTo("visibleNext")},39:function(){this.moveTo("next")},40:function(){this.moveTo("visiblePre")}},reflectionColor:"transparent",reflectionHeight:0.5,reflectionGap:0,onInit:function(){},onclickInactiveItem:function(){},onclickActiveItem:function(a){var b,d;if(b=a.content.getAttribute("href"))d=a.content.getAttribute("target");
else if(b=a.element.getAttribute("href"))d=a.element.getAttribute("target");else if(b=a.content.getAttribute("src"))d=a.content.getAttribute("target");if(b)if(d)window.open(b,d).focus();else window.location.href=b},onMakeInactive:function(){},onMakeActive:function(){},onReachTarget:function(){},onMoveTo:function(){},onDrawItem:function(){},onclickPreButton:function(a){this.moveToIndex("pre");return Event.stop(a)},onclickNextButton:function(a){this.moveToIndex("next");return Event.stop(a)},calcStepWidth:function(a){var b=
this.conf.visibleItems,d=this.items.length;d=d==0?1:d;return Math.abs(a)>b?a>0?a-b:a+b:b>=this.items.length?a/d:a*(b/d)},calcSize:function(a){a=1/(Math.abs(a.relativePosition)+1);return{width:a,height:a}},calcCoordinates:function(a){var b=this.conf.visibleItems;return{x:a.side*b/(b+1)*(1-1/Math.exp(Math.abs(a.relativePosition)*0.75)),y:1}},calcZIndex:function(a){return-Math.abs(a.relativePositionNormed)},calcFontSize:function(a){return a.size.height},calcOpacity:function(a){return Math.max(1-(1-this.conf.endOpacity)*
Math.sqrt(Math.abs(a.relativePositionNormed)),this.conf.endOpacity)}},_checkIndex:function(a){a=Math.max(a,0);return a=Math.min(a,this.itemsLastIndex)},_setLastIndex:function(){this.itemsLastIndex=this.items.length-1},_getItemByIndex:function(a){return this.items[this._checkIndex(a)]},_getItemByPosition:function(a){return this._getItemByIndex(this._getIndexByPosition(a))},_getPositionByIndex:function(a){if(!this.conf.circularFlow)return this._checkIndex(a);var b=this._getIndexByPosition(this._currentPosition);
a=a-b;if(Math.abs(a)>a+this.items.length)a+=this.items.length;else if(Math.abs(a)>Math.abs(a-this.items.length))a-=this.items.length;return this._currentPosition+a},_getIndexByPosition:function(a){var b=a<0?0:1,d=(Math.round(a)+b)%this.items.length;if(d>0)d-=b;else if(d<0)d+=this.items.length-b;else d=a<0?0:this.items.length-1;return d},_getIndexByKeyWord:function(a,b,d){b=b?b:this._activeItem?this._activeItem.index:0;if(isNaN(a))switch(a){case "first":case "start":b=0;break;case "last":case "end":b=
this.itemsLastIndex;break;case "middle":case "center":b=Math.round(this.itemsLastIndex/2);break;case "right":case "next":b+=1;break;case "left":case "pre":case "previous":b-=1;break;case "visible":case "visiblePre":case "visibleLeft":b-=this.conf.visibleItems;break;case "visibleNext":case "visibleRight":b+=this.conf.visibleItems}else b=a;if(d!=false)b=this._checkIndex(b);return b},_setCaptionLabel:function(a){this.Position&&!this.Slider.locked&&this.Position.setLabel(a);this._setGlobalCaption()},
getAddOnConf:function(a){return ContentFlowGlobal.getAddOnConf(a)},setAddOnConf:function(a,b){ContentFlowGlobal.setAddOnConf(a,b)},init:function(){this.isInit||this._init()},setConfig:function(a){if(a){var b=this._defaultConf,d;for(d in a)if(b[d]!="undefined")switch(d){case "scrollInFrom":case "startItem":if(typeof a[d]=="number"||typeof a[d]=="string")this.conf[d]=a[d];break;default:if(typeof(b[d]==a[d]))this.conf[d]=typeof a[d]=="function"?a[d].bind(this):a[d]}switch(this.conf.reflectionColor){case this.conf.reflectionColor.search(/#[0-9a-fA-F]{6}/)>=
0?this.conf.reflectionColor:this.conf.reflectionColor+"x":this._reflectionColorRGB={hR:this.conf.reflectionColor.slice(1,3),hG:this.conf.reflectionColor.slice(3,5),hB:this.conf.reflectionColor.slice(5,7),iR:parseInt(this.conf.reflectionColor.slice(1,3),16),iG:parseInt(this.conf.reflectionColor.slice(3,5),16),iB:parseInt(this.conf.reflectionColor.slice(5,7),16)};break;default:this._reflectionColor="transparent";this._reflectionColorRGB={hR:0,hG:0,hB:0,iR:0,iG:0,iB:0}}if(this.items){if(this.conf.visibleItems<
0)this.conf.visibleItems=Math.round(Math.sqrt(this.items.length));this.conf.visibleItems=Math.min(this.conf.visibleItems,this.items.length-1)}if(this.conf.relativeItemPosition){a={x:{left:function(){return-1},center:function(){return 0},right:function(){return 1}},y:{top:function(){return-1},center:function(){return 0},bottom:function(){return 1}}};b=this.conf.relativeItemPosition;b=b.replace(/above/,"top").replace(/below/,"bottom");var g=null;d=b.match(/left|right/);g=b.match(/top|bottom/);c=b.match(/center/);
d||(d="center");g||(g=c?"center":"top");var f=a.x[d],h=a.y[g];this.conf.calcRelativeItemPosition=function(e){var i=f(e.size);e=h(e.size);return{x:i,y:e}};this.conf.relativeItemPosition=null}if(this._reflectionType&&this._reflectionType!="clientside")this.conf.reflectionHeight=0}},getItem:function(a){return this.items[this._checkIndex(Math.round(a))]},getActiveItem:function(){return this._activeItem},getNumberOfItems:function(){return this.items.length},resize:function(){this._initSizes();this._initStep()},
moveToPosition:function(a,b){this.conf.circularFlow||(a=this._checkIndex(a));this._targetPosition=a;this.conf.onMoveTo(this._getItemByPosition(a));this._initStep(false,b)},moveToIndex:function(a){this._targetPosition=Math.round(this._getPositionByIndex(this._getIndexByKeyWord(a,this._activeItem.index,!this.conf.circularFlow)));this.conf.onMoveTo(this._getItemByPosition(this._targetPosition));this._initStep()},moveToItem:function(a){this.moveToIndex(a.itemIndex?a.itemIndex:a.index)},moveTo:function(a){if(typeof a==
"object")this.moveToItem(a);else isNaN(a)||a==Math.floor(a)&&a<this.items.length?this.moveToIndex(a):this.moveToPosition(a)},_addItemCue:[],_addItemCueProcess:function(a){var b=this._addItemCue;a==true&&b.shift();if(b.length>0&&!b[0].p){b[0].p=true;var d=this;window.setTimeout(function(){d._addItem(b[0].el,b[0].i)},b.length>5?1:40)}},addItem:function(a,b){this._addItemCue.push({el:a,i:b,p:false});this._addItemCue.length==1&&this._addItemCueProcess()},_addItem:function(a,b){if(typeof b=="string")switch(b){case "first":case "start":b=
0;break;case "last":case "end":b=isNaN(this.itemsLastIndex)?0:this.itemsLastIndex;b+=1;break;default:b=this._getIndexByKeyWord(b)}b=Math.max(b,0);b=Math.min(b,this.itemsLastIndex+1);b=isNaN(b)?0:b;this.Flow.appendChild(a);var d=new ContentFlowItem(this,a,b);if(this.items.length==0){this.resize();if(this.conf.circularFlow){d.pre=d;d.next=d}}else{if(b==this.itemsLastIndex+1){d.pre=this.items[this.itemsLastIndex];d.next=d.pre.next}else{d.next=this.items[b];d.pre=d.next.pre}if(d.pre)d.pre.next=d;if(d.next)d.next.pre=
d}this.items.splice(b,0,d);for(d=b;d<this.items.length;d++)this.items[d].setIndex(d);this._setLastIndex();if(this.conf.origVisibleItems<0)this.conf.visibleItems=Math.round(Math.sqrt(this.items.length));this.conf.visibleItems=Math.min(this.conf.visibleItems,this.items.length-1);if(Math.round(this._getPositionByIndex(b))<=Math.round(this._targetPosition)){this._targetPosition++;if(!this.conf.circularFlow)this._targetPosition=Math.min(this._targetPosition,this.itemsLastIndex)}if(this._getPositionByIndex(b)<=
this._currentPosition){this._currentPosition++;if(!this.conf.circularFlow)this._currentPosition=Math.min(this._currentPosition,this.itemsLastIndex)}var g=this;window.setTimeout(function(){if(g.items.length==1){g._currentPosition=-0.01;g._targetPosition=0;g.resize()}else g._initStep()},100);return b},rmItem:function(a){if(a=="undefined")a=this._activeItem.index;a=this._getIndexByKeyWord(a);if(!this.items[a])return null;var b=this.items[a];if(b.pre)b.pre.next=b.next;if(b.next)b.next.pre=b.pre;this.items.splice(a,
1);for(var d=a;d<this.items.length;d++)this.items[d].setIndex(d);this._setLastIndex();if(Math.round(this._getPositionByIndex(a))<Math.round(this._targetPosition)){this._targetPosition--;if(!this.conf.circularFlow)this._targetPosition=this._checkIndex(this._targetPosition)}if(this._getPositionByIndex(a)<this._currentPosition){this._currentPosition--;if(!this.conf.circularFlow)this._currentPosition=this._checkIndex(this._currentPosition)}this._activeItem=this._getItemByPosition(this._currentPosition);
a=b.element.parentNode.removeChild(b.element);var g=this;window.setTimeout(function(){g._initStep()},10);return a},_init:function(){if(typeof this.Container=="string"){var a=document.getElementById(this.Container);if(a)this.Container=a;else throw"ContentFlow ERROR: No element with id '"+this.Container+"' found!";}$CF(this.Container).addClassName("ContentFlow");a=$CF(this.Container).getChildrenByClassName("flow")[0];if(!a)throw"ContentFlow ERROR: No element with class'flow' found!";this.Flow=new ContentFlowGUIElement(this,
a);if(a=this.Container.getChildrenByClassName("scrollbar")[0]){this.Scrollbar=new ContentFlowGUIElement(this,a);if(a=this.Scrollbar.getChildrenByClassName("slider")[0]){this.Slider=new ContentFlowGUIElement(this,a);if(a=this.Slider.getChildrenByClassName("position")[0])this.Position=new ContentFlowGUIElement(this,a)}}this.setConfig(this._defaultConf);this._initAddOns();this.setConfig(this._userConf);this._initSizes();a=this.Flow.getChildrenByClassName("item");this.items=[];for(var b=0;b<a.length;b++){var d=
this.items[b]=new ContentFlowItem(this,a[b],b);if(b>0){d.pre=this.items[b-1];d.pre.next=d}}this._setLastIndex();if(this.conf.circularFlow&&this.items.length>0){a=this.items[0];a.pre=this.items[this.items.length-1];a.pre.next=a}this._initGUI();if(this._activeElement!="content")this._activeElement="element";this.conf.origVisibleItems=this.conf.visibleItems;if(this.conf.visibleItems<0)this.conf.visibleItems=Math.round(Math.sqrt(this.items.length));this.conf.visibleItems=Math.min(this.conf.visibleItems,
this.items.length-1);this._targetPosition=this._getIndexByKeyWord(this.conf.startItem,0);a=this._getIndexByKeyWord(this.conf.scrollInFrom,this._targetPosition);switch(this.conf.scrollInFrom){case "next":case "right":a-=0.5;break;case "pre":case "previous":case "left":a+=0.5}this._currentPosition=a;var g=new Date,f=this,h=window.setInterval(function(){if(f._imagesToLoad==0||new Date-g>f._loadingTimeout){clearInterval(h);f._activeItem=f.getItem(f._currentPosition);if(f._activeItem){f._activeItem.makeActive();
f._setCaptionLabel(f._activeItem.index)}f.Flow.style.visibility="visible";if(f.loadIndicator)f.loadIndicator.style.display="none";if(f.Scrollbar)f.Scrollbar.style.visibility="visible";f.resize();for(var e=0;e<f._loadedAddOns.length;e++){var i=ContentFlowGlobal.AddOns[f._loadedAddOns[e]];i.methods.afterContentFlowInit&&i.methods.afterContentFlowInit(f)}f.conf.onInit()}},10);this.isInit=true},_initAddOns:function(){var a=[];if(this._userConf.useAddOns)if(typeof this._userConf.useAddOns=="string")a=
this._userConf.useAddOns.split(" ");else{if(typeof this._userConf.useAddOns=="array")a=this._userConf.useAddOns}else a=this.Container.getAttribute("useAddOns")?this.Container.getAttribute("useAddOns").split(" "):this.conf.useAddOns.split(" ");for(var b=0;b<a.length;b++)if(a[b]=="none"){a=[];break}else if(a[b]=="all"){a=[];for(var d in ContentFlowGlobal.AddOns)a.push(d);break}for(b=0;b<a.length;b++)if(d=ContentFlowGlobal.AddOns[a[b]]){this._loadedAddOns.push(a[b]);d._init(this);this.Container.addClassName("ContentFlowAddOn_"+
d.name);d.methods.onloadInit&&d.methods.onloadInit(this)}},_initGUI:function(){var a=this.resize.bind(this);window.addEvent("resize",a,false);a=this.Container.getElementsByTagName("div");for(var b=0;b<a.length;b++)if($CF(a[b]).hasClassName("preButton")){var d=this.conf.onclickPreButton;a[b].addEvent("click",d,false)}else if(a[b].hasClassName("nextButton")){var g=a[b];d=this.conf.onclickNextButton;g.addEvent("click",d,false)}if(this.conf.scrollWheelSpeed!=0){a=this._wheel.bind(this);window.addEventListener&&
this.Container.addEventListener("DOMMouseScroll",a,false);this.Container.onmousewheel=a}var f=this._keyStroke.bind(this);if(this.conf.keys&&!this.Browser.iPhone)if(document.addEventListener)if(this.Browser.Opera)this.Container.addEvent("keydown",f);else{var h=document.createElement("div");h.addClassName("mouseoverCheckElement");this.Container.appendChild(h);this.Browser.WebKit?document.body.addEvent("keydown",function(e){h.offsetLeft>0&&f(e)}):window.addEvent("keydown",function(e){h.offsetLeft>0&&
f(e)})}else this.Container.onkeydown=f;if(this.conf.flowDragFriction>0){a=function(e){var i=e;if(e.touches)i=e.touches[0];e=i.clientX;i=i.clientY;if(this.conf.verticalFlow)var j=i-this.Flow.mouseY,k=this.Flow.dimensions.height;else{j=e-this.Flow.mouseX;k=this.Flow.dimensions.width}j=this._currentPosition-j/k*(2*this.conf.visibleItems+1)*2*this.conf.visibleItems/this.conf.flowDragFriction;this.Flow.mouseX=e;this.Flow.mouseY=i;this.moveToPosition(j,true)}.bind(this);b=function(){};d=function(){var e=
Math.round(this._targetPosition);Math.abs(e-this._currentPosition)>0.0010&&this.moveToPosition(e)}.bind(this);this.Flow.makeDraggable(a,b,d)}this.Scrollbar&&this.Scrollbar.addObserver("click",function(e){if(!e)e=window.event;if(this.Scrollbar.clickLocked)this.Scrollbar.clickLocked=false;else this.moveToIndex(Math.round((e.clientX-this.Scrollbar.position.left)/this.Scrollbar.dimensions.width*this.itemsLastIndex))}.bind(this));if(this.Slider){if(this.Browser.IE6){a=document.createElement("div");a.className=
"virtualSlider";this.Slider.appendChild(a)}this.Slider.setPosition=function(e){e=e-Math.floor(e)+this._getIndexByPosition(Math.floor(e));if(Math.round(e)<0)e=this.itemsLastIndex;else if(e<=0)e=0;else if(Math.round(e)>this.itemsLastIndex)e=0;else if(e>=this.itemsLastIndex)e=this.itemsLastIndex;this.Slider.style.left=(this.items.length>1?e/this.itemsLastIndex*this.Scrollbar.dimensions.width:0.5*this.Scrollbar.dimensions.width)-this.Slider.center.x+"px";this.Slider.style.top=this.Scrollbar.center.y-
this.Slider.center.y+"px"}.bind(this);b=function(){this.Scrollbar.clickLocked=true}.bind(this);a=function(e){var i=e;if(e.touches)i=e.touches[0];e=this._checkIndex((i.clientX-this.Scrollbar.position.left)/this.Scrollbar.dimensions.width*this.itemsLastIndex);this._targetPosition=this._getPositionByIndex(e);this.Slider.setPosition(e);this.Position&&this.Position.setLabel(e);this._initStep(true,true)}.bind(this);d=function(){this._targetPosition=Math.round(this._targetPosition);this.conf.onMoveTo(this._getItemByPosition(this._targetPosition));
this._initStep(true)}.bind(this);this.Slider.makeDraggable(a,b,d)}if(this.Position)this.Position.setLabel=function(e){e=this._checkIndex(Math.round(e));this.Position.innerHTML=this.items&&this.items[e].label?this.items[e].label.innerHTML:e+1}.bind(this);this.globalCaption=this.Container.getChildrenByClassName("globalCaption")[0];this.loadIndicator=this.Container.getChildrenByClassName("loadIndicator")[0]},_initSizes:function(){this._initMaxHeight();var a=this._initScrollbarSize();if(!this.conf.verticalFlow&&
this.Container.style.height&&this.Container.style.height!="auto")this.maxHeight-=a;if(this._activeItem){a=this._findBiggestItem();var b=this.Flow.findPos();if(this.conf.verticalFlow){this.Flow.style.width=a.width.width+"px";this.Flow.style.height=3*a.width.width*(1+this.conf.reflectionHeight+this.conf.reflectionGap)+"px"}else this.Flow.style.height=a.height.height+(a.height.top-b.top)+"px";b=this.conf.verticalFlow?a.width.width:a.height.height;this.Flow.style.marginBottom=-(b-b/(1+this.conf.reflectionHeight+
this.conf.reflectionGap))+"px";this.Flow.dimensions=this.Flow.getDimensions();if(!this.Browser.IE6)if(!(this.conf.verticalFlow&&this.Container.clientWidth<this.Flow.dimensions.width))if(this.Container.clientHeight<this.Flow.dimensions.height)this.Container.style.height=this.Flow.dimensions.height+"px";this.Flow.center=this.conf.verticalFlow?{x:this.Flow.dimensions.height/2,y:a.width.width/2}:{x:this.Flow.dimensions.width/2,y:a.height.height/2}}},_initScrollbarSize:function(){var a,b,d;if(a=this.Scrollbar){a.setDimensions();
var g=a.dimensions.height;if(b=this.Slider){b.setDimensions();g+=b.dimensions.height;if(d=this.Position){var f=d.innerHTML,h=maxW=0;d.style.width="auto";if(this.items)for(var e=0;e<this.items.length;e++){var i=this.items[e];d.innerHTML=i.label?i.label.innerHTML:i.index;i=d.clientHeight;var j=d.clientWidth;if(i>h)h=i;if(j>maxW)maxW=j}else{d.innerHTML="&nbsp;";h=d.clientHeight;maxW=d.clientWidth}d.innerHTML=f;d.setDimensions();d.style.width=maxW+"px";d.style.left=(b.dimensions.width-maxW)/2+"px";b=
d.position.top-b.position.top;if(b>0){b+=-a.dimensions.height+h;a.style.marginBottom=b+"px"}else{b*=-1;a.style.marginTop=b+"px"}g+=b}}}else g=0;return g},_initMaxHeight:function(){if(this.conf.verticalFlow)var a=screen.width/screen.height,b=this.Container.style.width,d=this.Container.clientWidth,g=this.Flow.style.width,f=this.Flow.clientWidth,h=this.Flow.clientHeight;else{a=screen.height/screen.width;b=this.Container.style.height;d=this.Container.clientHeight;g=this.Flow.style.height;f=this.Flow.clientHeight;
h=this.Flow.clientWidth}if(this.ContainerOldDim)b=this.ContainerOldDim;if(this.FlowOldDim)g=this.FlowOldDim;this.FlowOldDim=this.ContainerOldDim="auto";if(this.conf.maxItemHeight<=0){this.maxHeight=h/3*a/1*this.conf.scaleFactor;if(this.conf.verticalFlow&&(this.maxHeight==0||this.maxHeight>f))this.maxHeight=f;if(b&&b!="auto"){a=this.conf.verticalFlow?0:this.conf.reflectionGap;this.maxHeight=d/(this.conf.scaleFactor*(1+(this.conf.verticalFlow?0:this.conf.reflectionHeight)+a));this.ContainerOldDim=b}else if(g&&
g!="auto"){a=this.conf.verticalFlow?0:this.conf.reflectionGap;this.maxHeight=f/(this.conf.scaleFactor*(1+this.conf.reflectionHeight+a));this.FlowOldDim=g}}else this.maxHeight=this.conf.maxItemHeight},_findBiggestItem:function(){var a=this._activeItem,b=maxFlowSize={width:{width:0,left:0,height:0,top:0,item:null,rI:0},height:{width:0,left:0,height:0,top:0,item:null,rI:0}},d=function(e,i){var j=e.element;j.style.display="block";var k=j.findPos(),l=j.clientHeight,m=j.clientWidth;if(l+k.top>=b.height.height+
b.height.top){b.height.height=l;b.height.top=k.top;b.height.item=e;b.height.rI=i}if(m+k.left>=b.width.width+b.width.left){b.width.width=m;b.width.left=k.left;b.width.item=e;b.width.rI=i}j.style.display="none"},g=this._currentPosition;this._currentPosition=this.conf.visibleItems+1;for(var f=-this.conf.visibleItems;f<=this.conf.visibleItems;f++){a.element.style.display="none";this._positionItem(a,f);d(a,f)}a=b.height.rI;for(f=0;f<this.items.length;f++){var h=this.items[f];h.element.style.display="none";
this._positionItem(h,a);d(h,a)}this._currentPosition=g;return b},_keyStroke:function(a){if(!a)a=window.event;if(a.which)var b=a.which;else if(a.keyCode)b=a.keyCode;if(this.conf.keys[b]){this.conf.keys[b].bind(this)();return Event.stop(a)}else return true},_wheel:function(a){if(!a)a=window.event;var b=0;if(a.wheelDelta)b=a.wheelDelta/120;else if(a.detail)b=-a.detail/3;if(b){var d=this._targetPosition;if(b<0)d+=1*this.conf.scrollWheelSpeed;else d-=1*this.conf.scrollWheelSpeed;this.moveToPosition(Math.round(d))}return Event.stop(a)},
_setGlobalCaption:function(){if(this.globalCaption){this.globalCaption.innerHTML="";this._activeItem&&this._activeItem.caption&&this.globalCaption.appendChild(this._activeItem.caption.cloneNode(true))}},_initStep:function(a,b){if(this.Slider)this.Slider.locked=a?true:false;this._holdPos=b==true?true:false;if(!this._stepLock){this._stepLock=true;this._step()}},_step:function(){var a=this._targetPosition-this._currentPosition,b=Math.abs(a);if(b>0.0010){this._currentPosition+=this.conf.flowSpeedFactor*
this.conf.calcStepWidth(a,b,this.items.length,this.conf.visibleItems);if((a=this.items[this._getIndexByPosition(this._currentPosition)])&&a!=this._activeItem){this._activeItem&&this._activeItem.makeInactive();this._activeItem=a;this._activeItem.makeActive();this._setCaptionLabel(this._activeItem.index);Math.abs(this._targetPosition-this._currentPosition)<=0.5&&this.conf.onReachTarget(this._activeItem)}this._positionItems();a=this._step.bind(this);window.setTimeout(a,this._millisecondsPerStep)}else{if(!this._holdPos){if(this.Slider)this.Slider.locked=
false;this._currentPosition=Math.round(this._currentPosition);this.Position&&!this.Slider.locked&&this._activeItem&&this._setCaptionLabel(this._activeItem.index);this._positionItems()}this._stepLock=false}this.Slider&&!this.Slider.locked&&this.Slider.setPosition(this._currentPosition)},_positionItems:function(){if(this._lastStart)for(var a=this._lastStart;a;){a.element.style.display="none";a=a.next;if(a==this._lastStart)break;if(a&&a.pre==this._lastEnd)break}else this._lastStart=this._activeItem;
if(this._activeItem){var b=this._activeItem;a=b.pre;var d=b.next;this._positionItem(b,0);for(b=1;b<=this.conf.visibleItems&&2*b<this.items.length;b++){if(a){this._positionItem(a,-b);this._lastStart=a;a=a.pre}if(d){this._positionItem(d,b);this._lastEnd=d;d=d.next}}}},_positionItem:function(a,b){var d=this.conf,g=d.verticalFlow,f=a.element.style,h=a.position=this._currentPosition+b;h=a.relativePosition=Math.round(h)-this._currentPosition;a.relativePositionNormed=d.visibleItems>0?h/d.visibleItems:0;
var e=h<0?-1:1;e*=h==0?0:1;a.side=e;h=d.calcSize(a);h.height=Math.max(h.height,0);h.width=Math.max(h.width,0);if(a.content.origProportion)h=this._scaleImageSize(a,h);a.size=h;var i=a.coordinates=d.calcCoordinates(a),j=a.relativeItemPosition=d.calcRelativeItemPosition(a);e=a.zIndex=d.calcZIndex(a);var k=a.fontSize=d.calcFontSize(a);a.opacity=d.calcOpacity(a);h.height*=this.maxHeight;h.width*=this.maxHeight;var l=this.Flow.center.x*(1+i.x)+(j.x-1)*(g?h.height:h.width)/2;i=this.maxHeight/2*(1+i.y)+(j.y-
1)*(g?h.width:h.height)/2;f.left=(g?i:l)+"px";f.top=(g?l:i)+"px";this._setItemSize(a,h);d.endOpacity!=1&&this._setItemOpacity(a);if(!this.Browser.IE)f.fontSize=k*100+"%";f.zIndex=32768+Math.round(e*this.items.length);d.onDrawItem(a);f.visibility="visible";f.display="block"},_scaleImageSize:function(a,b,d){var g=this.conf.scaleFactorLandscape,f=this.conf.scaleFactorPortrait,h=this.conf.verticalFlow,e=a.content.origProportion,i=b.width,j=b.height,k=a.content;if(h)if(e<=1){if(g!="max"&&g!=1){j*=g;i=
Math.min(j*e,d?d:1)}j=i/e}else{if(e>1){if(f=="max")j=d?d:1;else if(f!=1){i*=f;j=Math.min(i/e,d?d:1)}else j=i/e;i=j*e}}else if(e>1){if(g!="max"&&g!=1){i*=g;j=Math.min(i/e,d?d:1)}i=j*e}else if(e<=1){if(f=="max")i=d?d:1;else if(f!=1){j*=f;i=Math.min(j*e,d?d:1)}else i=j*e;j=i/e}j=isNaN(j)?0:j;i=isNaN(i)?0:i;if(!d&&this.conf.fixItemSize){g=b.width/b.height;d=Math.max(b.width,b.height);j=this._scaleImageSize(a,{width:d,height:d},d);if(g<1){j=j.height/b.height;i=j*e/g}else{i=j.width/b.width;j=i/e*g}e=j*
100;d=i*100;i=(1-i)/2*100;h=(1-j)/g*100*(h?0.5:1);k.style.height=e+"%";if(a.reflection)a.reflection.style.height=e*this.conf.reflectionHeight+"%";k.style.width=d+"%";if(a.reflection)a.reflection.style.width=d+"%";k.style.marginLeft=i+"%";if(a.reflection)a.reflection.style.marginLeft=i+"%";k.style.marginTop=h+"%";a.element.style.overflow="hidden";return b}else return{width:i,height:j}},_setItemSize:function(){return ContentFlowGlobal.Browser.IE?function(a,b){if(this.conf.fixItemSize){if(ContentFlowGlobal.Browser.IE6){var d=
parseInt(a.content.style.height)/100;a.content.style.height=b.height*d+"px";d=parseInt(a.content.style.marginTop)/100;a.content.style.marginTop=b.height*d+"px"}}else a.content.style.height=b.height+"px";if(a.reflection){d=parseInt(a.content.style.height);a.reflection.style.height=d*this.conf.reflectionHeight+"px";a.reflection.style.marginTop=d*this.conf.reflectionGap+"px"}a.element.style.width=b.width+"px";a.element.style.height=b.height*(1+this.conf.reflectionHeight+this.conf.reflectionGap)+"px"}:
function(a,b){if(a.reflection){a.element.style.height=b.height*(1+this.conf.reflectionHeight+this.conf.reflectionGap)+"px";a.reflection.style.marginTop=b.height*this.conf.reflectionGap+"px"}else a.element.style.height=this._reflectionWithinImage?b.height*(1+this.conf.reflectionHeight+this.conf.reflectionGap)+"px":b.height+"px";a.element.style.width=b.width+"px"}}(),_setItemOpacity:function(){return ContentFlowGlobal.Browser.IE6?function(a){if(a.content.origSrc&&a.content.origSrc.match(/\.png$/)){var b=
a.content.src;a.content.src=a.content.origSrc;a.content.style.filter=a.content.filterString+" progid:DXImageTransform.Microsoft.BasicImage(opacity="+a.opacity+")";a.content.src=b}else a.content.style.filter="progid:DXImageTransform.Microsoft.BasicImage(opacity="+a.opacity+")";if(a.reflection)a.reflection.style.filter=a.reflection.filterString+"progid:DXImageTransform.Microsoft.BasicImage(opacity="+a.opacity+")"}:ContentFlowGlobal.Browser.IE?function(a){a.element.style.filter="progid:DXImageTransform.Microsoft.BasicImage(opacity="+
a.opacity+")"}:function(a){a.element.style.opacity=a.opacity}}()};if(!Function.bind)Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}};if(!Math.erf2)Math.erf2=function(a){var b=-(8*(Math.PI-3)/(3*Math.PI*(Math.PI-4)));a=a*a;return 1-Math.pow(Math.E,-a*(4/Math.PI+b*a)/(1+b*a))};if(!Math._2PI05)Math._2PI05=Math.sqrt(2*Math.PI);
if(!Math.normDist)Math.normDist=function(a,b,d){b||(b=1);d||(d=0);a||(a=-d);return 1/(b*Math._2PI05)*Math.pow(Math.E,-(a-d)*(a-d)/(2*b*b))};if(!Math.normedNormDist)Math.normedNormDist=function(a,b,d){return this.normDist(a,b,d)/this.normDist(d,b,d)};if(!Math.exp)Math.exp=function(a){return Math.pow(Math.E,a)};if(!Math.ln)Math.ln=Math.log;if(!Math.log2)Math.log2=function(a){return Math.log(a)/Math.LN2};if(!Math.log10)Math.log10=function(a){return Math.log(a)/Math.LN10};
if(!Math.logerithm)Math.logerithm=function(a,b){return!b||b==Math.E?Math.log(a):b==2?Math.log2(a):b==10?Math.log10(a):Math.log(a)/Math.log(b)};Event||(Event={});if(!Event.stop)Event.stop=function(a){a.cancelBubble=true;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return false};
window.$CF=document.all&&!window.opera?function(a){if(typeof a=="string")return window.$CF(document.getElementById(a));else CFElement.prototype.extend&&a&&!a.extend&&CFElement.prototype.extend(a);return a}:function(a){return a};if(window.HTMLElement)CFElement=window.HTMLElement;else{CFElement={};CFElement.prototype={};CFElement.prototype.extend=function(a){for(var b in this)a[b]||(a[b]=this[b])}}
if(!CFElement.findPos)CFElement.prototype.findPos=function(){var a=this,b=curtop=0;try{if(a.offsetParent){b=a.offsetLeft;for(curtop=a.offsetTop;a=a.offsetParent;){b+=a.offsetLeft;curtop+=a.offsetTop}}}catch(d){}return{left:b,top:curtop}};if(!CFElement.getDimensions)CFElement.prototype.getDimensions=function(){return{width:this.clientWidth,height:this.clientHeight}};if(!CFElement.hasClassName)CFElement.prototype.hasClassName=function(a){return RegExp("\\b"+a+"\\b").test(this.className)};
if(!CFElement.addClassName)CFElement.prototype.addClassName=function(a){this.hasClassName(a)||(this.className+=(this.className?" ":"")+a)};if(!CFElement.removeClassName)CFElement.prototype.removeClassName=function(a){this.className=this.className.replace(RegExp("\\b"+a+"\\b"),"").replace(/\s\s/g," ")};if(!CFElement.toggleClassName)CFElement.prototype.toggleClassName=function(a){this.hasClassName(a)?this.removeClassName(a):this.addClassName(a)};
if(!CFElement.getChildrenByClassName)CFElement.prototype.getChildrenByClassName=function(a){for(var b=[],d=0;d<this.childNodes.length;d++){var g=this.childNodes[d];g.nodeType==1&&$CF(g).hasClassName(a)&&b.push(g)}return b};if(!CFElement.addEvent)CFElement.prototype.addEvent=function(a,b,d){this.addEventListener?this.addEventListener(a,b,d):this.attachEvent("on"+a,b)};
if(!CFElement.removeEvent)CFElement.prototype.removeEvent=function(a,b,d){this.removeEventListener?this.removeEventListener(a,b,d):this.detachEvent("on"+a,b)};if(!window.addEvent)window.addEvent=function(a,b,d){if(this.addEventListener)this.addEventListener(a,b,d);else a!="load"&&a!="resize"?document.attachEvent("on"+a,b):this.attachEvent("on"+a,b)};
if(!window.removeEvent)window.removeEvent=function(a,b,d){if(this.removeEventListener)this.removeEventListener(a,b,d);else a!="load"&&a!="resize"?document.detachEvent("on"+a,b):this.detachEvent("on"+a,b)};ContentFlowGlobal.init();
