
Preloader=function(){var o=this;o.img=[];o.r=[];o.g=[];o.n={};o.total=o.loaded=0;};Preloader.prototype.add=function(i,g){var o=this,n=(o.g[o.total]=[g||"general"])[0];(g=o.n)[n]>=0?++g[n]:g[n]=1;o.img[o.total++]=i;};Preloader.prototype.load=function(){var o=this,p=o.img,l=p.length,a,g=o.g;while(l--){(g[l][1]=a=new Image()).src=p[a.i=l];a.onload=function(){if(o.r[this.i])return;!--o.n[g[this.i][(o.r[this.i]=1)-1]]&&o.onGroupComplete&&o.onGroupComplete(g[this.i][0]);o.onImageComplete&&o.onImageComplete(this);(++o.loaded==o.total)&&o.onComplete&&o.onComplete();};(a.fileSize!==undefined?a.fileSize>-1:a.width)&&a.onload();a.onerror=function(){o.onImageError&&o.onImageError(this);}}};Preloader.prototype.getImagesByGroup=function(n){var g=this.g,i=[],p=0,n=n||"general";for(var j=g.length;j;g[--j][0]==n&&(i[p++]=g[j][1]));return i;};function loadBox(image,link,mDiv,iWidth,iHeight){if(isNaN(iHeight))iHeight=0;var oImage=new Image();oImage.className="cImage";oImage.src=image;new Effect.Fade(mDiv,{duration:0.7,fps:30,afterFinish:function(){$(mDiv).innerHTML="<a href='"+link+"'><img src='"+oImage.src+"' border='0'/></a>";Effect.Appear(mDiv,{queue:'end'});}})
return true;}
Effect.QueueThis=Class.create();Object.extend(Object.extend(Effect.QueueThis.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);this.func=arguments[1];this.start(arguments[2]);},finish:function(position){this.func(this.element);}});function moveLeft(contenedor,riel){var dimCont=Element.getDimensions(contenedor);var x=getX(riel);if(x<0)
return new Effect.Move(riel,{x:dimCont.width,y:0,duration:1});}
function moveRight(contenedor,riel){var dimCont=Element.getDimensions(contenedor);var aPicts=document.getElementsByClassName('picture_thumb');var x=getX(riel);var endPoint=(getX(aPicts[aPicts.length-1])-100)*-1;if(x>endPoint)
return new Effect.Move(riel,{x:(dimCont.width*-1),y:0,duration:1});}
function getX(element){if(element=="")return null;var x=$(element).x?$(element).x:$(element).offsetLeft;return x;}
function prevImage(){if(curIndex>0){curIndex--;loadBox(aImages[curIndex],aLink[curIndex],'fotoHolder2',iImageSize,iMaxHeight)}}
function nextImage(queue){if(queue==undefined){queue=false;currentTimer=null;}
if(curIndex<(aImages.length-1)){curIndex++;loadBox(aImages[curIndex],aLink[curIndex],'fotoHolder2',iImageSize,iMaxHeight);if(queue&&slideshow){currentTimer=setTimeout("nextImage(true)",iTimeout);}}else{loadBox(aImages[0],aLink[0],'fotoHolder2',iImageSize,iMaxHeight);curIndex=0;slideshow=true;currentTimer=setTimeout("nextImage(true)",iTimeout);}}
function makeSlideshow(){slideshow=true;var x=new Preloader();for(c=0;c<aImages.length;c++){x.add(aImages[c],"banners");}
x.onComplete=function(){nextImage(true);};x.load();}
function clearTimer(){if(currentTimer!=null)
clearTimeout(currentTimer);}