﻿// JScript File

var prevThumbElemId = 'iden01';
var prevThumbImgSrc = 'Work/Images/Identity/iden01_AWAY.gif'; 

function thumbMouseOver( imgId, path )
{
    var imgElem = document.getElementById(imgId); 
    // Using elem color attribute to identify 
    // if the thumbnail is current selected ( = 'red') 
    // or unselected ( != 'red' )
    if ( imgElem.style.color != 'red' )  
    {
       imgElem.src= 'Work/Images/' + path + '/' + imgId + '_HOVER.gif';; 
    }    
}
   
function thumbMouseOut( imgId, path )
{
    var imgElem = document.getElementById(imgId); 
    // Using elem color attribute to identify 
    // if the thumbnail is current selected ( = 'red') 
    // or unselected ( != 'red' )    
    if ( imgElem.style.color != 'red' )
    {
       imgElem.src= 'Work/Images/' + path + '/' + imgId + '_AWAY.gif';
    }
}

function thumbClicked( imgId, path ) 
{
    // Using elem color attribute to identify 
    // if the thumbnail is current selected ( = 'red') 
    // or unselected ( != 'red' )
    if ( document.getElementById(imgId).style.color == 'red' )
    {
        return;
    }
    
    var slideshowBehavior;

    slideshowBehavior = $find('workSlideShowBehavior');
    // Update the slide show service method
    if ( slideshowBehavior ) 
    {
        var serviceMethod = 'Get_' + imgId;
        slideshowBehavior.set_slideShowServiceMethod( serviceMethod );
        slideshowBehavior._slideShowInit();

        var prevThumbElem = document.getElementById(prevThumbElemId); 
        // Restore the previous img src
        prevThumbElem.src = prevThumbImgSrc;
        prevThumbElem.style.color = '';
            
        var currThumbElem = document.getElementById(imgId);
        // Save the current selected img id and src for next time restore
        prevThumbElemId = imgId;
        prevThumbImgSrc = 'Work/Images/' + path + '/' + imgId + '_AWAY.gif';

        // Update the current selected img sre and color
        currThumbElem.style.color = 'red';
        currThumbElem.src = 'Work/Images/' + path + '/' + imgId + '_HOVER.gif';

        var prevSlide = document.getElementById("workSlidePrevCtrl");
        var nextSlide = document.getElementById("workSlideNextCtrl");

        if ( serviceMethod == 'Get_iden03'  ||
             serviceMethod == 'Get_iden05'  ||
             serviceMethod == 'Get_iden06'  ||
             serviceMethod == 'Get_print04' ||
             serviceMethod == 'Get_print05' ||
             serviceMethod == 'Get_web03'   ||
             serviceMethod == 'Get_web06'  )
        {
             prevSlide.style.visibility = 'hidden';
             nextSlide.style.visibility = 'hidden';
        }
        else
        {
            prevSlide.style.visibility = 'visible';
            nextSlide.style.visibility = 'visible';
        }
    }
}
