﻿/// <reference path="jquery-1.3.2-vsdoc2.js"/>

var currentlySelectedSmallImage = "tourSmall01";
function Test() {
    $("#largeImageHolder").scrollTo($("#tourLarge18"), "slow");
}


function ShowLarge(largeImage, callingImage) {
    $("#" + currentlySelectedSmallImage).attr("class", "tourSmallImage");
    $("#" + callingImage.id).attr("class", "tourSmallImageSelected");
    currentlySelectedSmallImage = callingImage.id;
    //$("#largeImageHolder").scrollTo($("#" + largeImage), "slow");
    var tImage = jQuery("#" + largeImage);
    var tHeight = 0;
    tImage.prevAll('img').each(function(){
       tHeight += jQuery(this).height();
    });
    tImage.parents('div:first').animate({ top: -tHeight }, 'slow');
}

var keyImages = ["tourSmall01", "tourSmall06", "tourSmall11", "tourSmall16"];
var currentKeyImageIndex = 0;

function ScrollUp() {
    if (currentKeyImageIndex > 0) {
        currentKeyImageIndex--;
        var tImage = jQuery("#" + keyImages[currentKeyImageIndex]).parents('div:first');
        var tHeight = 0;
        tImage.prevAll('div').each(function(){
           tHeight += jQuery(this).height();
        });
        tImage.parents('div:first').animate({ top: -tHeight }, 'slow', function() {
           if(currentKeyImageIndex == 0)
              jQuery("#moveUpHolder").fadeOut("slow");
           jQuery("#moveDownHolder").fadeIn("slow");
        });
    }
}

function ScrollDown() {
    if (currentKeyImageIndex < (keyImages.length - 1)) {
        currentKeyImageIndex++;
        var tImage = jQuery("#" + keyImages[currentKeyImageIndex]).parents('div:first');
        var tHeight = 0;
        tImage.prevAll('div').each(function(){
           tHeight += jQuery(this).height();
        });
        tImage.parents('div:first').animate({ top: -tHeight }, 'slow', function() {
            jQuery("#moveUpHolder").fadeIn("slow");
            if(currentKeyImageIndex == (keyImages.length - 1))
               jQuery("#moveDownHolder").fadeOut("slow");
        });

    }
}
