
function ImagePreloader(images,callback)
{this.callback=callback;this.nLoaded=0;this.nProcessed=0;this.aImages=new Array();this.nImages=images.length;for(var i=0;i<images.length;i++)
this.preload(images[i]);}
ImagePreloader.prototype.preload=function(image)
{var oImage=new Image;this.aImages.push(oImage);oImage.onload=ImagePreloader.prototype.onload;oImage.onerror=ImagePreloader.prototype.onerror;oImage.onabort=ImagePreloader.prototype.onabort;oImage.oImagePreloader=this;oImage.bLoaded=false;oImage.source=image;oImage.src=image;}
ImagePreloader.prototype.onComplete=function()
{this.nProcessed++;if(this.nProcessed==this.nImages)
this.callback(this.aImages);}
ImagePreloader.prototype.onload=function()
{this.bLoaded=true;if(this.oImagePreloader.nLoaded==undefined)this.oImagePreloader.nLoaded=0;this.oImagePreloader.nLoaded++;this.oImagePreloader.onComplete();}
ImagePreloader.prototype.onerror=function()
{this.bError=true;this.oImagePreloader.onComplete();}
ImagePreloader.prototype.onabort=function()
{this.bAbort=true;this.oImagePreloader.onComplete();}
function loadBox(image,mDiv,iWidth,iHeight){if(isNaN(iHeight))iHeight=0;$(mDiv).style.background="url(images/loading.gif) center center no-repeat";var oImage=new Image();oImage.className="cImage";oImage.src='image.php?pic='+image+'&resize=1&orientation=h&img_size='+iWidth+'&max_h='+iHeight;oImage.onload=function(){new Effect.Fade(mDiv,{duration:0.5,fps:30,afterFinish:function(){$(mDiv).innerHTML="<img src='"+oImage.src+"' border='0'/>";Effect.Appear(mDiv,{queue:'end'});}})
return false;}
return true;}
function loadBoxP(oImage,mDiv){new Effect.Fade(mDiv,{duration:0.5,fps:30,afterFinish:function(){$(mDiv).innerHTML="<img src='"+oImage+"' border='0'/>";Effect.Appear(mDiv,{queue:'end'});}})
return false;}
Effect.Combo=function(element){element=$(element);if(element.style.display=='none'){new Effect.BlindDown(element,arguments[1]||{});}else{new Effect.BlindUp(element,arguments[1]||{});}}
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(){slideshow=false;if(curIndex>0){curIndex--;loadBox(aImages[curIndex],'fotoHolder2',iImageSize,iMaxHeight)}}
function nextImage(queue){if(queue==undefined){queue=false;currentTimer=null;}
if(curIndex<(aImages.length-1)){curIndex++;loadBox(aImages[curIndex],'fotoHolder2',iImageSize,iMaxHeight);if(queue&&slideshow){currentTimer=setTimeout("nextImage(true)",iTimeout);}}}
function flashImage(mdiv,image){slideshow=false;clearTimer();Effect.Pulsate(mdiv,{duration:0.4});for(var c=0;c<aImages.length;c++){if(aImages[c]==image){curIndex=c;break;}}
loadBox(image,'fotoHolder2',iImageSize,iMaxHeight);}
function makeSlideshow(){if(slideshow){slideshow=false;clearTimer();}else{slideshow=true;nextImage(true);}}
function clearTimer(){if(currentTimer!=null)
clearTimeout(currentTimer);}