﻿        // Jeff
        // www.huntingground.freeserve.co.uk
        // http://www.btinternet.com/~st_rise/main/mainfram.htm
        // JavaScripts
        // Horizontal Image Scroller 1
        
        imageSize=100 // % size the image is shown at, if set to zero the fixed width and heights are used
        fixedWidth=100 // set a fixed width
        fixedHeight=100 // set a fixed height
        spacerWidth=0 // space between images

        autoWidth=0 // 0 = no, 1 = yes, sets the width to the widest image size

        defaultSpeed=2 
        maxSpeed=50

        popupLeft= 100 // pixels
        popupTop= 100 // pixels

        totalWidth=0
        displayWidth=0
        displayHeight=0
        speed=defaultSpeed

        preload=[]

        for(var i=0;i<is1hArr.length;i++){
        preload[i]=[]

        for(var j=0;j<is1hArr[i].length;j++){
        preload[i][j]=new Image()
        preload[i][j].src=is1hArr[i][j]
        }

        }

        function initHS1(){
        imgBox=document.getElementById("image_box")
        imgNum=is1hArr.length

        if(document.getElementById&&document.all&&document.compatMode!="CSS1Compat"){
        ieBorder=parseInt(document.getElementById("inner_box").style.borderWidth)*2
        }
        else{
        ieBorder=0
        }

        for(var i=0;i<imgNum;i++){ // set image size

        newImg=document.createElement("IMG")
        newImg.setAttribute("src",is1hArr[i][0])
        newImg.setAttribute("id","pic"+i)
        newImg.setAttribute("height","500")
        newImg.setAttribute("width","500")
        newImg.setAttribute("oversrc",is1hArr[i][2])
        newImg.setAttribute("outsrc",is1hArr[i][0])
        newImg.onmouseover = new Function("SimpleSwap(this,'oversrc');"); 
        newImg.onmouseout = new Function("SimpleSwap(this,'outsrc');"); 
        newImg.i=i
        newImg.onclick=function(){getBigPic(this.i)}

        //newImg.onmouseover=function(){toggleOpac(this)}
        //newImg.onmouseout=function(){toggleOpac(this)}

        if(imageSize!=0){ // use percentage size
        newImg.style.width=preload[i][0].width/100*imageSize+"px"
        newImg.style.height=preload[i][0].height/100*imageSize+"px"
        }
        else{ // use fixed size
        newImg.style.width=fixedWidth+"px"
        newImg.style.height=fixedHeight+"px"
        }
        
        newImg.style.width = "205px";
        newImg.style.height = "100px";   

        imgBox.appendChild(newImg)

        }

        for(var i=0;i<imgNum;i++){
        totalWidth+=(document.getElementById("pic"+i).offsetWidth)
        document.getElementById("pic"+i).style.marginRight=spacerWidth+"px"

        if(autoWidth==1){
        if(document.getElementById("pic"+i).offsetWidth>displayWidth){
        displayWidth=document.getElementById("pic"+i).offsetWidth
        }

        }
        else{
        displayWidth=parseInt(document.getElementById("inner_box").style.width)
        }


        if(document.getElementById("pic"+i).offsetHeight>displayHeight){
        displayHeight=document.getElementById("pic"+i).offsetHeight
        }

        }

        for(var i=0;i<imgNum;i++){ // vertically center images
        document.getElementById("pic"+i).style.marginBottom=(displayHeight-document.getElementById("pic"+i).height)/2+"px"
        }

        totalWidth=totalWidth+(imgNum*spacerWidth)

        imgHolderWidth=displayWidth+ieBorder
        document.getElementById("outer_box").style.width=imgHolderWidth+"px"
        document.getElementById("inner_box").style.width=imgHolderWidth+"px"
        imgBox.style.width=totalWidth+"px"

        imgHolderHeight=displayHeight+ieBorder
        document.getElementById("inner_box").style.height=imgHolderHeight+"px" 
        document.getElementById("inner_box").style.clip="rect(0,"+(imgHolderWidth+"px")+","+(imgHolderHeight+"px")+",0)"

        }

        leftTimer=""
        function scrollHS1(n){

        clearTimeout(leftTimer)
        imgBoxPos=parseInt(imgBox.style.left)
        if(n==1){
        imgBoxPos-=speed
        }
        else{
        imgBoxPos+=speed
        }

        imgBox.style.left=imgBoxPos+"px"
        leftTimer=setTimeout("scrollHS1("+n+")",50)

        if(n==1&&imgBoxPos< -(totalWidth-imgHolderWidth)+(spacerWidth-ieBorder)){
        imgBox.style.left=-(totalWidth-imgHolderWidth)+spacerWidth-ieBorder+"px"
        clearTimeout(leftTimer)
        }

        if(n==0&&imgBoxPos> 0-speed){
        imgBox.style.left=0
        clearTimeout(leftTimer)
        }

        }

        function fast(){
        speed=maxSpeed
        }

        function slow(){
        speed=defaultSpeed
        }

        function pause(){
        clearTimeout(leftTimer)
        }


        picWin=null

        function getBigPic(p){
        if(is1hArr[p]&&is1hArr[p]!=""){

        bigImg=new Image()
        bigImg.src=is1hArr[p][1]

        data="\n<center>\n<img src='"+bigImg.src+"'>\n</center>\n"

        if(picWin){picWin.close()} // if window exists close it

        winProps = "left= "+popupLeft+", top = "+popupTop+", width="+(bigImg.width)+", height="+(bigImg.height)+", scrollbars=no, resizable=yes, status=no" 
        picWin=window.open("","win1",winProps)
        picWin.document.write("<HTML><HEAD><TITLE>Entertainment</title>")
        picWin.document.write("<\/HEAD>")
        picWin.document.write("<BODY style='background-color:transparent;margin-top:0px;margin-left:0px'>")
        picWin.document.write("<div id=\"display\">"+data+"<\/div>")
        picWin.document.write("<\/BODY><\/HTML>")
        picWin.document.close()
        }
        }

        maxOpac=70
        minOpac=100

        function toggleOpac(obj){

        if(obj.filters){

        if(obj.filters.alpha.Opacity==minOpac){
        obj.filters.alpha.Opacity=maxOpac}
        else{obj.filters.alpha.Opacity=minOpac}

        }
        else{

        if(obj.style.opacity == maxOpac/100){
        obj.style.opacity = minOpac/100}
        else{obj.style.opacity = maxOpac/100}

        }

        }
        
        function SimpleSwap(el,which){
        el.src=el.getAttribute(which||"origsrc");
        }
