// --------------------------------------------------------------------------------
// Sizes gallery
// --------------------------------------------------------------------------------
function SizesGallery() {
    var mainInstance = this;
    $(".SizePanelContainer .SizePanelHasStock_True").each(function() {
        //$(this).click(function() { mainInstance.navigateURL($(this).attr("id")); });
        $(this).click(function() { mainInstance.navigateURL($(this)); });
});
}

SizesGallery.prototype.navigateURL = function(obj) {
    $(".SizePanelContainer .SizePanelHasStock_True").each(function() {
        $(this).css("background-color", "#ffffff");
        $(this).css("color", "#000000");
    });

    obj.css("background-color", "#556677");
    obj.css("color", "#ffffff");

    $("#itemToAddInfo").html(obj.attr("feedbacktext"));
    $("#addToCartCont").css("visibility", "visible");
    $("#addToCartCont").attr("sizeindex", obj.attr("sizeindex"));

    //    var url = String(document.location).toLowerCase();

    //    if (url.substring(url.length - 5) != '.aspx')
    //        url = url + 'Default.aspx';

    //    $.ajax({
    //        type: "POST",
    //        url: url,
    //        contentType: "application/json",
    //        cache: false,
    //        data: "{ CurrentURL: '" + document.location + "', BlockId: '" + id + "' }",
    //        dataType: "json",
    //        beforeSend: function(xhr) {
    //            xhr.setRequestHeader("DNN-Service", "true");
    //            xhr.setRequestHeader("DNN-ServiceMethod", "DetermineURL");
    //        },
    //        success: function(msg) {
    //            $("#itemToAddInfo").html(FeedBackText);
    //            $("#addToCartCont").css("visibility", "visible");
    //        },
    //        error: function(x, e) {
    //            if (x.status == 0) {
    //                alert('You are offline!!\n Please Check Your Network.');
    //            } else if (x.status == 404) {
    //                alert('Requested URL not found.');
    //            } else if (x.status == 500) {
    //                alert('Internal Server Error.');
    //            } else if (e == 'parsererror') {
    //                alert('Parsing JSON Request failed.');
    //            } else if (e == 'timeout') {
    //                alert('Request Time out.');
    //            } else {
    //                alert('Unknow Error.\n' + x.responseText);
    //            }
    //        }
    //    });
}




