﻿/************************************** Splendid *************************************
* Created By:		Steve Doggett
* Creation Date:	27th July 2009
* Edited ----------------------------------------------------------------------------
*      By:              On:  
* Description -----------------------------------------------------------------------
*      This file handles the colour swatch rollover
*      Uses JQuery.
*      Example: 
*           14-product-detail.html
*
* Functions -------------------------------------------------------------------------
*       
* Event Handlers --------------------------------------------------------------------
*       colourSwatch_onMouseOver()      // Catches the mouse over event to hide all swatches and then display the chosen one.
*       colourSwatch_onMouseOut()       // Catches the mouse out event to hide all swatches. 
*       
**************************************************************************************/

/********************************** Global Variables *********************************/
$(document).ready(function() {
    $(".largeSwatch").hide(); 
    $(".colours li").hover(
        function() {
            colourSwatch_onMouseOver(this);
        },
        function() {
            colourSwatch_onMouseOut(this);
        }
    );
});

/************************************** Functions *************************************/


/*********************************** Event Handlers ***********************************/
/**** 
 * Catches the mouse over event to hide all swatches and then display the chosen one.
 ****/
function colourSwatch_onMouseOver(which) {
    $(".largeSwatch").hide();
    $(".largeSwatch", which).show();
}

/**** 
* Catches the mouse out event to hide all swatches.
****/
function colourSwatch_onMouseOut(which) {
    $(".largeSwatch").hide();
}
