﻿/* Availability Messaging Functions */
function skuSelector1_SelectedIndexChangedHandler(e) {
    var availMsg = (e.get_availabilityMessage() != null && e.get_availabilityMessage() != "") ? e.get_availabilityMessage() : "&nbsp;";
    $get("divAvailability").innerHTML = availMsg;

    var qtyMsg = "&nbsp;";

    var btnAdd = $get("addToCartDiv");

    if (e.get_quantityAvailable() != null && e.get_quantityAvailable() != "") {
        if (e.get_quantityAvailable() < 25) {
            qtyMsg = "There are " + e.get_quantityAvailable() + " in stock";
        } else {
            qtyMsg = "Plenty in stock";
        }

        //if  out of stock
        if (e.get_quantityAvailable() == 0) {
            //hide add to cart button
            btnAdd.style.visibility = "visible";
        } else {
            //show add to cart button
            btnAdd.style.visibility = "visible";
        }
    } else {
        //hide add to cart button
    btnAdd.style.visibility = "visible";
    }
    $get("spanNumAvail").innerHTML = qtyMsg;

}

/* Alternate Functions */
//this function will cause the main image to swap when an alternate is rolled over.
//you must add the following to the swatch control declaration:
//  OnClientThumbNailMouseOver="SwatchOver" 
function AlternateOver(imageName) {
    thismainImage.attr("src",imageName);
}

//this function will cause the main image to swap when an alternate is rolled off.
//you must add the following to the swatch control declaration:
//  OnClientThumbnailMouseOut="SwatchOut"
function AlternateOut() {
    thismainImage.attr("src",mainImageSrc);
}

//this function will cause the main image to swap when an alternate is clicked.
//you must add the following to the swatch control declaration:
//  OnClientSelectedIndexChanged="SwatchClick"
function AlternateClick(imageName) {
    thismainImage.attr("src",imageName);
}

function dislpayNewWindow2(toggle) {
    document.getElementById("jumbo_div").style.display = toggle;
    return false;
}