<!--
// Jeff
//www.huntingground.freeserve.co.uk

var image = [
["images/gallery/activityroom.jpg","Activity Room"],
["images/gallery/barbeque.jpg","Barbeque"],
["images/gallery/buffet.jpg","Buffet"],
["images/gallery/computers.jpg","Computers"],
["images/gallery/backpatio.jpg","Back Patio"],
["images/gallery/bedroom.jpg","Bedroom"],
["images/gallery/fireplace.jpg","Fireplace"],
["images/gallery/fireplace2.jpg","Fireplace2"],
["images/gallery/dining.jpg","Dining"],
["images/gallery/dining2.jpg","Dining2"],
["images/gallery/family.jpg","Family"],
["images/gallery/cookies.jpg","Cookies"],
["images/gallery/stringband.jpg","Stringband"],
["images/gallery/golfcourse.jpg","Golf Carts"],
["images/gallery/golfcourse2.jpg","Golf Course"],
["images/gallery/pooltable2.jpg","Pool Table"],
["images/gallery/sewing.jpg","Sewing"],
["images/gallery/teaparty.jpg","Tea"],
["images/gallery/horse.jpg","Barrys Horse"],
["images/gallery/fathersdaybbq.jpg","Fathers Day BBQ"],
["images/gallery/tom.jpg","Tom"],
["images/gallery/tom2.jpg","Tom2"],
["images/gallery/harry.jpg","Harry"],
["images/gallery/stagecoach.jpg","Stagecoach"],
["images/gallery/gail.jpg","Gail"],
["images/gallery/vdaymusic.jpg","Valentines Day Music"],
["images/gallery/vdaygroup.jpg","Valentines Day"],
["images/gallery/Buddy2.jpg","Buddy"],
["images/gallery/marley.jpg","Marley"],
["images/gallery/dogs.jpg","Dogs"],
["images/gallery/visitorfathersday.jpg","Fathers Day Visitors"],
["images/gallery/pageantreception.jpg","Miss South Dakota Pageant Reception"],
["images/gallery/mssouthdakotaandresident.jpg","Miss South Dakota Contestant and Resident"],
["images/gallery/mssouthdakotaandresident2.jpg","Miss South Dakota Contestant and Resident"],
["images/gallery/mshotsprings.jpg","Miss Hot Springs"],
["images/gallery/misssouthdakota.jpg","Miss South Dakota"],
["images/gallery/oldiessingalong.jpg","Oldies Sing Along"]

// no comma at the end of last index
]

var startPicWidth=200 // thumbnail width
var startPicHeight=150 // thumbnail height
var stepNum=5 // number of steps to reach full size

var newImage=new Array() // preloaded images

aIndex=0
function loadImage(){
newImage[aIndex]=new Image() // create new image object
newImage[aIndex].onload=checkArray // check for next image
newImage[aIndex].src=image[aIndex][0] // assign image to new image object
}

function checkArray(){
aIndex++
if(aIndex!=image.length){
setTimeout("loadImage()",10)
}
}

var lastW=""
var lastH=""
var timer=""
var dir=0

function setThumbSize(){
loadImage()
for (i=0;i<=image.length-1;i++) {
document.getElementById("thumb"+i).width=startPicWidth
document.getElementById("thumb"+i).height=startPicHeight
}
}

function preInit(num){
Num=num
fullWidth=newImage[num].width // images full width
fullHeight=newImage[num].height // images full height

bigPic=document.getElementById("big_pic")
bigPic.src=newImage[num].src
bigPic.width=startPicWidth
bigPic.height=startPicHeight

getElPos(num)
bigPic.style.left=elPosX // document.getElementById("thumb"+num).offsetLeft
bigPic.style.top=elPosY // document.getElementById("thumb"+num).offsetTop

bigPic.alt=image[num][1]

bigPic.style.visibility="visible"
nowPicWidth=startPicWidth
nowPicHeight=startPicHeight
wStep=(fullWidth-startPicWidth)/stepNum
hStep=(fullHeight-startPicHeight)/stepNum

enlargePic()

}

moz=document.getElementById&&!document.all

function enlargePic(){
clearTimeout(timer)
bigPic.style.border="2px solid white"
if(!moz){
docWidth=document.body.clientWidth
}
else{
docWidth=window.innerWidth
}
thumbPosX=elPosX //document.getElementById("thumb"+Num).offsetLeft

if(thumbPosX+fullWidth>docWidth-10){
if(nowPicWidth<fullWidth){
nowPicWidth+=wStep
bigPic.width=nowPicWidth
newPos=parseInt(bigPic.style.left)-wStep
bigPic.style.left=newPos

dir=1
}
if(nowPicHeight<fullHeight){
nowPicHeight+=hStep
bigPic.height=nowPicHeight
}

}
else{
dir=0
if(nowPicWidth<fullWidth){
nowPicWidth+=wStep
bigPic.width=nowPicWidth
}

if(nowPicHeight<fullHeight){
nowPicHeight+=hStep
bigPic.height=nowPicHeight
}
}

if(document.getElementById("thumb"+Num).offsetTop+nowPicHeight>document.body.scrollTop+document.body.clientHeight){
window.scrollBy(0,hStep+1)
}

timer=setTimeout("enlargePic()",50)

if(nowPicHeight>=fullHeight){
clearTimeout(timer)
}
}

function shrinkPic(){
clearTimeout(timer)

if(dir==1){
if(nowPicWidth>startPicWidth){
nowPicWidth-=wStep
bigPic.width=nowPicWidth
newPos=parseInt(bigPic.style.left)+wStep
bigPic.style.left=newPos

dir=1
}
if(nowPicHeight>startPicHeight){
nowPicHeight-=hStep
bigPic.height=nowPicHeight
}

}
else{

if(nowPicWidth>startPicWidth){
nowPicWidth-=wStep
bigPic.width=nowPicWidth
}

if(nowPicHeight>startPicHeight){
nowPicHeight-=hStep
bigPic.height=nowPicHeight
}
}
timer=setTimeout("shrinkPic()",50)

if(nowPicWidth<=startPicWidth){
bigPic.style.visibility="hidden"
clearTimeout(timer)
}
}

function getElPos(n){
el=document.getElementById("thumb"+n)

elPosX = el.offsetLeft
elPosY = el.offsetTop
parentEl = el.offsetParent

while (parentEl != null){
elPosX += parentEl.offsetLeft
elPosY += parentEl.offsetTop
parentEl = parentEl.offsetParent
}

// add onload="setThumbSize()" to the opening BODY tag
}
// -->
