/* Minification failed. Returning unminified contents.
(1,10): run-time error CSS1031: Expected selector, found 'AddToWishList('
(1,10): run-time error CSS1025: Expected comma or open brace, found 'AddToWishList('
(26,10): run-time error CSS1031: Expected selector, found 'priceinquery('
(26,10): run-time error CSS1025: Expected comma or open brace, found 'priceinquery('
(48,12): run-time error CSS1031: Expected selector, found '='
(48,12): run-time error CSS1025: Expected comma or open brace, found '='
(49,10): run-time error CSS1031: Expected selector, found 'CHmessagebox('
(49,10): run-time error CSS1025: Expected comma or open brace, found 'CHmessagebox('
(97,10): run-time error CSS1031: Expected selector, found 'CHmessageClose('
(97,10): run-time error CSS1025: Expected comma or open brace, found 'CHmessageClose('
(118,10): run-time error CSS1031: Expected selector, found 'addToCart('
(118,10): run-time error CSS1025: Expected comma or open brace, found 'addToCart('
(166,10): run-time error CSS1031: Expected selector, found 'removeFromCart('
(166,10): run-time error CSS1025: Expected comma or open brace, found 'removeFromCart('
(200,10): run-time error CSS1031: Expected selector, found 'AddToCompressionList('
(200,10): run-time error CSS1025: Expected comma or open brace, found 'AddToCompressionList('
(226,10): run-time error CSS1031: Expected selector, found 'LoadSendMethods('
(226,10): run-time error CSS1025: Expected comma or open brace, found 'LoadSendMethods('
(254,10): run-time error CSS1031: Expected selector, found 'LoadSendMethodPrice('
(254,10): run-time error CSS1025: Expected comma or open brace, found 'LoadSendMethodPrice('
(276,10): run-time error CSS1031: Expected selector, found 'LoadPaymentTypePrice('
(276,10): run-time error CSS1025: Expected comma or open brace, found 'LoadPaymentTypePrice('
(291,10): run-time error CSS1031: Expected selector, found 'Discount('
(291,10): run-time error CSS1025: Expected comma or open brace, found 'Discount('
(327,10): run-time error CSS1031: Expected selector, found 'deleteAddress('
(327,10): run-time error CSS1025: Expected comma or open brace, found 'deleteAddress('
(345,10): run-time error CSS1031: Expected selector, found 'editAddress('
(345,10): run-time error CSS1025: Expected comma or open brace, found 'editAddress('
(368,10): run-time error CSS1031: Expected selector, found 'loginbtn('
(368,10): run-time error CSS1025: Expected comma or open brace, found 'loginbtn('
(382,1): run-time error CSS1019: Unexpected token, found '$'
(382,2): run-time error CSS1019: Unexpected token, found '('
(382,3): run-time error CSS1019: Unexpected token, found '"#filter_name"'
(382,17): run-time error CSS1019: Unexpected token, found ')'
(382,19): run-time error CSS1030: Expected identifier, found 'keyup('
(382,19): run-time error CSS1019: Unexpected token, found 'keyup('
(382,34): run-time error CSS1031: Expected selector, found '('
(382,34): run-time error CSS1025: Expected comma or open brace, found '('
(421,2): run-time error CSS1019: Unexpected token, found ')'
(423,1): run-time error CSS1019: Unexpected token, found 'jQuery('
(423,8): run-time error CSS1019: Unexpected token, found '"document"'
(423,18): run-time error CSS1019: Unexpected token, found ')'
(423,20): run-time error CSS1030: Expected identifier, found 'ready('
(423,20): run-time error CSS1019: Unexpected token, found 'ready('
(423,35): run-time error CSS1031: Expected selector, found '('
(423,35): run-time error CSS1025: Expected comma or open brace, found '('
(439,2): run-time error CSS1019: Unexpected token, found ')'
(441,10): run-time error CSS1031: Expected selector, found 'ProductQuickview('
(441,10): run-time error CSS1025: Expected comma or open brace, found 'ProductQuickview('
(468,10): run-time error CSS1031: Expected selector, found 'showMyadditional('
(468,10): run-time error CSS1025: Expected comma or open brace, found 'showMyadditional('
(473,10): run-time error CSS1031: Expected selector, found 'extrasaleLoad('
(473,10): run-time error CSS1025: Expected comma or open brace, found 'extrasaleLoad('
(489,10): run-time error CSS1031: Expected selector, found 'extrasaleselect('
(489,10): run-time error CSS1025: Expected comma or open brace, found 'extrasaleselect('
(511,10): run-time error CSS1031: Expected selector, found 'extraslidernext('
(511,10): run-time error CSS1025: Expected comma or open brace, found 'extraslidernext('
(527,10): run-time error CSS1031: Expected selector, found 'extrasliderprev('
(527,10): run-time error CSS1025: Expected comma or open brace, found 'extrasliderprev('
 */
function AddToWishList(id) {
    $.ajax({
        url: '/Customer/AddWishList',
        data: { id: id },
        type: 'Get',
    }).done(function (data) {
        if (data.status == "loginerror") {
            CHmessagebox(data.message, 2);
        }
        else if (data.status != "error") {
            $('.wishlistcount').html(data.wishcount);
            if (data.status == "add") {
                $(".button-addtowishlist-" + id).addClass("back-red")
            }
            else if (data.status == "remove") {
                $(".button-addtowishlist-" + id).removeClass("back-red")
            }

        }
        else {
            CHmessagebox(data.message);
        }
    })
}

function priceinquery(id) {
    $.ajax(
        {
            url: '/Catalog/ProductPriceInquery',
            data: { id: id },
            type: 'Get',
            success: function (data) {
                if (data == "loginerror")
                {
                    CHmessagebox("Please login first",2);
                }
                else
                {
                    CHmessagebox(data);
                }
                
            }

        });

}

CHfunction = undefined;
function CHmessagebox(message, messagetype, outputfunction) {
    if (messagetype == undefined) {
        messagetype = 1;
    }
    CHmessageClose();
    CHfunction = outputfunction;

    var ch_messa = '<div id="MyDialogModel" class="CH-message">' +
                   '<div id="MyDialogModelBody" class="CH-message-body">' +
                   '<h4>' + message + '</h4>';
    if (messagetype == 3) {
        ch_messa = ch_messa + '<div class="row">' +
                                        '<div class="col col-xs-6"><button class="btn btn-primary btn-lg" onclick="CHmessageClose(\'YES\',this);" style="width:100%;">' + "Yes" + "</button></div>" +
                                        '<div class="col col-xs-6"><button class="btn btn-danger btn-lg" onclick="CHmessageClose(\'NO\');" style="width:100%;">' + "No" + "</button></div>" +
                                '</div>';
    }
    else if (messagetype == 2) {
        ch_messa = ch_messa + '<div id="loginformdiv" class="row no-margin">' +
                                 '<button class="btn btn-default m-progress no-background" ></button>' +
                                '</div>';

        ;
    }
    else {
        ch_messa = ch_messa + '<button class="btn btn-primary btn-lg" onclick="CHmessageClose();">' + "OK" + "</button>";
    }
    ch_messa = ch_messa +
                   '</div>' +
                   '<div class="CH-message-background" onclick="CHmessageClose();"></div>' +
                   '</div>';


    $('body').append(ch_messa);

    if (messagetype == 2)
    {
        $.ajax({
            url: '/Customer/SmallLogin',
            data: { location: window.location.href },
            type: 'Get',
            success: (function (data) {

                $('#loginformdiv').html(data);
              
            })
        });
    }
}
function CHmessageClose(dresualt, sender) {
    if (dresualt == undefined) {
        dresualt == "OK";
    }

    if (dresualt == "YES" && CHfunction != undefined) {
        if (sender != undefined) {
            $(sender).addClass("m-progress");
        }

        CHfunction();

        if (sender != undefined) {
            $(sender).removeClass("m-progress");
        }
    }
    CHfunction = undefined;

    $('#MyDialogModel').remove();
}

function addToCart(id, sender, Procount, refresh) {

    if (sender != undefined) {
        $(sender).addClass("m-progress");
    }

    if (Procount == undefined) {
        Procount = 0;
    }
    if (refresh == undefined) {
        refresh = 0;
    }
    Productcount = 0;
    if (Procount == 2) {
        Productcount = document.getElementById("Buycount" + id).value;
    }
    $.ajax(
       {
           url: '/Customer/addtoCart',
           data: { id, count: Productcount },
                   type: 'Get',
           success: function (data) {
               if (refresh == 1) {
                   location.reload();
               }
               else {
                   CHmessagebox(data);


                   $.ajax(
                      {
                          url: '/Customer/CartSmall',
                          data: {},
                          type: 'Get',
                          success: function (cartdata) {
                              $("#cart").html(cartdata);
                          }

                      })
               }
           },
           complete: function () {
               if (sender != undefined) {
                   $(sender).removeClass("m-progress");
               }
           }
       })
}
function removeFromCart(id, refresh) {
    if (refresh == undefined) {
        refresh = 0;
    }
    $.ajax({
        url: '/Customer/removefromCart',
        data: { id },
                type: 'Get',
                success: function (data) {
                    if (refresh == 1) {
                        location.reload();
                    }
                    else {
                        if (refresh == 1) {
                            location.reload();
                        }
                        else {
                            $.ajax({
                                url: '/Customer/CartSmall',
                                data: {},
                                type: 'Get',
                                success: function (cartdata) {
                                    $("#cart").html(cartdata);
                                    $("#smallCartButton").trigger('click');
                                }

                            });

                        }
                    }
                }
    });
}

function AddToCompressionList(id) {
    $.ajax({
        url: '/Customer/addtoCompressionList',
        data: { id: id },
        type: 'Get',
        success: (function (data) {
            if (data.count > 0) {
                $(".CompareCountli").removeClass("hidden")
            }
            else {
                $(".CompareCountli").addClass("hidden")
            }
            $('.CompressionListcount').html(data.count);
            if (data.status == "Add") {
                $(".button-addToCompressionList-" + id).addClass("back-red")
            }
            else if (data.status == "Remove") {
                $(".button-addToCompressionList-" + id).removeClass("back-red")
            }
        })
    });
}




function LoadSendMethods(cityid, checkbox) {
    var canload = false;
    if (checkbox == undefined) {
        canload = true;
    }
    else if (checkbox.checked) {
        canload = true;
    }
    if (canload) {
        $("#SendMethods").html('<button class="btn btn-default m-progress"></button>');

        $.ajax({
            url: '/Customer/LoadSendMethods',
            data: { cityid: cityid },
            type: 'Get',
            success: (function (data) {
                $("#SendMethods").html(data);

                var sendmethodprice = parseInt(document.getElementById("SendMethodPriceselected").value);
                $("#CheckoutPriceSend").html(sendmethodprice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
                var total = parseInt(document.getElementById("CheckoutCartTotal").value);
                total = total + sendmethodprice;
                $("#CheckoutPricePay").html(total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
            })
        });
    }
}

function LoadSendMethodPrice(id, checkbox) {

    var canload = false;
    if (checkbox == undefined) {
        canload = true;
    }
    else if (checkbox.checked) {
        canload = true;
    }
    if (canload) {
        $('.sendmethodbox').removeClass("active");
        $('#sendmethodbox-' + id).addClass("active");

        var sendmethodprice = parseInt(document.getElementById("SendMethodPrice" + id).value);
        document.getElementById("SendMethodPriceselected").value = sendmethodprice;
        $("#CheckoutPriceSend").html(sendmethodprice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
        var total = parseInt(document.getElementById("CheckoutCartTotal").value);
        total = total + sendmethodprice;
        $("#CheckoutPricePay").html(total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));

    }
}
function LoadPaymentTypePrice(id, checkbox) {


    var canload = false;
    if (checkbox == undefined) {
        canload = true;
    }
    else if (checkbox.checked) {
        canload = true;
    }
    if (canload) {
        $('.paymenttypebox').removeClass("active");
        $('#paymenttypebox-' + id).addClass("active");
    }
}
function Discount() {
    var discountcode = document.getElementById("input-discountCode").value;
    if (discountcode == undefined || discountcode == null || discountcode == "") {
        CHmessagebox("Please enter discount code");
    }
    else {
        $.ajax({
            url: '/Customer/CheckDiscountCode',
            data: { code: discountcode },
            type: 'Get',
            success: (function (data) {
                if (data == "Error") {
                    CHmessagebox("Discount code not found");
                }
                else {

                    var sendmethodprice = parseInt(document.getElementById("SendMethodPriceselected").value);
                    $("#CheckoutPriceSend").html(sendmethodprice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
                    var total = parseInt(document.getElementById("CheckoutCartTotal").value);
                    total = total + sendmethodprice;
                    var discount = parseInt(data);
                    total = total - discount;
                    document.getElementById("CheckoutCartTotal").value = total;
                    $("#CheckoutPriceDiscount").html(discount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
                    $("#CheckoutPricePay").html(total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
                    $("#button-coupon").remove();
                    $("#input-discountCode").attr("readonly", "");
                }
            })
        });
    }

}



function deleteAddress(id) {
    CHmessagebox("Are you sure you want to remove the address?", 3, function () {
        $.ajax({
            url: '/Customer/DeleteAddress',
            data: { id },
                    type: 'Get',
                    success: function (data) {
                        if(data == "") {
                            window.location.reload();
                        }
                        else {
                            CHmessagebox(data);
                        }
                    }

        });
    });
}
function editAddress(id) {
    var ch_messa = '<div id="MyDialogModel" class="CH-message">' +
                  '<div id="MyDialogModelBody" class="CH-message-body ch-address">' +
                    '<button class="btn btn-default m-progress no-background" ></button>' +
                  '</div>' +
                   '<div class="CH-message-background" onclick="CHmessageClose();"></div>' +
                   '</div>';
    $('body').append(ch_messa);

    $.ajax(
        {
            url: '/Customer/EditAddress',
            data: { id },
                    type: 'Get',
                    success: function (data) {
                if (document.getElementById("MyDialogModelBody") != undefined) {
                    $("#MyDialogModelBody").html(data);
                }
                    }

        });
}

function loginbtn(id) {
    if (id == 5)
    {
        openMymenuleft();
    }
    CHmessagebox("Login", 2);
}







$("#filter_name").keyup(function (e) {


    var search = document.getElementById("filter_name").value;
    if (e.keyCode == 13) {
        window.location.href = "/Catalog/Category/?search=" + search;
    }
    else {



        $('#searchlist').html("");
        if (search == "" || search.length < 1) {


            $("#searchlist").addClass("hidden");
        }
        else if (search.length < 3) {
            $("#searchlist").removeClass("hidden");
            $('#searchlist').html('<div class="searcherror">Please enter at least 3 characters...</div>');

        }
        else {
            $("#searchlist").removeClass("hidden");
            $('#searchlist').html('<div class="text-center" style="padding:10px;"><button class="btn btn-default m-progress no-background" ></button></div>');

            $.ajax(
            {
                url: '/Catalog/FastSearch',
                data: { search },
                        dataType: 'html',
                        type: 'Get',
                        success: function (data) {
                            $('#searchlist').html(data);
                        }

            })
        }
    }
});

jQuery("document").ready(function ($) {

    var nav = $('#topmenuholder');
    
    $(window).scroll(function () {
        if ($(this).scrollTop() > 159) {
            nav.addClass("myfixedmenu");
            $("#container").addClass("fixmenucontainer");

        } else {
            nav.removeClass("myfixedmenu");
            $("#container").removeClass("fixmenucontainer");

        }
    });

});

function ProductQuickview(id) {
    var ch_messa = '<div id="MyDialogModel" class="CH-message ">' +
                 '<div id="MyDialogModelBody" class="CH-message-body ch-address" style="min-width:90vh;">' +
                  '<button class="CH-message-exitbtn" onclick="CHmessageClose();"><i class="fa fa-close"></i></button>' +
                  '<div id="MyDialogModelBodyinner">' +
                        '<button class="btn btn-default m-progress no-background" ></button>' +
                   '</div>' +
                 '</div>' +
                  '<div class="CH-message-background" onclick="CHmessageClose();"></div>' +
                  '</div>';
    $('body').append(ch_messa);

    $.ajax(
        {
            url: '/catalog/QuickviewProduct',
            data: { id },
            type: 'Get',
            success: function (data) {
                if (document.getElementById("MyDialogModelBodyinner") != undefined) {
                    $("#MyDialogModelBodyinner").html(data);
                }
            }

        });
}


function showMyadditional(id) {
    var sor = document.getElementById("productadditionalimage-" + id).src;
    document.getElementById("productmainimage").src = sor;
}

function extrasaleLoad(id) {
    var sidebaritem = $("#extrasale-sidebar-item-" + id);
    if (sidebaritem.hasClass("active") == false) {
        $(".extrasale-sidebar-item").removeClass("active");
        var oldselected = $(".extrasale-proitem.active");
        if (oldselected != undefined) {
            oldselected.removeClass("active");
            oldselected.fadeOut("fast", "linear", function () {
                extrasaleselect(id);
            });
        }
        else {
            extrasaleselect(id);
        }
    }
}
function extrasaleselect(id) {
    var sidebaritem = $("#extrasale-sidebar-item-" + id);
    var lastitem = $(".extrasale-sidebar-item:last-child");
    var total = parseInt(lastitem.index());
    var topindx = parseInt(sidebaritem.index());
    if (topindx == 0) {
        topindx++;
    }
    else if (topindx == total) {
        topindx--;
    }

    topindx--;
    var height = 165;
    height = height * topindx;
    var heightstr = "-" + height + "px";
    $(".extrasale-sidebar-inner").animate({ "top": heightstr }, 300);
    sidebaritem.addClass("active");
    var newselect = $("#extrasale-proitem-" + id);
    newselect.addClass("active");
    newselect.fadeIn("fast", "linear");
}
function extraslidernext() {
    var oldselected = $(".extrasale-sidebar-item.active");
    var newselected;

    newselected = oldselected.next();
    if (newselected.attr("id") == undefined) {
        newselected = $(".extrasale-sidebar-item:first-child");
        var idstr = newselected.attr("id").replace("extrasale-sidebar-item-", "");
        extrasaleselect(idstr);
    }
    else {
        var idstr = newselected.attr("id").replace("extrasale-sidebar-item-", "");
        extrasaleLoad(idstr);

    }
}
function extrasliderprev() {
    var oldselected = $(".extrasale-sidebar-item.active");
    var newselected;

    newselected = oldselected.prev();
    if (newselected.attr("id") == undefined) {
        newselected = $(".extrasale-sidebar-item:last-child");
        var idstr = newselected.attr("id").replace("extrasale-sidebar-item-", "");
        extrasaleselect(idstr);
    }
    else {
        var idstr = newselected.attr("id").replace("extrasale-sidebar-item-", "");
        extrasaleLoad(idstr);

    }
}
