(function($){$.jScrollPane={active:[]};$.fn.jScrollPane=function(settings)
{settings=$.extend({},$.fn.jScrollPane.defaults,settings);var rf=function(){return false;};return this.each(function()
{var $this=$(this);var paneEle=this;var currentScrollPosition=0;var paneWidth;var paneHeight;var trackHeight;var trackOffset=settings.topCapHeight;if($(this).parent().is('.jScrollPaneContainer')){currentScrollPosition=settings.maintainPosition?$this.position().top:0;var $c=$(this).parent();paneWidth=$c.innerWidth();paneHeight=$c.outerHeight();$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap',$c).remove();$this.css({'top':0});}else{$this.data('originalStyleTag',$this.attr('style'));$this.css('overflow','hidden');this.originalPadding=$this.css('paddingTop')+' '+$this.css('paddingRight')+' '+$this.css('paddingBottom')+' '+$this.css('paddingLeft');this.originalSidePaddingTotal=(parseInt($this.css('paddingLeft'))||0)+(parseInt($this.css('paddingRight'))||0);paneWidth=$this.innerWidth();paneHeight=$this.innerHeight();var $container=$('<div></div>').attr({'className':'jScrollPaneContainer'}).css({'height':paneHeight+'px','width':paneWidth+'px'});$this.wrap($container);}
trackHeight=paneHeight;var p=this.originalSidePaddingTotal;var realPaneWidth=paneWidth-settings.scrollbarWidth-settings.scrollbarMargin-p;var cssToApply={'height':'auto','width':realPaneWidth+'px'}
if(settings.scrollbarOnLeft){cssToApply.paddingLeft=settings.scrollbarMargin+settings.scrollbarWidth+'px';}else{cssToApply.paddingRight=settings.scrollbarMargin+'px';}
$this.css(cssToApply);var contentHeight=$this.outerHeight();var percentInView=paneHeight/contentHeight;if(percentInView<.99){var $container=$this.parent();$container.append($('<div></div>').addClass('jScrollCap jScrollCapTop').css({height:settings.topCapHeight}),$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'}))),$('<div></div>').addClass('jScrollCap jScrollCapBottom').css({height:settings.bottomCapHeight}));var $track=$('>.jScrollPaneTrack',$container);var $drag=$('>.jScrollPaneTrack .jScrollPaneDrag',$container);var currentArrowDirection;var currentArrowInc;var whileArrowButtonDown=function()
{if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection);}
currentArrowInc++;};if(settings.showArrows){var currentArrowButton;var currentArrowInterval;var onArrowMouseUp=function(event)
{$('html').unbind('mouseup',onArrowMouseUp);currentArrowButton.removeClass('jScrollActiveArrowButton');clearInterval(currentArrowInterval);};var onArrowMouseDown=function(){$('html').bind('mouseup',onArrowMouseUp);currentArrowButton.addClass('jScrollActiveArrowButton');currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100);};$container.append($('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowUp'}).css({'width':settings.scrollbarWidth+'px','top':settings.topCapHeight+'px'}).html('Scroll up').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false;}).bind('click',rf),$('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowDown'}).css({'width':settings.scrollbarWidth+'px','bottom':settings.bottomCapHeight+'px'}).html('Scroll down').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false;}).bind('click',rf));var $upArrow=$('>.jScrollArrowUp',$container);var $downArrow=$('>.jScrollArrowDown',$container);}
if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;trackOffset+=settings.arrowSize;}else if($upArrow){var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-topArrowHeight-$downArrow.height();trackOffset+=topArrowHeight;}
trackHeight-=settings.topCapHeight+settings.bottomCapHeight;$track.css({'height':trackHeight+'px',top:trackOffset+'px'})
var $pane=$(this).css({'position':'absolute','overflow':'visible'});var currentOffset;var maxY;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event,c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;};var ignoreNativeDrag=function(){return false;};var initDrag=function()
{currentOffset=$drag.offset(false);currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;};var onStartDrag=function(event)
{initDrag();dragMiddle=getPos(event,'Y')-dragPosition-currentOffset.top;$('html').bind('mouseup',onStopDrag).bind('mousemove',updateScroll);if($.browser.msie){$('html').bind('dragstart',ignoreNativeDrag).bind('selectstart',ignoreNativeDrag);}
return false;};var onStopDrag=function()
{$('html').unbind('mouseup',onStopDrag).unbind('mousemove',updateScroll);dragMiddle=percentInView*paneHeight/2;if($.browser.msie){$('html').unbind('dragstart',ignoreNativeDrag).unbind('selectstart',ignoreNativeDrag);}};var positionDrag=function(destY)
{$container.scrollTop(0);destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({'top':destY+'px'});var p=destY/maxY;$this.data('jScrollPanePosition',(paneHeight-contentHeight)*-p);$pane.css({'top':((paneHeight-contentHeight)*p)+'px'});$this.trigger('scroll');if(settings.showArrows){$upArrow[destY==0?'addClass':'removeClass']('disabled');$downArrow[destY==maxY?'addClass':'removeClass']('disabled');}};var updateScroll=function(e)
{positionDrag(getPos(e,'Y')-currentOffset.top-dragMiddle);};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.css({'height':dragH+'px'}).bind('mousedown',onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function()
{if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)));}
trackScrollInc++;};var onStopTrackClick=function()
{clearInterval(trackScrollInterval);$('html').unbind('mouseup',onStopTrackClick).unbind('mousemove',onTrackMouseMove);};var onTrackMouseMove=function(event)
{trackScrollMousePos=getPos(event,'Y')-currentOffset.top-dragMiddle;};var onTrackClick=function(event)
{initDrag();onTrackMouseMove(event);trackScrollInc=0;$('html').bind('mouseup',onStopTrackClick).bind('mousemove',onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();return false;};$track.bind('mousedown',onTrackClick);$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta)
{var currentPos=-parseInt($pane.css('top'))||0;scrollTo(currentPos+delta);};initDrag();scrollTo(-currentScrollPosition,true);if(location.hash&&location.hash.length>1){setTimeout(function(){scrollTo(location.hash);},$.browser.safari?100:0);}
$.jScrollPane.active.push($this[0]);}else{$this.css({'height':paneHeight+'px','width':paneWidth-this.originalSidePaddingTotal+'px','padding':this.originalPadding});$this[0].scrollTo=$this[0].scrollBy=function(){};}})};$.fn.jScrollPaneRemove=function()
{$(this).each(function()
{$this=$(this);var $c=$this.parent();if($c.is('.jScrollPaneContainer')){$this.css({'top':'','height':'','width':'','padding':'','overflow':'','position':''});$this.attr('style',$this.data('originalStyleTag'));$c.after($this).remove();}});}
$.fn.jScrollPane.defaults={scrollbarWidth:11,scrollbarMargin:50,showArrows:true,arrowSize:0,dragMinHeight:1,dragMaxHeight:99999,maintainPosition:true,scrollbarOnLeft:false,topCapHeight:0,bottomCapHeight:0};})(jQuery);function evalidate(emailAddress){var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);return pattern.test(emailAddress);}
function validate(){$("#contact-form input, #contact-form textarea").removeClass("error");$("#contact-form div.error").empty();if(!$("#fname").val()){$("#fname").addClass("error").focus();$("div.error").text("Please enter your first name");}
else if(!$("#lname").val()){$("#lname").addClass("error").focus();$("div.error").text("Please enter your last name");}
else if(!$("#email1").val()||evalidate($("#email1").val())===false){$("#email1").addClass("error").focus();$("div.error").text("Please enter a valid email");}
else if(!$("#email2").val()||evalidate($("#email2").val())===false){$("#email2").addClass("error").focus();$("div.error").text("Please enter a valid email");}
else if($("#email1").val()!=$("#email2").val()){$("#email1, #email2").addClass("error");$("div.error").text("Your emails do not match");}
else if(!$("#message").val()){$("#message").addClass("error").focus();$("div.error").text("Please enter your message");}
else{$.post("/index.php",$("#contact-form").serialize(),function(){$("#contact .content").empty().append('<p style="font-size: 1.3em; padding: 7em 10em;">Thank you for your submission.<br />We will be contacting you shortly.</p>');});}
return false;}
function theRotator(){$(".home-text").hide();$(".home-text:first").fadeIn("slow");setInterval('rotate()',6000);}
function rotate(){var current=$(".home-text:visible");var next=((current.next().length)?((current.next().hasClass("show"))?$(".home-text:first"):current.next()):$(".home-text:first"))
current.hide().removeClass("show");next.fadeIn("slow").addClass("show");};function layout(){var win=$(window).width();$(".wrap").width(win);$(".wrap").css({"margin-left":(3050-win)});$(".wrap:first").css({"margin-left":0});var bg=$(".wrap:first .container").offset().left-200;$("body").css({"background-position":bg+"px top"});if($(".modal").is(":visible")){$(".modal").modal()}}
function loadContent(url,id){$(url+" .content").load("/index.php/baah/"+id,function(){$("#products .content *").fadeIn("slow");if(id=="belts"){var instanceOne=new ImageFlow();instanceOne.init({ImageFlowID:'beltflow'});}
if(id=="buckles"){var instanceTwo=new ImageFlow();instanceTwo.init({ImageFlowID:'buckleflow'});}
$(window).scrollLeft($(url).offset().left);});}
$(document).ready(function(){$(".wrapper").css("display","block").fadeIn(2000);$(".pageLoad").css("display","block").fadeIn(1000).fadeTo(2000,1).fadeOut(3000);$("#order .store a").click(function(){window.open($(this).attr('href'));return false;});theRotator();layout();$(".modal").modal("#contact").hide();var resizeTimer=null;$(window).bind('resize',function(){if(resizeTimer){clearTimeout(resizeTimer);}
resizeTimer=setTimeout(layout,100);});$('.overflow').jScrollPane();if($.browser.safari){doc="body";}
else{doc="html";}
$(".mainnav a, .subnav a, h1 a, a.intLink").bind('click',function(){id=$(this).attr("rel");url=$(this).attr("href");content=$(this).parents(".container").children(".content");if(!$(this).hasClass("selected")){if(url!="#products"){$(doc).animate({scrollLeft:$(url).offset().left},4000,"swing");}
else{$("#products .content *").fadeOut(3000);$(doc).animate({scrollLeft:$(url).offset().left},4000,"swing",function(){loadContent(url,id);});}
$(".mainnav a, .subnav a").removeClass("selected");$(".mainnav a[rel="+id+"], .subnav a[rel="+id+"]").addClass("selected");}
return false;});if($(window).width()<=950){$("body").css("overflow-x","auto");}
if($(window).height()<=580){$("body").css("overflow-y","auto");$(".modal").css("margin-top","-55px");}});jQuery.fn.modal=function(def){return this.each(function(){var ah=$(this).height();var aw=$(this).width();var ww=$(window).width();if(def){var nw=((ww/2)-(aw/2))+$(def).offset().left;}
else{var nw=((ww/2)-(aw/2))+$(url).offset().left;}
$(this).css({'top':65,'left':nw}).fadeIn("slow");});};jQuery.fn.align=function(align){return this.each(function(){if(align="vertical"){var eh=$(this).height();var ph=$(this).parent().height();var nh=(ph-eh)/2;$(this).css({'padding-top':nh});}});};function ImageFlow()
{this.defaults={aspectRatio:1.964,buttons:true,imageCursor:'default',imageFocusM:1.25,imageFocusMax:2,imageScaling:true,imagesHeight:0.67,imagesM:1.0,onClick:function(){$(".modal").modal();var img=new Image();img.src=this.url;$(".modal .image, .modal .desc").empty();$(".modal .image").append(img).fadeIn("slow",function(){$("div.image").align("vertical");});$(".modal .desc").append('<h2>'+$(this).attr("alt")+'</h2>'+$(this).attr("desc"));},opacity:true,opacityArray:[10,8,6,4,2],percentLandscape:118,percentOther:100,preloadImages:true,reflectionGET:'',reflectionP:0.5,startID:3,xStep:150};var thisObject=this;this.init=function(options)
{var optionsArray=['aspectRatio','buttons','imageCursor','imagesM','ImageFlowID','imageFocusM','imageFocusMax','imagesHeight','onClick','opacity','opacityArray','percentLandscape','percentOther','preloadImages','reflections','reflectionGET','reflectionP','reflectionPNG','imageScaling','startID','xStep'];var max=optionsArray.length;for(var i=0;i<max;i++)
{var name=optionsArray[i];this[name]=(options!==undefined&&options[name]!==undefined)?options[name]:thisObject.defaults[name];}
var ImageFlowDiv=document.getElementById(thisObject.ImageFlowID);if(ImageFlowDiv)
{ImageFlowDiv.style.visibility='visible';this.ImageFlowDiv=ImageFlowDiv;if(this.createStructure())
{this.imagesDiv=document.getElementById(thisObject.ImageFlowID+'_images');this.navigationDiv=document.getElementById(thisObject.ImageFlowID+'_navigation');this.buttonNextDiv=document.getElementById(thisObject.ImageFlowID+'_next');this.buttonPreviousDiv=document.getElementById(thisObject.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;var width=this.ImageFlowDiv.offsetWidth;var height=Math.round(width/thisObject.aspectRatio);document.getElementById(thisObject.ImageFlowID+'_loading_txt').style.paddingTop=((height*0.5)-22)+'px';ImageFlowDiv.style.height=height+'px';this.loadingProgress();}}};this.createStructure=function()
{var imagesDiv=thisObject.Helper.createDocumentElement('div','images');var node=null;var max=this.ImageFlowDiv.childNodes.length;for(var index=0;index<max;index++)
{node=this.ImageFlowDiv.childNodes[index];if(node&&node.nodeType==1&&node.nodeName=='IMG')
{var src=node.getAttribute('src',2);src='http://baah.com/reflect3.php?img='+src+thisObject.reflectionGET;node.setAttribute('src',src);var imageNode=node.cloneNode(true);imagesDiv.appendChild(imageNode);}}
var loadingP=thisObject.Helper.createDocumentElement('p','loading_txt');var loadingText=document.createTextNode(' ');loadingP.appendChild(loadingText);var loadingDiv=thisObject.Helper.createDocumentElement('div','loading');var loadingBarDiv=thisObject.Helper.createDocumentElement('div','loading_bar');loadingDiv.appendChild(loadingBarDiv);var navigationDiv=thisObject.Helper.createDocumentElement('div','navigation');var buttonPreviousDiv=thisObject.Helper.createDocumentElement('div','previous','button');var buttonNextDiv=thisObject.Helper.createDocumentElement('div','next','button');navigationDiv.appendChild(buttonPreviousDiv);navigationDiv.appendChild(buttonNextDiv);var success=false;if(thisObject.ImageFlowDiv.appendChild(imagesDiv)&&thisObject.ImageFlowDiv.appendChild(loadingP)&&thisObject.ImageFlowDiv.appendChild(loadingDiv)&&thisObject.ImageFlowDiv.appendChild(navigationDiv))
{for(index=0;index<max;index++)
{node=this.ImageFlowDiv.childNodes[index];if(node&&node.nodeType==1&&node.nodeName=='IMG')
{this.ImageFlowDiv.removeChild(node);}}
success=true;}
return success;};this.loadingProgress=function()
{var p=thisObject.loadingStatus();if(p<100||thisObject.firstCheck===true&&thisObject.preloadImages===true)
{if(thisObject.firstCheck===true&&p==100)
{thisObject.firstCheck=false;window.setTimeout(thisObject.loadingProgress,100);}
else
{window.setTimeout(thisObject.loadingProgress,40);}}
else
{document.getElementById(thisObject.ImageFlowID+'_loading_txt').style.display='none';document.getElementById(thisObject.ImageFlowID+'_loading').style.display='none';thisObject.MouseWheel.init();thisObject.Key.init();thisObject.refresh(true);var startID=thisObject.startID-1;if(startID<0)
{startID=0;}
else if(startID>thisObject.max)
{startID=thisObject.max-1;}
else
{startID=Math.round(thisObject.max/2)-1;}
thisObject.glideTo(startID);thisObject.moveTo(5000);}};this.loadingStatus=function()
{var max=thisObject.imagesDiv.childNodes.length;var i=0,completed=0;var image=null;for(var index=0;index<max;index++)
{image=thisObject.imagesDiv.childNodes[index];if(image&&image.nodeType==1&&image.nodeName=='IMG')
{if(image.complete===true)
{completed++;}
i++;}}
var finished=Math.round((completed/i)*100);var loadingBar=document.getElementById(thisObject.ImageFlowID+'_loading_bar');loadingBar.style.width=finished+'%';var loadingP=document.getElementById(thisObject.ImageFlowID+'_loading_txt');var loadingTxt=document.createTextNode('loading images '+completed+'/'+i);loadingP.replaceChild(loadingTxt,loadingP.firstChild);return finished;};this.refresh=function()
{this.imagesDivWidth=thisObject.imagesDiv.offsetWidth+thisObject.imagesDiv.offsetLeft;this.maxHeight=Math.round(thisObject.imagesDivWidth/thisObject.aspectRatio);this.maxFocus=thisObject.imageFocusMax*thisObject.xStep;this.size=thisObject.imagesDivWidth*0.5;this.imagesDivHeight=Math.round(thisObject.maxHeight*thisObject.imagesHeight);thisObject.ImageFlowDiv.style.height=thisObject.maxHeight+'px';thisObject.imagesDiv.style.height=thisObject.imagesDivHeight+'px';if(thisObject.buttons)
{thisObject.buttonPreviousDiv.onclick=function(){thisObject.MouseWheel.handle(1);};thisObject.buttonNextDiv.onclick=function(){thisObject.MouseWheel.handle(-1);};}
var multi=(thisObject.reflections===true)?thisObject.reflectionP+1:1;var max=thisObject.imagesDiv.childNodes.length;var i=0;var image=null;for(var index=0;index<max;index++)
{image=thisObject.imagesDiv.childNodes[index];if(image!==null&&image.nodeType==1&&image.nodeName=='IMG')
{this.indexArray[i]=index;image.url=image.getAttribute('longdesc');image.xPosition=(-i*thisObject.xStep);image.i=i;if(thisObject.firstRefresh)
{if(image.getAttribute('width')!==null&&image.getAttribute('height')!==null)
{image.w=image.getAttribute('width');image.h=image.getAttribute('height')*multi;}
else{image.w=image.width;image.h=image.height;}}
if((image.w)>(image.h/(thisObject.reflectionP+1)))
{image.pc=thisObject.percentLandscape;image.pcMem=thisObject.percentLandscape;}
else
{image.pc=thisObject.percentOther;image.pcMem=thisObject.percentOther;}
if(thisObject.imageScaling===false)
{image.style.position='relative';image.style.display='inline';}
image.style.cursor=thisObject.imageCursor;i++;}}
this.max=thisObject.indexArray.length;if(thisObject.imageScaling===false)
{image=thisObject.imagesDiv.childNodes[thisObject.indexArray[0]];this.totalImagesWidth=image.w*thisObject.max;image.style.paddingLeft=(thisObject.imagesDivWidth/2)+(image.w/2)+'px';thisObject.imagesDiv.style.height=image.h+'px';thisObject.navigationDiv.style.height=(thisObject.maxHeight-image.h)+'px';}
if(thisObject.firstRefresh)
{thisObject.firstRefresh=false;}
thisObject.glideTo(thisObject.imageID);thisObject.moveTo(thisObject.current);};this.moveTo=function(x)
{this.current=x;this.zIndex=thisObject.max;for(var index=0;index<thisObject.max;index++)
{var image=thisObject.imagesDiv.childNodes[thisObject.indexArray[index]];var currentImage=index*-thisObject.xStep;if(thisObject.imageScaling)
{if((currentImage+thisObject.maxFocus)<thisObject.memTarget||(currentImage-thisObject.maxFocus)>thisObject.memTarget)
{image.style.visibility='hidden';image.style.display='none';}
else
{var z=(Math.sqrt(10000+x*x)+100)*thisObject.imagesM;var xs=x/z*thisObject.size+thisObject.size;image.style.display='block';var newImageH=(image.h/image.w*image.pc)/z*thisObject.size;var newImageW=0;switch(newImageH>thisObject.maxHeight)
{case false:newImageW=image.pc/z*thisObject.size;break;default:newImageH=thisObject.maxHeight;newImageW=image.w*newImageH/image.h;break;}
var newImageTop=(thisObject.imagesDivHeight-newImageH)/2+((newImageH/(thisObject.reflectionP+1))*thisObject.reflectionP);image.style.left=xs-(image.pc/2)/z*thisObject.size+'px';if(newImageW&&newImageH)
{image.style.height=newImageH+'px';image.style.width=newImageW+'px';image.style.top=newImageTop+'px';}
image.style.visibility='visible';switch(x<0)
{case true:this.zIndex++;break;default:this.zIndex=thisObject.zIndex-1;break;}
switch(image.i==thisObject.imageID)
{case false:image.onclick=function(){thisObject.glideTo(this.i);};break;default:this.zIndex=thisObject.zIndex+1;if(image.url!=='')
{image.onclick=thisObject.onClick;}
break;}
image.style.zIndex=thisObject.zIndex;}}
x+=thisObject.xStep;}};this.glideTo=function(imageID)
{var x=-imageID*thisObject.xStep;this.target=x;this.memTarget=x;this.imageID=imageID;if(thisObject.opacity===true||thisObject.imageFocusM!==thisObject.defaults.imageFocusM)
{thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[imageID],thisObject.opacityArray[0]);thisObject.imagesDiv.childNodes[imageID].pc=thisObject.imagesDiv.childNodes[imageID].pc*thisObject.imageFocusM;var opacityValue=0;var rightID=0;var leftID=0;var last=thisObject.opacityArray.length;for(var i=1;i<(thisObject.imageFocusMax+1);i++)
{if((i+1)>last)
{opacityValue=thisObject.opacityArray[last-1];}
else
{opacityValue=thisObject.opacityArray[i];}
rightID=imageID+i;leftID=imageID-i;if(rightID<thisObject.max)
{thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[rightID],opacityValue);thisObject.imagesDiv.childNodes[rightID].pc=thisObject.imagesDiv.childNodes[rightID].pcMem;}
if(leftID>=0)
{thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[leftID],opacityValue);thisObject.imagesDiv.childNodes[leftID].pc=thisObject.imagesDiv.childNodes[leftID].pcMem;}}}
if(thisObject.busy===false)
{window.setTimeout(thisObject.animate,50);thisObject.busy=true;}};this.animate=function()
{switch(thisObject.target<thisObject.current-1||thisObject.target>thisObject.current+1)
{case true:thisObject.moveTo(thisObject.current+(thisObject.target-thisObject.current)/3);window.setTimeout(thisObject.animate,50);thisObject.busy=true;break;default:thisObject.busy=false;break;}};this.MouseWheel={init:function()
{if(window.addEventListener)
{thisObject.ImageFlowDiv.addEventListener('DOMMouseScroll',thisObject.MouseWheel.get,false);}
thisObject.Helper.addEvent(thisObject.ImageFlowDiv,'mousewheel',thisObject.MouseWheel.get);},get:function(event)
{var delta=0;if(!event)
{event=window.event;}
if(event.wheelDelta)
{delta=event.wheelDelta/120;}
else if(event.detail)
{delta=-event.detail/3;}
if(delta)
{thisObject.MouseWheel.handle(delta);}
thisObject.Helper.suppressBrowserDefault(event);},handle:function(delta)
{var change=false;var newImageID=0;if(delta>0)
{if(thisObject.imageID>=1)
{newImageID=thisObject.imageID-1;change=true;}}
else
{if(thisObject.imageID<(thisObject.max-1))
{newImageID=thisObject.imageID+1;change=true;}}
if(change===true)
{thisObject.glideTo(newImageID);}}};this.Key={init:function()
{document.onkeydown=function(event){thisObject.Key.handle(event);};},handle:function(event)
{var charCode=thisObject.Key.get(event);switch(charCode)
{case 39:thisObject.MouseWheel.handle(-1);break;case 37:thisObject.MouseWheel.handle(1);break;}},get:function(event)
{event=event||window.event;return event.keyCode;}};this.Helper={addEvent:function(obj,type,fn)
{if(obj.addEventListener)
{obj.addEventListener(type,fn,false);}
else if(obj.attachEvent)
{obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event);};obj.attachEvent("on"+type,obj[type+fn]);}},setOpacity:function(object,value)
{if(thisObject.opacity===true)
{object.style.opacity=value/10;object.style.filter='alpha(opacity='+value*10+')';}},createDocumentElement:function(type,id,optionalClass)
{var element=document.createElement(type);element.setAttribute('id',thisObject.ImageFlowID+'_'+id);if(optionalClass!==undefined)
{id+=' '+optionalClass;}
element.setAttribute('class',id);element.setAttribute('className',id);return element;},suppressBrowserDefault:function(e)
{if(e.preventDefault)
{e.preventDefault();}
else
{e.returnValue=false;}
return false;},addResizeEvent:function()
{var otherFunctions=window.onresize;if(typeof window.onresize!='function')
{window.onresize=function()
{thisObject.refresh();};}
else
{window.onresize=function(){if(otherFunctions)
{otherFunctions();}
thisObject.refresh();};}}};}
