// JavaScript Document

// CREDITS:
// Random Order Slideshow with Messages
// by Urs Dudli and Peter Gehrig 
// Copyright (c) 2002 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.fabulant.com & http://www.designerwiz.com
// info@24fun.com
// 1/8/2002
// modified MAH 2010-09-15 
// IMPORTANT: 
// If you add this script to a script-library or a script-archive 
// you have to insert a a highly visible link to http://www.fabulant.com
// right into the webpage where the script will be displayed.
 
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////
 
// Replace the URLs of the slides and the corresponding messages.
// Please note that the URL and the correponding message are separated by "|".
// Watch how the "," and the " " are set!
// You may add as many slides as you like.
// IMPORTANT: Do not use the return-key to break the lines!!!
var slideshow=new Array(
 "../slideshow/1948.jpg",
 "../slideshow/2001_0617_135039AA.JPG",
 "../slideshow/2003_1102_141549AA.JPG",
 "../slideshow/2004_0222_120659AA.JPG",
 "../slideshow/2004_0616_074831AA.JPG",
 "../slideshow/2004_0616_075113AA.JPG",
 "../slideshow/2004_0617_185152AA.JPG",
 "../slideshow/2004_0620_115441AA.JPG",
 "../slideshow/2004_0627_083611AA.JPG",
 "../slideshow/2004_0628_120710AA.JPG",
 "../slideshow/2004_0821_103124AA.JPG",
 "../slideshow/2004_0821_120252AA.JPG",
 "../slideshow/2004_1023_142459AA.JPG",
 "../slideshow/2005_0619_133150AA.JPG",
 "../slideshow/2009-10-15 09.27.30.jpg",
 "../slideshow/bhkirkmac.jpg",
 "../slideshow/blackridge.jpg",
 "../slideshow/boer300.jpg",
 "../slideshow/carolinePark1.jpg",
 "../slideshow/ctc_26.jpg",
 "../slideshow/ctc_270908_2.jpg",
 "../slideshow/ctc_270908_3.jpg",
 "../slideshow/ctc_300509_005.jpg",
 "../slideshow/ctc_300509_013.jpg",
 "../slideshow/ctc_300509_016.jpg",
 "../slideshow/ctc_300509_021.jpg",
 "../slideshow/ctc_300509_025.jpg",
 "../slideshow/cyclefest.jpg",
 "../slideshow/g_pennels_a.jpg",
 "../slideshow/g-cfest_a.jpg",
 "../slideshow/GlCfest03.JPG",
 "../slideshow/global_15127959.jpg",
 "../slideshow/Image3.jpg",
 "../slideshow/Image5.jpg",
 "../slideshow/IMG_4821.jpg",
 "../slideshow/IMG_4948.jpg",
 "../slideshow/IMG_4956.jpg",
 "../slideshow/IMG_4957.jpg",
 "../slideshow/IMG_4960.jpg",
 "../slideshow/IMG_4966.jpg",
 "../slideshow/IMG_4975.jpg",
 "../slideshow/legwork.jpg",
 "../slideshow/P1000364.jpg",
 "../slideshow/P1000520.JPG",
 "../slideshow/P1000525.JPG",
 "../slideshow/P1000621.JPG",
 "../slideshow/P1000624.JPG",
 "../slideshow/P1000625.JPG",
 "../slideshow/P1000659.JPG",
 "../slideshow/P1000674.JPG",
 "../slideshow/P1000679.JPG",
 "../slideshow/P1000822.JPG",
 "../slideshow/P1000823.JPG",
 "../slideshow/P1000827.JPG",
 "../slideshow/P1000832.JPG",
 "../slideshow/P1000836.JPG",
 "../slideshow/P1000841.JPG",
 "../slideshow/P1000842.JPG",
 "../slideshow/P1000845.JPG",
 "../slideshow/P1000846.JPG",
 "../slideshow/P1000851.JPG",
 "../slideshow/P1000857.JPG",
 "../slideshow/P1000863.JPG",
 "../slideshow/P1000864.JPG",
 "../slideshow/P1000905.JPG",
 "../slideshow/P1000910.JPG",
 "../slideshow/P1000911.JPG",
 "../slideshow/P1000914.JPG",
 "../slideshow/P1000917.JPG",
 "../slideshow/P1000918.JPG",
 "../slideshow/P1000920.JPG",
 "../slideshow/P1000922.JPG",
 "../slideshow/P1000923.JPG",
 "../slideshow/P1000927.JPG",
 "../slideshow/P1000929.JPG",
 "../slideshow/P1000930.JPG",
 "../slideshow/P1000931.JPG",
 "../slideshow/P1000933.JPG",
 "../slideshow/P1000938.JPG",
 "../slideshow/P1000953.JPG",
 "../slideshow/P1000954.JPG",
 "../slideshow/P1000959.JPG",
 "../slideshow/P1000961.JPG",
 "../slideshow/P1000962.JPG",
 "../slideshow/P1000963.JPG",
 "../slideshow/P1000964.JPG",
 "../slideshow/P1000966.JPG",
 "../slideshow/P1000967.JPG",
 "../slideshow/P1000968.JPG",
 "../slideshow/P1000973.JPG",
 "../slideshow/P1000976.JPG",
 "../slideshow/P1000977.JPG",
 "../slideshow/P1000983.JPG",
 "../slideshow/P1000986.JPG",
 "../slideshow/P1000987.JPG",
 "../slideshow/P1000990.JPG",
 "../slideshow/P1000992.JPG",
 "../slideshow/P1000993.JPG",
 "../slideshow/P1000995.JPG",
 "../slideshow/P1000996.JPG",
 "../slideshow/P1000997.JPG",
 "../slideshow/P1000998.JPG",
 "../slideshow/P1010004.JPG",
 "../slideshow/P1010006.JPG",
 "../slideshow/P1010007.JPG",
 "../slideshow/P1010009.JPG",
 "../slideshow/P1010010.JPG",
 "../slideshow/P1010012.JPG",
 "../slideshow/P1010013.JPG",
 "../slideshow/P1010015.JPG",
 "../slideshow/P1010017.JPG",
 "../slideshow/P1010018.JPG",
 "../slideshow/P1010028.JPG",
 "../slideshow/P1010034.JPG",
 "../slideshow/P1010041.JPG",
 "../slideshow/P1010046.JPG",
 "../slideshow/P1010052.JPG",
 "../slideshow/P1010060.JPG",
 "../slideshow/P1010061.JPG",
 "../slideshow/P1010063.JPG",
 "../slideshow/P1010065.JPG",
 "../slideshow/P1010072.JPG",
 "../slideshow/P1010075.JPG",
 "../slideshow/P1010080.JPG",
 "../slideshow/P1010083.JPG",
 "../slideshow/P1010084.JPG",
 "../slideshow/P1010086.JPG",
 "../slideshow/P1010089.JPG",
 "../slideshow/P1010091.JPG",
 "../slideshow/P1010092.JPG",
 "../slideshow/P1010093.JPG",
 "../slideshow/P1010103.JPG",
 "../slideshow/P1010104.JPG",
 "../slideshow/P1010105.JPG",
 "../slideshow/P1010106.JPG",
 "../slideshow/P1010107.JPG",
 "../slideshow/P1010110.JPG",
 "../slideshow/P1010115.JPG",
 "../slideshow/P1010117.JPG",
 "../slideshow/P1010124.JPG",
 "../slideshow/P1010130.JPG",
 "../slideshow/P1010131.JPG",
 "../slideshow/P1010133.JPG",
 "../slideshow/P1010148.JPG",
 "../slideshow/P1010149.JPG",
 "../slideshow/P1010152.JPG",
 "../slideshow/P1010159.JPG",
 "../slideshow/P1010170.JPG",
 "../slideshow/P1010173.JPG",
 "../slideshow/P1010175.JPG",
 "../slideshow/P1010182.JPG",
 "../slideshow/P1010185.JPG",
 "../slideshow/P2200026.jpg",
 "../slideshow/P2200027.jpg",
 "../slideshow/P6200024.JPG",
 "../slideshow/P6210044.JPG",
 "../slideshow/P8240067.JPG",
 "../slideshow/PICT0111.JPG",
 "../slideshow/Pitlochry2007.JPG",
 "../slideshow/Polmood Hut.jpg",
 "../slideshow/punc5.JPG",
 "../slideshow/punch.jpg",
 "../slideshow/quiz.jpg",
 "../slideshow/ss201105_01.jpg",
 "../slideshow/ss201105_02.jpg",
 "../slideshow/ss201105_03.jpg",
 "../slideshow/ss201105_04.JPG",
 "../slideshow/ss201105_05.JPG",
 "../slideshow/ss201105_06.JPG",
 "../slideshow/ss201105_07.JPG",
 "../slideshow/ss201105_08.JPG",
 "../slideshow/ss201105_09.JPG",
 "../slideshow/ss201105_10.JPG",
 "../slideshow/ss201105_11.JPG",
 "../slideshow/ss201105_12.JPG",
 "../slideshow/ss201105_13.JPG",
 "../slideshow/ss201105_14.JPG",
 "../slideshow/ss201105_15.JPG",
 "../slideshow/ss201105_16.JPG",
 "../slideshow/ss201105_17.JPG",
 "../slideshow/ss201105_18.JPG",
 "../slideshow/ss201105_19.JPG",
 "../slideshow/ss201105_20.JPG",
 "../slideshow/ss201105_21.JPG",
 "../slideshow/ss201105_22.JPG",
 "../slideshow/ss201105_23.JPG",
 "../slideshow/ss201105_24.JPG",
 "../slideshow/stobo.jpg",
 "../slideshow/trossachstearoom.jpg",
 "../slideshow/tton.jpg") 
 
// the width of the slides (pixels)
var imagewidth=300
 
// the height of the slides (pixels)
var imageheight=256
 
// the minimum interval between each slide (seconds)
var standstill=8
 
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////
 
// do not change the code below
var imgstop=0
var imgsleft=0
var firstslide=true
var starttime
var nowtime
var imgurl=new Array()
var imgurlandmessagearray=new Array()
var imgurlandmessage
var imgpreload=new Array()
var playertop=0
var playerleft=0
var i_imgs=0
var i_loop=0
var i_preloadloop=0
var i_transition=0
var timerrotate=false
var timercheck=false
var contentimg
var slideshowlength=slideshow.length
 
var topdivheight=imageheight+40
 
var ns6=document.getElementById&&!document.all?1:0
var standstill=standstill*1000
 
function init() {
    firstslide=true
    i_imgs=0
    i_loop=0
    i_preloadloop=randommaker(slideshowlength)
    if (timerrotate) {
        clearTimeout(timerrotate)
        clearTimeout(timercheck)
    }
    imgurl=new Array

    for (i=0;i<=slideshow.length-1;i++) {
          imgurl[i]=slideshow[i]
    }
 
 
    if (document.all) {
        imgs.innerHTML=""
	    document.all.imgs.style.posTop=imgstop
        document.all.imgs.style.posLeft=imgsleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
    if (ns6) {
        document.getElementById('imgs').innerHTML=""
        document.getElementById('imgs').style.top=imgstop
        document.getElementById('imgs').style.left=imgsleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
	if (document.layers) {
        document.topdiv.document.imgs.document.write("")
        document.topdiv.document.imgs.document.close()
	    document.topdiv.document.imgs.top=imgstop
        document.topdiv.document.imgs.left=imgsleft
        checkpreloadtime()
        preloadimage()
        checkifloaded()
    }
}
 
function checkifloaded() {   
   if (imgpreload.complete) { 
        nowtime=new Date()
        nowtime=nowtime.getTime()
        nowtime=nowtime-starttime
        var interval=standstill-nowtime
        if (interval<=0 ) {
            interval=1
        }
        if (firstslide) {
            interval=1
            firstslide=false
        }
        if (i_preloadloop==i_loop) {
            interval=1
        }
        timerrotate=setTimeout("rotateimages()", interval)
   }
   else {
        timercheck=setTimeout("checkifloaded()", 100)
   }
}
 
function preloadimage() { 
	imgpreload=new Image()
	imgpreload.src=imgurl[i_preloadloop]
}
 
function rotateimages() {
    i_loop=i_preloadloop
    i_preloadloop=randommaker()  
    checkpreloadtime()
    preloadimage()
    getcontent()
    if (document.all) {
        imgs.filters[i_transition].apply()
        imgs.innerHTML=contentimg
        imgs.filters[i_transition].play()
        i_transition++
        if (i_transition>21) {i_transition=0}
    }    
    if (ns6) {
        document.getElementById('imgs').innerHTML=contentimg
    }
    if (document.layers) {
        document.topdiv.document.imgs.document.write(contentimg)
        document.topdiv.document.imgs.document.close()
    }
    i_loop++
    checkifloaded()    
}
 
function randommaker() {		
	rand=Math.floor(slideshowlength*Math.random())
    return rand
 
}
 
function getcontent() {
    contentimg="<div text-align='center'><img src='"+imgurl[i_loop]+"' text-align='center'></div>"
}
 
if (document.all) {
    document.write('<div id="topdiv" style="position:relative;width:'+imagewidth+'px;height:'+topdivheight+'px">')
    document.write('<div id="imgs" style="position:absolute;filter: revealTrans(Transition=1, Duration=2) revealTrans(Transition=2, Duration=2) revealTrans(Transition=3, Duration=2)  revealTrans(Transition=4, Duration=2)  revealTrans(Transition=5, Duration=1)  revealTrans(Transition=6, Duration=2)  revealTrans(Transition=7, Duration=2)  revealTrans(Transition=8, Duration=1)  revealTrans(Transition=9, Duration=2)  revealTrans(Transition=10, Duration=1)  revealTrans(Transition=11, Duration=2)  revealTrans(Transition=12, Duration=2)  revealTrans(Transition=13, Duration=1)  revealTrans(Transition=14, Duration=2)  revealTrans(Transition=15, Duration=2)  revealTrans(Transition=16 Duration=1)  revealTrans(Transition=17, Duration=2)  revealTrans(Transition=18, Duration=2) revealTrans(Transition=19, Duration=1) revealTrans(Transition=20, Duration=2) revealTrans(Transition=21, Duration=2) revealTrans(Transition=22, Duration=2)"> </div>')
    document.write('</div>')     
}
 
if (ns6) {
    document.write('<div id="topdiv" style="position:relative;width:'+imagewidth+'px;height:'+topdivheight+'px">')
    document.write('<div id="imgs" style="position:absolute;"> </div>')
    document.write('</div>')     
}
 
if (document.layers) {
    document.write('<ilayer name="topdiv" width='+imagewidth+' height='+topdivheight+'>')
    document.write('<layer name="imgs"> </layer>')
    document.write('</ilayer>')     
}
 
function checkpreloadtime() {
	starttime= new Date()
	starttime=starttime.getTime()
}
 
function checktime() {
 
}
 
window.onresize=new Function("window.location.reload()");
window.onload=init
 

