﻿//#region File Header Comments
/* Name: site.js
 Directory: \Scripts\
 Type: js
 Author: James Morris
 Description: Javascript file used in the application.
 Creation Date: 12/01/2011
 
 Change History
 --------------
 
 Date           By                          Version         Ref             Description
 --------------------------------------------------------------------------------------
 
*/
//#endregion

function AdjustProductPopup() {
    // Adjust the 'product popup control' dimensions to better fit the user's screen.
    var width = _aspxGetDocumentWidth() * 0.75;
    //var height = _aspxGetDocumentHeight();  //* 0.35;
    //popupProductImage.SetSize(width, height);
    popupProductImage.SetWidth(width);
}

function SwapProductImage(img, alt, colourInfo, colour) 
{
    // Swap the 'product image' to the one passed in.
    document.getElementById("dximgProductImage").src = img;
    document.getElementById("dximgProductImage").alt = alt;
    document.getElementById("dximgProductImage").title = alt;
    dxlblColourInfo.SetText(colourInfo);
    dxlblColour.SetText(colour);
    $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom(); 
}

function ValidateTelephoneNumber(e) 
{
    // Validate the number passed in is a number.    
    var value = e.value;
    if (value == null || value == "")
        return;

    var number = value.replace(" ", "");

    if (isNaN(number))
        return false;

    return true;
}
