var products = new Products();

Product.prototype = {
    FindByVariant: function(color)
    {
        for (i = 0; i < this.Variations.length; i++)
            if (color == this.Variations[i].Attributes["Color"])
                return this.Variations[i];
    }
}
   
function DisplayVariant(productId, color)
{
    var selectedVariant = products.Find(productId).FindByVariant(color);
    $("tr.Prod" + productId).find("span.color").html(selectedVariant.Attributes["Color"]);
    $("tr.Prod" + productId).find("span.ProductPrice").html(selectedVariant.Price);
    $("tr.Prod" + productId).find("a.ViewDetailsLink").attr("href", selectedVariant.ViewDetailsLink);
    $("tr.Prod" + productId).find("a.AddToCartLink").attr("href", selectedVariant.AddToCartLink);
    $("tr.Prod" + productId).find("a.ProductName").attr("href", selectedVariant.ViewDetailsLink);
	$("tr.Prod" + productId).find("a.AddToCartLink").attr("style", selectedVariant.VisibleStatus);    

    $("tr.Prod" + productId).find(".SkuImage img").hide();
    $("tr.Prod" + productId).find(".SkuImage img").attr("src", selectedVariant.ImageUrl);
    $("tr.Prod" + productId).find(".SkuImage img").fadeIn();
    $("tr.Prod" + productId).find(".SkuImage").attr("href", selectedVariant.ViewDetailsLink);
    
    $("tr.Prod" + productId).find(".StockMessage span").parent().html(selectedVariant.StockMessage);
    
    InitClueTip();
}        