var thePicArray=new Array();var tmp=new Array();var winCloseImageSrc='../img/lightbox/close_small.gif';
function addThumbElement(theArray,pictureName,pictureSrc,fadingElement,preloadObject){i=theArray.length;theArray[i]=new Object();theArray[i]["pictureName"]=pictureName;theArray[i]["pictureSrc"]=pictureSrc;theArray[i]["fadingElement"]=fadingElement;theArray[i]["preloadObject"]=preloadObject;}
function replaceThumbElement(number,theArray,pictureName,pictureSrc,fadingElement,preloadObject){if(number < theArray.length){theArray[number]["pictureName"]=pictureName;theArray[number]["pictureSrc"]=pictureSrc;theArray[number]["fadingElement"]=fadingElement;theArray[number]["preloadObject"]=preloadObject;}}
function resetArray(theArray){while(theArray.length>0){theArray.shift();}}
function fadeOverPics (theArray){xajax.$('loadingdata').style.display='';thePicArray=theArray;for(var i=0; i<thePicArray.length; i++){pictureName=thePicArray[i]["pictureName"];pictureSrc=thePicArray[i]["pictureSrc"];fadingElement=thePicArray[i]["fadingElement"];preloadObject=thePicArray[i]["preloadObject"];loadPic(pictureSrc,preloadObject);}checkPics();}
function checkPics(){isLoad=true;message="";for (var i=0; i<thePicArray.length; i++){preloadObject=thePicArray[i]["preloadObject"];if(tmp[preloadObject].complete==false){isLoad=false;break;}}if(isLoad==false){window.setTimeout("checkPics()",1000);}else{fadePics();}return isLoad;}
function fadePics(){for(var i=0;i<thePicArray.length;i++){pictureName=thePicArray[i]["pictureName"];new Effect.Fade(document.getElementsByName(pictureName)[0]);}window.setTimeout("showPictures()",1000);}
function showPictures(){for(var i=0;i<thePicArray.length; i++){pictureName=thePicArray[i]["pictureName"];pictureSrc=thePicArray[i]["pictureSrc"];fadingElement=thePicArray[i]["fadingElement"];preloadObject=thePicArray[i]["preloadObject"];document.getElementsByName(pictureName)[0].src=pictureSrc;new Effect.Appear(document.getElementsByName(pictureName)[0]);}xajax.$('loadingdata').style.display='none';}
function fadeOverPic(pictureSrc,pictureName,blindpic,picWidth,picHeight,title){xajax.$('loadingdata').style.display='';var file = pictureSrc;file = file.replace('../img/photos/', "/");xajax_pictureShown(file);loadPic(pictureSrc,blindpic);checkPic(pictureSrc,pictureName,blindpic,picWidth,picHeight,title);}
function loadPic (pictureSrc,blindpic){tmp[blindpic]=new Image();tmp[blindpic].src=pictureSrc;}
function checkPic(pictureSrc,pictureName,blindpic,picWidth,picHeight,title){
isLoad=true;if(tmp[blindpic].complete==false){isLoad=false;calledFunction="checkPic('"+pictureSrc+"','"+pictureName+"','"+blindpic+"','"+picWidth+"','"+picHeight+"','"+title+"')";window.setTimeout(calledFunction,1000);}else{fadePicture(pictureSrc,pictureName,blindpic,picWidth,picHeight,title);}return isLoad;}
function fadePicture(pictureSrc,pictureName,blindpic,picWidth,picHeight,title){new Effect.Fade(document.getElementsByName(pictureName)[0]);calledFunction="showPicture('"+pictureName+"','"+pictureSrc+"','"+blindpic+"','"+picWidth+"','"+picHeight+"','"+title+"')";window.setTimeout(calledFunction,1000);}
function showPicture (pictureName,pictureSrc,blindpic,picWidth,picHeight,title){document.getElementsByName(pictureName)[0].src=pictureSrc;var x=0;var y=0;var xist=tmp[blindpic].width;var yist=tmp[blindpic].height;var xquot;var yqout;xquot=picWidth / xist;yquot=picHeight/yist;if(xquot>=1&&yquot>=1){x=picWidth;y=picHeight;}else if(xquot <= yquot){x=picWidth;y=yist*picWidth/xist}else{y=picHeight;x=xist*picHeight/yist}document.getElementsByName(pictureName)[0].width=x;document.getElementsByName(pictureName)[0].height=y;setLink('pictureLink',pictureSrc);setTitle('pictureLink',title);new Effect.Appear(document.getElementsByName(pictureName)[0]);xajax.$('loadingdata').style.display='none';}
function setLink(elementId,link){document.getElementsByName(elementId)[0].href=link;}
function setTitle(elementId,title){document.getElementsByName(elementId)[0].title=title;}
function setLightboxProperties(pictureLink,thumb,title){document.getElementsByName(thumb)[0].title=title;if(pictureLink != ''){document.getElementsByName(thumb)[0].rel='lightbox[roadtrip]';document.getElementsByName(thumb)[0].href=pictureLink;document.getElementsByName(thumb)[0].style.display='inline';}else{document.getElementsByName(thumb)[0].rel='';document.getElementsByName(thumb)[0].style.display='none';}}
function lightboxInfoOpen(imgSrc){xajax.$('loadingdata').style.zIndex=200;var win;if(document.getElementById('lightboxInfoWindow')==null){win=createExifWindow('Exif infos');document.getElementsByTagName("body")[0].appendChild(win);}else{win=document.getElementById('lightboxInfoWindow')}xajax.$('exifInfos').firstChild.nodeValue="Loading Exifs...";xajax_showExifs('exifInfos',imgSrc);showExifWindow(win);xajax.$('loadingdata').style.zIndex = 50;}
function lightboxInfoClose(imgSrc){hideExifWindow(document.getElementById('lightboxInfoWindow'));}
function lightboxImageChanged(imgSrc){if(imgSrc != ''){xajax.$('loadingdata').style.zIndex=200;xajax_showExifs('exifInfos',imgSrc);}}
function lightboxShowImage(imgSrc){var file = imgSrc[0];file = file.replace('../img/photos/', "/");xajax_pictureShown(file);}
function createExifWindow(headerText){var win=document.createElement("div");win.setAttribute('id','lightboxInfoWindow');var winHead=document.createElement("div");winHead.setAttribute('id','exifInfosHead');var winTitle=document.createTextNode(headerText);	winHead.appendChild(winTitle);win.appendChild(winHead);var winContentDiv=document.createElement("div");winContentDiv.setAttribute('id','exifInfos');var winContentText=document.createTextNode("Loading Exifs...");winContentDiv.appendChild(winContentText);win.appendChild(winContentDiv);var winClose=document.createElement("span");winClose.setAttribute('id','exifInfosClose');var winCloseText=document.createTextNode('(Click hear to close)');winClose.appendChild(winCloseText);Event.observe(win,"mousedown",hideExifFromIntern);win.appendChild(winClose);return win;}
function showExifWindow(el){if(el != null) new Effect.Appear(el,{ duration: 0.25 });}
function hideExifWindow(el){if(el != null) new Effect.Fade(el,{ duration: 0.25 });}
function hideExifFromIntern(){var el;if(document.getElementById('lightboxInfoWindow')== null){el=createExifWindow('Exif infos');
}else{el=document.getElementById('lightboxInfoWindow')}hideExifWindow(el);}
