﻿// JScript File
function addFrameToCart(productID, variantID, specialFhtBlocked){
    
    // specials block
    if (specialFhtBlocked == true)
    {
        alert("The frame you have selected cannot be\nadded to your cart for a free home trial.");
        return;
    }
    
    // if it is a frame order go to the options otherwise go directly to the cart
    var isFrameOrder = document.getElementById("isFrameOrder").value
    if (isFrameOrder == "true")
    {
        //turn off Frame Catalogue div
        var obj = document.getElementById('frameCatalog');
        obj.style.display='none';
        AjaxQueue.push(jsWebRoot + 'ajax/addFrameToCart.aspx?p=' + productID +'&v=' + variantID, {onSucess: showMinicartSuccess, onfailure: showMinicartFailure}, "frameOptions"); 
        //goAJAX(jsWebRoot + 'ajax/addFrameToCart.aspx?p=' + productID +'&v=' + variantID, 'frameOptions', 'FAILED!');
        
        setTimeout('showMiniCart()',1000);
       
        //turn on Frame Options div
        obj = document.getElementById('frameOptions');
        obj.style.display='block';
    }
    else
    {
       AjaxQueue.push(jsWebRoot + 'ajax/addFrameToCart.aspx?p=' + productID +'&v=' + variantID, {onSucess: showMinicartSuccess, onfailure: showMinicartFailure}); 
       document.location.href = jsWebRoot + "checkout.aspx";
    }
}
function showMiniCart()
{
    //goAJAX(jsWebRoot + 'ajax/shoppingCartMargin.aspx', 'content_lhs_col', 'FAILED!');
    AjaxQueue.push(jsWebRoot + 'ajax/shoppingCartMargin.aspx',{onSucess: showMinicartSuccess, onfailure: showMinicartFailure}, "miniShopCart"); 
}

function showMinicartSuccess()
{

}

function showMinicartFailure()
{

}