if (self != top) { top.location.replace(location.href); }


function expandlinks ( ) {
        var obj = document.getElementById(arguments[0]);
        if ( obj.style.display == 'block' ) {
                obj.style.display = 'none';
        } else {
                obj.style.display = 'block';
        }
}

function slideShow ( ) {
        // Set the object to change
        this.id = arguments[0]

        // Set image name
        this.name = arguments[1]

        // Set slideShowSpeed (milliseconds)
        this.start = arguments[2]
        this.speed = arguments[3]

        // Duration of crossfade (seconds)
        this.duration = arguments[4]

        this.timeout
        this.position = arguments[5]

        this.preLoad = new Array()
        for ( i = 6; i < arguments.length; i++ ) {
                this.preLoad[i-6] = new Image ( )
                this.preLoad[i-6].src = arguments[i]
        }
}

function init ( ) {
        
        for ( i = 0; i < s.length; i++ ) {
                if (document.images[s[i].name]) s[i].timeout = runSlideShow( s[i].id, s[i].start)
        }
        document.getElementById("runner").style.left = 0;
        return true;
}

function runSlideShow ( ) {
        if ( document.all ) {
                document.images[s[arguments[0]].name].style.filter="blendTrans(duration=2)"
                document.images[s[arguments[0]].name].style.filter="blendTrans(duration=s[arguments[0]].duration)"
                document.images[s[arguments[0]].name].filters.blendTrans.Apply()      
        }
                document.images[s[arguments[0]].name].src = s[arguments[0]].preLoad[s[arguments[0]].position].src
        if ( document.all ) {
                document.images[s[arguments[0]].name].filters.blendTrans.Play ( )
        }

        if (arguments[1] == s[arguments[0]].start) { s[arguments[0]].timout = setTimeout( 'runSlideShow( ' + arguments[0] + ')', s[arguments[0]].start) }
        else { s[arguments[0]].timout = setTimeout( 'runSlideShow( ' + arguments[0] + ')', s[arguments[0]].speed) }

        if (s[arguments[0]].position < s[arguments[0]].preLoad.length-1) { s[arguments[0]].position++ }
        else { s[arguments[0]].position = 0; }

}

function findPos(obj) {
        var curleft = curtop = 0;
        if (obj.offsetParent) {
                do {
                        curleft += obj.offsetLeft;
                        curtop += obj.offsetTop;
                } while (obj = obj.offsetParent);
        }
        return [curleft,curtop];
}

function init_menu ( ) {
        document.getElementById("runner").style.left = 0;
        return true;
}

// function to select which menu to display
function set_menu (x) {
        // set scroll speed
        var speed = 40;
        // set time delay
        var time = 1;
        
        // work out step direction
        if ( x < parseInt(document.getElementById("runner").style.left)) { step = -speed; } // step left
        else if (x > parseInt(document.getElementById("runner").style.left)) { step = speed; } // step right
        else { step = 0; } // no step required
        
        // set new position of runner div if step != 0
        if (step != 0) { document.getElementById("runner").style.left = (parseInt(document.getElementById("runner").style.left) + step) + "px"; }
        
        // call next step function
        if (parseInt(document.getElementById("runner").style.left) != x) { setTimeout("set_menu(" + x + ")", time); }
}

window.onload=init;
