if (document.images) {
img1 = new Image();
img1.src = "images/dot_on.gif";
img2 = new Image();
img2.src = "images/loading.gif";
}

function linkOn(num)
{
document.images['link' + (num)].src = "images/link"+(num)+"a.gif"
}

function linkOff(num)
{
document.images['link' + (num)].src = "images/link"+(num)+".gif"
}

function dotOn(num)
{
document.images['dot' + (num)].src = "images/dot_on.gif"
}

function dotOff()
{
for (i=1; i<30; i++) {
document.images['dot' + (i)].src="images/dot.gif"
}
document.images['dot' + (cnt)].src="images/dot2.gif"

}

var cnt = 1;

function switchPic(num) {
document.images.pic.src="images/loading.gif";
for (i=1; i<30; i++) {
document.images['dot' + (i)].src="images/dot.gif"
}

cnt=num;

document.images['dot' + (num)].src="images/dot2.gif"

document.images.pic.src="images/gallery" + (num) + ".jpg"
}

function nextLink() {
document.images.pic.src="images/loading.gif";
cnt=((cnt)+1);

if ((cnt)>29)
{
cnt=29;
self.location="contact.html";
}

for (i=1; i<30; i++) {
document.images['dot' + (i)].src="images/dot.gif"
}
document.images['dot' + (cnt)].src="images/dot2.gif"
document.images.pic.src="images/gallery" + (cnt) + ".jpg"
}

function lastLink() {
document.images.pic.src="images/loading.gif";
cnt = ((cnt)-1);
if ((cnt)<1)
{
cnt=1;
}
for (i=1; i<30; i++) {
document.images['dot' + (i)].src="images/dot.gif"
}
document.images['dot' + (cnt)].src="images/dot2.gif"

document.images.pic.src="images/gallery" + (cnt) + ".jpg"
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it invisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
}


function slideshow() {
setTimeout( "opacity('frontpic1', 100, 0, 500);", 2000);
setTimeout( "opacity('frontpic2', 0, 100, 500);", 2000);
setTimeout( "opacity('frontpic2', 100, 0, 500);", 6000);
setTimeout( "opacity('frontpic3', 0, 100, 500);", 6000);
setTimeout( "opacity('frontpic3', 100, 0, 500);", 10000);
setTimeout( "opacity('frontpic4', 0, 100, 500);", 10000);
setTimeout( "opacity('frontpic4', 100, 0, 500);", 14000);
setTimeout( "opacity('frontpic5', 0, 100, 500);", 14000);
setTimeout( "opacity('frontpic5', 100, 0, 500);", 18000);
setTimeout( "opacity('frontpic6', 0, 100, 500);", 18000);
setTimeout( "opacity('frontpic6', 100, 0, 500);", 22000);
setTimeout( "opacity('frontpic1', 0, 100, 500);", 22000);
setTimeout( "repeatSlides()", 26000);
}

function repeatSlides() {
clearTimeout();
slideshow();
}

