
// -----
// Used for drop down window.
// -----

sfHover = function() {
var sfEls = document.getElementById("nav2")
	.getElementsByTagName("UL")[0]
	.getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// -----

// -----
// Used for the photo gallery.
// -----

var pos = 0;
var time;

function movePhotosLeft(){

	if(pos < 0){
		obj = document.getElementById("wrap");
		pos = pos + 10;
		obj.style.left = pos + "px";
	}
	time = setTimeout('movePhotosLeft()', 60);
}

function movePhotosRight(){

	if(pos > (106 * ((document.getElementById("wrap").getElementsByTagName("img").length - 3))*-1)){
		obj = document.getElementById("wrap");
		pos = pos - 10;
		obj.style.left = pos + "px";
	}

	time = setTimeout('movePhotosRight()', 60);
}

function stopPhotoMovement(){

	if (time) clearTimeout(time);
}

// -----

// -----
// Used to view photo.
// -----

function vp_Previous() {
    // get the current marker position.
    position = document.getElementById("vp_id").value;



    // Check if there are other photos.
    if (position > 0) {

        // hide the current displayed image.
        img_1 = document.getElementById("vp_img_" + position);
        msg_1 = document.getElementById("vp_msg_" + position);
        img_1.style.display = "none";
        msg_1.style.display = "none";

        // move marker position backwards.
        position = position - 1;

        // hide the current displayed image.
        img_2 = document.getElementById("vp_img_" + position);
        msg_2 = document.getElementById("vp_msg_" + position);
        img_2.style.display = "block";
        msg_2.style.display = "block";

        // Save the position in the hidden field.
        document.getElementById("vp_id").value = position;
    }
}

function vp_Next() {

    // get the current marker position.
    position = document.getElementById("vp_id").value;

    // get the current marker position.
    max = document.getElementById("vp_max").value;

    // Check if there are other photos.
    if (position < (max-1)) {

        // hide the current displayed image.
        img_1 = document.getElementById("vp_img_" + position);
        msg_1 = document.getElementById("vp_msg_" + position);
        img_1.style.display = "none";
        msg_1.style.display = "none";

        // move marker position forward.
        position++;

        // hide the current displayed image.
        img_2 = document.getElementById("vp_img_" + position);
        msg_2 = document.getElementById("vp_msg_" + position);
        img_2.style.display = "block";
        msg_2.style.display = "block";

        // Save the position in the hidden field.
        document.getElementById("vp_id").value = position;
    }
}

// -----


