﻿// JScript File

function ShowCartItems(invId,btnAddToCart,lblAddedToCart,OtherAddToCartToModify,OtherAddedToCartLabel,quantitySelect)
{
    var quantity
    if (quantitySelect != "")
    {
        var ddl = document.getElementById(quantitySelect);
        quantity = ddl.options[ddl.selectedIndex].text;
    }
    
    var res=PurpleParrot.Storefront.WebUI.Search_ProductCatalog.AddItemToCart(invId,quantity);
    //window.open("../Cart/CartItems.aspx","","height=200,width=300,left=300,top=300,directories=no,location=no,menubar=no,toolbar=no,resizable=no,status=no,scrollbars=yes");
    document.getElementById(btnAddToCart).style.display="none";
    document.getElementById(lblAddedToCart).style.display="block";
    document.getElementById(lblAddedToCart).innerHTML="Added to Cart";
    document.getElementById("ctl00_storeShoppingCart_lblCartCountSt").innerHTML = "(" + res.value + ")";

    if (OtherAddToCartToModify != "")
        {
            var atc = document.getElementById(OtherAddToCartToModify);
            if (atc != null)
                atc.style.display="none";
        }
    
     if (OtherAddedToCartLabel != "")
        {
            var atcl = document.getElementById(OtherAddedToCartLabel);
            if (atcl != null)
                {
                    atcl.style.display="block";
                    atcl.innerHTML="Added to Cart";
                }
                
        }
        
    return false;
}


