
Product.prototype.showImage = Product_showImage;
Product.prototype.setSelectedColor = Product_setSelectedColor;

Product.prototype.addToCart = Product_addToCart;
Product.prototype.addToWishlist = Product_addToWishlist;

Product.prototype.emailAFriend = Product_emailAFriend;
Product.prototype.promoDetails = Product_promoDetails;
Product.prototype.showAvailability = Product_showAvailability;
Product.prototype.showEnhanced = Product_showEnhanced;
Product.prototype.showProductDetails = Product_showProductDetails;
Product.prototype.showSizeChart = Product_showSizeChart;
Product.prototype.showShipChart = Product_showShipChart;

Product.prototype.submitForm = Product_submitForm;

function Product()
{
    this.sliceHandler = new SliceHandler();
}

function Product_setSelectedColor(id)
{
    this.sliceHandler.setSelectedSlice(id);
}

function Product_showImage(name)
{
    hideElement("image_main");
    hideElement("image_alt1");
    hideElement("image_alt2");
    hideElement("image_alt3");
    showElement("image_" + name);
}

function Product_addToCart()
{
    if(this.sliceHandler.isValid())
    {
        this.submitForm();
    }
}

function Product_addToWishlist()
{
    if(this.sliceHandler.isValid())
    {
        var el = document.getElementById("wlName");
        el.value = "default";
        this.submitForm();
    }
}

function Product_emailAFriend(url)
{
    window.open(url, "email_a_friend", "width=480,height=578,top=0,left=0,resizable=no,scrollbars=no");
}

function Product_promoDetails(url)
{
    window.open(url, "details", "width=460,height=560,top=0,left=0,resizable=no,scrollbars=no");
}

function Product_showAvailability(url)
{
    window.open(url, "availability", "width=500,height=400,top=0,left=0,resizable=yes,scrollbars=yes");
}

function Product_showEnhanced()
{
    this.sliceHandler.showEnhanced();
}

function Product_showProductDetails(url)
{
    window.open(url, "details_view", "width=560,height=585,top=0,left=0,resizable=yes,scrollbars=yes");
}

function Product_showSizeChart(url)
{
    window.open(url, "size_chart", "width=880,height=450,resizable=yes,scrollbars=yes");
}

function Product_showShipChart(url)
{
    window.open(url, "ship_chart", "width=550,height=450,resizable=yes,scrollbars=yes");
}

function Product_submitForm()
{
    var el = document.getElementById("productForm");
    el.submit();
}
