var visiblePhoto;var visiblePhotoBtnBg;var visiblePhotoCaption;var selectedPhotoCaption;var swapBtnIndicatorWith;var photoCaptionTimeout;var photoCaptionReset;var photoCaptionFadeIn;var photoCaptionFadeCount;var lastPhotoId=1;function photoBrowserInit(){visiblePhoto=document.getElementById('photo1');visiblePhotoBtnBg=document.getElementById('photo1btnbg');visiblePhotoCaption=document.getElementById('photo1caption');photoSelect('photo1');getLastPhotoId()}
function getLastPhotoId(){while(lastPhotoId){if(document.getElementById('photo'+(lastPhotoId+1)+'btnbg')){lastPhotoId++}
else{break}
}
}
function photoSelectNext(){var number=getPhotoNext();photoBtnOver('photo'+number);photoSelect('photo'+number);photoBtnOut()}
function photoSelectPrev(){var number=getPhotoPrev();photoBtnOver('photo'+number);photoSelect('photo'+number);photoBtnOut()}
function photoArrowOver(imageId){var changeArrowColor=document.getElementById('photo'+imageId+'bg');changeArrowColor.style.backgroundColor="#ff9900";if(imageId=="prev"){var number=getPhotoPrev();photoBtnOver('photo'+number)}
else{var number=getPhotoNext();photoBtnOver('photo'+number)}
}
function photoArrowOut(imageId){var changeArrowColor=document.getElementById('photo'+imageId+'bg');changeArrowColor.style.backgroundColor="#586875";photoBtnOut()}
function getPhotoNext(){var visiblePhotoId=visiblePhoto.id;visiblePhotoId=visiblePhotoId.substring(5);var nextPhotoId;if(visiblePhotoId!=lastPhotoId){nextPhotoId=visiblePhotoId;nextPhotoId++}
else{nextPhotoId='1'}
return nextPhotoId}
function getPhotoPrev(){var visiblePhotoId=visiblePhoto.id;visiblePhotoId=visiblePhotoId.substring(5);var prevPhotoId;if(visiblePhotoId=='1'){prevPhotoId=lastPhotoId}
else{prevPhotoId=visiblePhotoId;prevPhotoId--}
return prevPhotoId}
function photoSelect(photoNumber){var swapPhotoWith=document.getElementById(photoNumber);var swapPhotoBtnBgWith=document.getElementById(photoNumber+'btnbg');var getSwabPhotoBtn=swapPhotoBtnBgWith.getElementsByTagName("div");var swapPhotoBtnWith=getSwabPhotoBtn.item(0);var getVisiblePhotoBtn=visiblePhotoBtnBg.getElementsByTagName("div");var visiblePhotoBtn=getVisiblePhotoBtn.item(0);visiblePhoto.style.display="none";swapPhotoWith.style.display="block";visiblePhoto=swapPhotoWith;visiblePhotoBtnBg.style.paddingLeft="0px";visiblePhotoBtnBg.style.paddingRight="1px";swapPhotoBtnBgWith.style.paddingLeft="1px";swapPhotoBtnBgWith.style.paddingRight="0px";visiblePhotoBtnBg=swapPhotoBtnBgWith;visiblePhotoBtn.style.borderTopWidth="0px";visiblePhotoBtn.style.borderBottomWidth="1px";visiblePhotoBtn.style.backgroundColor="#FFFFFF";swapPhotoBtnWith.style.borderTopWidth="1px";swapPhotoBtnWith.style.borderBottomWidth="0px";swapPhotoBtnWith.style.backgroundColor="#ff9900";visiblePhotoBtn=swapPhotoBtnWith;selectedPhotoCaption=visiblePhotoCaption}
function photoBtnOver(photoNumber){if(photoCaptionTimeout){window.clearTimeout(photoCaptionTimeout)}
if(photoCaptionFadeIn){window.clearTimeout(photoCaptionFadeIn);selectedPhotoCaption.style.color="#000000"}
swapBtnIndicatorWith=document.getElementById(photoNumber+'btnbg');swapBtnIndicatorWith.style.borderColor="#ff9900";var swapPhotoCaptionWith=document.getElementById(photoNumber+'caption');if(swapPhotoCaptionWith!=visiblePhotoCaption){visiblePhotoCaption.style.display="none";swapPhotoCaptionWith.style.display="block";visiblePhotoCaption=swapPhotoCaptionWith}
}
function photoBtnOut(){swapBtnIndicatorWith.style.borderColor="#586976";if(visiblePhotoCaption!=selectedPhotoCaption){swapPhotoCaptionWith=document.getElementById('photoXcaption');visiblePhotoCaption.style.display="none";swapPhotoCaptionWith.style.display="block";visiblePhotoCaption=swapPhotoCaptionWith;photoCaptionTimeout=window.setTimeout('photoCaptionReset()',750)}
}
function photoCaptionReset(){visiblePhotoCaption.style.display="none";selectedPhotoCaption.style.color="#FFFFFF";selectedPhotoCaption.style.display="block";visiblePhotoCaption=selectedPhotoCaption;photoCaptionFadeCount=0;photoCaptionFadeIn=setInterval('fadeInPhotoCaption()',50)}
function fadeInPhotoCaption(){var colors=new Array("#EEEEEE","#DDDDDD","#BBBBBB","#999999","#777777","#555555","#333333","#000000");colorValue=colors[photoCaptionFadeCount];selectedPhotoCaption.style.color=colorValue;photoCaptionFadeCount++;if(photoCaptionFadeCount==8){clearInterval(photoCaptionFadeIn)}
}