var paginationLimit = 9999;var paginationLimit;
function loadLibraries() {
    "undefined" == typeof $ && ($ = jQuery), "undefined" == typeof $.fn.appear && ! function(i) {
        function t(t) {
            return i(t).filter(function() {
                return i(this).is(":appeared")
            })
        }
    
        // Upvote/Downvote 

        $(".voteCasting").on('click',function(){
            var vote_type = $(this).attr('vote-type');
       	    var key = $(this).attr('data-id');
       	    var voteCasting = $(this);
       	    
   	        // $.getJSON("http://jsonip.com?callback=?", function (data) {
            //     var user_ip = data.ip;
                $.ajax({
                  type : 'post',
                  url : '/a/postData',
                  data : { 'simpAskAction' : 'voting', 'question_id': key, 'vote_type': vote_type, 'user_ip': user_ip},
                  success:function(response){
                  		console.log(response);
                  	jsnObj = JSON.parse(response);
                  	
                  	if(vote_type == 1){
                  	    voteCasting.find('i').toggleClass('fa fa-thumbs-o-up fa fa-thumbs-up');
                  	    $('.up_vote_span_'+key).html(jsnObj.upvote_cnt);
                  	}else{
                  	    voteCasting.find('i').toggleClass('fa fa-thumbs-o-down fa fa-thumbs-down');
                  	    $('.down_vote_span_'+key).html(jsnObj.downvote_cnt);
                  	}
                  	
                  }
                });
	       
            // });
            
            
            
            
            
    	});

        function s() {
            o = !1;
            for (var i = 0, s = n.length; s > i; i++) {
                var e = t(n[i]);
                if (e.trigger("appear", [e]), d[i]) {
                    var a = d[i].not(e);
                    a.trigger("disappear", [a])
                }
                d[i] = e
            }
        }

        
        function e(i) {
            n.push(i), d.push()
        }
        var n = [],
            a = !1,
            o = !1,
            r = {
                interval: 250,
                force_process: !1
            },
            h = i(window),
            d = [];
        i.expr[":"].appeared = function(t) {
            var s = i(t);
            if (!s.is(":visible")) return !1;
            var e = h.scrollLeft(),
                n = h.scrollTop(),
                a = s.offset(),
                o = a.left,
                r = a.top;
            return r + s.height() >= n && r - (s.data("appear-top-offset") || 0) <= n + h.height() && o + s.width() >= e && o - (s.data("appear-left-offset") || 0) <= e + h.width() ? !0 : !1
        }, i.fn.extend({
            appear: function(t) {
                var n = i.extend({}, r, t || {}),
                    h = this.selector || this;
                if (!a) {
                    var d = function() {
                        o || (o = !0, setTimeout(s, n.interval))
                    };
                    i(window).scroll(d).resize(d), a = !0
                }
                return n.force_process && setTimeout(s, n.interval), e(h), i(h)
            }
        }), i.extend({
            force_appear: function() {
                return a ? (s(), !0) : !1
            }
        })
    }(function() {
        return "undefined" != typeof module ? require("jquery") : jQuery
    }()), $("#simpAskQuestion").find(".accordionSimpQA ul li").length > paginationLimit && ! function(i, t, s, e) {
        function n(e, n) {
            this.options = i.extend({}, r, n), this._container = i("#" + this.options.containerID), this._container.length && (this.jQwindow = i(t), this.jQdocument = i(s), this._holder = i(e), this._nav = {}, this._first = i(this.options.first), this._previous = i(this.options.previous), this._next = i(this.options.next), this._last = i(this.options.last), this._items = this._container.children(":visible"), this._itemsShowing = i([]), this._itemsHiding = i([]), this._numPages = Math.ceil(this._items.length / this.options.perPage), this._currentPageNum = this.options.startPage, this._clicked = !1, this._cssAnimSupport = this.getCSSAnimationSupport(), this.init())
        }
        var a = "jPages",
            o = null,
            r = {
                containerID: "",
                first: !1,
                previous: "← Previous",
                next: "Next →",
                last: !1,
                links: "numeric",
                startPage: 1,
                perPage: 10,
                midRange: 5,
                startRange: 1,
                endRange: 1,
                keyBrowse: !1,
                scrollBrowse: !1,
                pause: 0,
                clickStop: !1,
                delay: 50,
                direction: "forward",
                animation: "",
                fallback: 400,
                minHeight: !0,
                callback: e
            };
        n.prototype = {
            constructor: n,
            getCSSAnimationSupport: function() {
                var i = !1,
                    t = "animation",
                    s = "",
                    n = "Webkit Moz O ms Khtml".split(" "),
                    a = "",
                    o = this._container.get(0);
                if (o.style.animationName && (i = !0), i === !1)
                    for (var r = 0; r < n.length; r++)
                        if (o.style[n[r] + "AnimationName"] !== e) {
                            a = n[r], t = a + "Animation", s = "-" + a.toLowerCase() + "-", i = !0;
                            break
                        } return i
            },
            init: function() {
                this.setStyles(), this.setNav(), this.paginate(this._currentPageNum), this.setMinHeight()
            },
            setStyles: function() {
                var t = "<style>.simp-invisible { visibility: hidden !important; } .simp-hidden { display: none !important; }</style>";
                i(t).appendTo("head"), this._cssAnimSupport && this.options.animation.length ? this._items.addClass("animated simp-hidden") : this._items.hide()
            },
            setNav: function() {
                var t = this.writeNav();
                this._holder.each(this.bind(function(s, e) {
                    var n = i(e);
                    n.html(t), this.cacheNavElements(n, s), this.bindNavHandlers(s), this.disableNavSelection(e)
                }, this)), this.options.keyBrowse && this.bindNavKeyBrowse(), this.options.scrollBrowse && this.bindNavScrollBrowse()
            },
            writeNav: function() {
                var i, t = 1;
                for (i = this.writeBtn("first") + this.writeBtn("previous"); t <= this._numPages; t++) {
                    switch (1 === t && 0 === this.options.startRange && (i += "<span>...</span>"), i += t > this.options.startRange && t <= this._numPages - this.options.endRange ? "<a href='#' class='simp-hidden'>" : "<a>", this.options.links) {
                        case "numeric":
                            i += t;
                            break;
                        case "blank":
                            break;
                        case "title":
                            var s = this._items.eq(t - 1).attr("data-title");
                            i += s !== e ? s : ""
                    }
                    i += "</a>", (t === this.options.startRange || t === this._numPages - this.options.endRange) && (i += "<span>...</span>")
                }
                return i += this.writeBtn("next") + this.writeBtn("last") + "</div>"
            },
            writeBtn: function(t) {
                return this.options[t] === !1 || i(this["_" + t]).length ? "" : "<a class='simp-" + t + "'>" + this.options[t] + "</a>"
            },
            cacheNavElements: function(t, s) {
                this._nav[s] = {}, this._nav[s].holder = t, this._nav[s].first = this._first.length ? this._first : this._nav[s].holder.find("a.simp-first"), this._nav[s].previous = this._previous.length ? this._previous : this._nav[s].holder.find("a.simp-previous"), this._nav[s].next = this._next.length ? this._next : this._nav[s].holder.find("a.simp-next"), this._nav[s].last = this._last.length ? this._last : this._nav[s].holder.find("a.simp-last"), this._nav[s].fstBreak = this._nav[s].holder.find("span:first"), this._nav[s].lstBreak = this._nav[s].holder.find("span:last"), this._nav[s].pages = this._nav[s].holder.find("a").not(".simp-first, .simp-previous, .simp-next, .simp-last"), this._nav[s].permPages = this._nav[s].pages.slice(0, this.options.startRange).add(this._nav[s].pages.slice(this._numPages - this.options.endRange, this._numPages)), this._nav[s].pagesShowing = i([]), this._nav[s].currentPage = i([])
            },
            bindNavHandlers: function(t) {
                var s = this._nav[t];
                s.holder.bind("click.jPages", this.bind(function(t) {
                    var e = this.getNewPage(s, i(t.target));
                    this.validNewPage(e) && (this._clicked = !0, this.paginate(e)), t.preventDefault()
                }, this)), this._first.length && this._first.bind("click.jPages", this.bind(function() {
                    this.validNewPage(1) && (this._clicked = !0, this.paginate(1))
                }, this)), this._previous.length && this._previous.bind("click.jPages", this.bind(function() {
                    var i = this._currentPageNum - 1;
                    this.validNewPage(i) && (this._clicked = !0, this.paginate(i))
                }, this)), this._next.length && this._next.bind("click.jPages", this.bind(function() {
                    var i = this._currentPageNum + 1;
                    this.validNewPage(i) && (this._clicked = !0, this.paginate(i))
                }, this)), this._last.length && this._last.bind("click.jPages", this.bind(function() {
                    this.validNewPage(this._numPages) && (this._clicked = !0, this.paginate(this._numPages))
                }, this))
            },
            disableNavSelection: function(i) {
                "undefined" != typeof i.onselectstart ? i.onselectstart = function() {
                    return !1
                } : "undefined" != typeof i.style.MozUserSelect ? i.style.MozUserSelect = "none" : i.onmousedown = function() {
                    return !1
                }
            },
            bindNavKeyBrowse: function() {
                this.jQdocument.bind("keydown.jPages", this.bind(function(i) {
                    var t = i.target.nodeName.toLowerCase();
                    if (this.elemScrolledIntoView() && "input" !== t && "textarea" != t) {
                        var s = this._currentPageNum;
                        37 == i.which && (s = this._currentPageNum - 1), 39 == i.which && (s = this._currentPageNum + 1), this.validNewPage(s) && (this._clicked = !0, this.paginate(s))
                    }
                }, this))
            },
            elemScrolledIntoView: function() {
                var i, t, s, e;
                return i = this.jQwindow.scrollTop(), t = i + this.jQwindow.height(), s = this._container.offset().top, e = s + this._container.height(), e >= i && t >= s
            },
            bindNavScrollBrowse: function() {
                this._container.bind("mousewheel.jPages DOMMouseScroll.jPages", this.bind(function(i) {
                    var t = (i.originalEvent.wheelDelta || -i.originalEvent.detail) > 0 ? this._currentPageNum - 1 : this._currentPageNum + 1;
                    return this.validNewPage(t) && (this._clicked = !0, this.paginate(t)), i.preventDefault(), !1
                }, this))
            },
            getNewPage: function(i, t) {
                return t.is(i.currentPage) ? this._currentPageNum : t.is(i.pages) ? i.pages.index(t) + 1 : t.is(i.first) ? 1 : t.is(i.last) ? this._numPages : t.is(i.previous) ? i.pages.index(i.currentPage) : t.is(i.next) ? i.pages.index(i.currentPage) + 2 : void 0
            },
            validNewPage: function(i) {
                return i !== this._currentPageNum && i > 0 && i <= this._numPages
            },
            paginate: function(t) {
                var s, e;
                s = this.updateItems(t), e = this.updatePages(t), this._currentPageNum = t, i.isFunction(this.options.callback) && this.callback(t, s, e), this.updatePause()
            },
            updateItems: function(i) {
                var t = this.getItemRange(i);
                return this._itemsHiding = this._itemsShowing, this._itemsShowing = this._items.slice(t.start, t.end), this._cssAnimSupport && this.options.animation.length ? this.cssAnimations(i) : this.jQAnimations(i), t
            },
            getItemRange: function(i) {
                var t = {};
                return t.start = (i - 1) * this.options.perPage, t.end = t.start + this.options.perPage, t.end > this._items.length && (t.end = this._items.length), t
            },
            cssAnimations: function(i) {
                clearInterval(this._delay), this._itemsHiding.removeClass(this.options.animation + " simp-invisible").addClass("simp-hidden"), this._itemsShowing.removeClass("simp-hidden").addClass("simp-invisible"), this._itemsOriented = this.getDirectedItems(i), this._index = 0, this._delay = setInterval(this.bind(function() {
                    this._index === this._itemsOriented.length ? clearInterval(this._delay) : this._itemsOriented.eq(this._index).removeClass("simp-invisible").addClass(this.options.animation), this._index = this._index + 1
                }, this), this.options.delay)
            },
            jQAnimations: function(i) {
                clearInterval(this._delay), this._itemsHiding.addClass("simp-hidden"), this._itemsShowing.fadeTo(0, 0).removeClass("simp-hidden"), this._itemsOriented = this.getDirectedItems(i), this._index = 0, this._delay = setInterval(this.bind(function() {
                    this._index === this._itemsOriented.length ? clearInterval(this._delay) : this._itemsOriented.eq(this._index).fadeTo(this.options.fallback, 1), this._index = this._index + 1
                }, this), this.options.delay)
            },
            getDirectedItems: function(t) {
                var s;
                switch (this.options.direction) {
                    case "backwards":
                        s = i(this._itemsShowing.get().reverse());
                        break;
                    case "random":
                        s = i(this._itemsShowing.get().sort(function() {
                            return Math.round(Math.random()) - .5
                        }));
                        break;
                    case "auto":
                        s = t >= this._currentPageNum ? this._itemsShowing : i(this._itemsShowing.get().reverse());
                        break;
                    default:
                        s = this._itemsShowing
                }
                return s
            },
            updatePages: function(i) {
                var t, s, e;
                t = this.getInterval(i);
                for (s in this._nav) this._nav.hasOwnProperty(s) && (e = this._nav[s], this.updateBtns(e, i), this.updateCurrentPage(e, i), this.updatePagesShowing(e, t), this.updateBreaks(e, t));
                return t
            },
            getInterval: function(i) {
                var t, s, e, n;
                return t = Math.ceil(this.options.midRange / 2), s = this._numPages - this.options.midRange, e = i > t ? Math.max(Math.min(i - t, s), 0) : 0, n = i > t ? Math.min(i + t - (this.options.midRange % 2 > 0 ? 1 : 0), this._numPages) : Math.min(this.options.midRange, this._numPages), {
                    start: e,
                    end: n
                }
            },
            updateBtns: function(i, t) {
                1 === t && (i.first.addClass("simp-disabled"), i.previous.addClass("simp-disabled")), t === this._numPages && (i.next.addClass("simp-disabled"), i.last.addClass("simp-disabled")), 1 === this._currentPageNum && t > 1 && (i.first.removeClass("simp-disabled"), i.previous.removeClass("simp-disabled")), this._currentPageNum === this._numPages && t < this._numPages && (i.next.removeClass("simp-disabled"), i.last.removeClass("simp-disabled"))
            },
            updateCurrentPage: function(i, t) {
                i.currentPage.removeClass("simp-current"), i.currentPage = i.pages.eq(t - 1).addClass("simp-current")
            },
            updatePagesShowing: function(i, t) {
                var s = i.pages.slice(t.start, t.end).not(i.permPages);
                i.pagesShowing.not(s).addClass("simp-hidden"), s.not(i.pagesShowing).removeClass("simp-hidden"), i.pagesShowing = s
            },
            updateBreaks: function(i, t) {
                t.start > this.options.startRange || 0 === this.options.startRange && t.start > 0 ? i.fstBreak.removeClass("simp-hidden") : i.fstBreak.addClass("simp-hidden"), t.end < this._numPages - this.options.endRange ? i.lstBreak.removeClass("simp-hidden") : i.lstBreak.addClass("simp-hidden")
            },
            callback: function(i, t, s) {
                var e = {
                        current: i,
                        interval: s,
                        count: this._numPages
                    },
                    n = {
                        showing: this._itemsShowing,
                        oncoming: this._items.slice(t.start + this.options.perPage, t.end + this.options.perPage),
                        range: t,
                        count: this._items.length
                    };
                e.interval.start = e.interval.start + 1, n.range.start = n.range.start + 1, this.options.callback(e, n)
            },
            updatePause: function() {
                if (this.options.pause && this._numPages > 1) {
                    if (clearTimeout(this._pause), this.options.clickStop && this._clicked) return;
                    this._pause = setTimeout(this.bind(function() {
                        this.paginate(this._currentPageNum !== this._numPages ? this._currentPageNum + 1 : 1)
                    }, this), this.options.pause)
                }
            },
            setMinHeight: function() {
                this.options.minHeight && !this._container.is("table, tbody") && setTimeout(this.bind(function() {
                    this._container.css({
                        "min-height": this._container.css("height")
                    })
                }, this), 1e3)
            },
            bind: function(i, t) {
                return function() {
                    return i.apply(t, arguments)
                }
            },
            destroy: function() {
                this.jQdocument.unbind("keydown.jPages"), this._container.unbind("mousewheel.jPages DOMMouseScroll.jPages"), this.options.minHeight && this._container.css("min-height", ""), this._cssAnimSupport && this.options.animation.length ? this._items.removeClass("animated simp-hidden simp-invisible " + this.options.animation) : this._items.removeClass("simp-hidden").fadeTo(0, 1), this._holder.unbind("click.jPages").empty()
            }
        }, i.fn[a] = function(t) {
            var s = i.type(t);
            return "object" === s ? (this.length && !i.data(this, a) && (o = new n(this, t), this.each(function() {
                i.data(this, a, o)
            })), this) : "string" === s && "destroy" === t ? (o.destroy(), this.each(function() {
                i.removeData(this, a)
            }), this) : "number" === s && t % 1 === 0 ? (o.validNewPage(t) && o.paginate(t), this) : this
        }
    }(jQuery, window, document)
}
var loadScript = function(i, t) {
        var s = document.createElement("script");
        s.type = "text/javascript", s.readyState ? s.onreadystatechange = function() {
            ("loaded" == s.readyState || "complete" == s.readyState) && (s.onreadystatechange = null, t())
        } : s.onload = function() {
            t()
        }, s.src = i, document.getElementsByTagName("head")[0].appendChild(s)
    },
    simpAskAppJavaScript = function(i) {
        console.log("ready1");
        i(document).ready(function() {
            function t(i) {
                return i = i.replace(/\\"/g, '"')
            }
            console.log("ready");
            
            if(i("#simpAskQuestion").find("div.simPagination").length > 0)
            {
                i("#simpAskQuestion").find("div.simPagination").remove();
            }
            
            var s = 0;
            console.log("Count + " + i("#simpAskQuestion").find(".accordionSimpQA ul li").length), i("#simpSearchQuestion").keyup(function() {
                
                
                var t = i(this).val();
                i(".accordionSimpQA ul li").each(function() {
                    i(this).text().search(new RegExp(t, "i")) < 0 ? i(this).hide() : i(this).show()
                }), i("#simpAskQuestion").find(".accordionSimpQA ul li").length > paginationLimit && i("#simpAskQuestion").find("div.simPagination").jPages({
                    containerID: "itemContainer",
                    perPage: paginationLimit,
                    keyBrowse: !0,
                    next: " » ",
                    previous: " « ",
                    callback: function(t) {
                        1 == t.count && i("#simpAskQuestion").find("div.simPagination").hide()
                    }
                })
            }), i("#simpAskQuestion").find(".accordionSimpQA ul li").length > paginationLimit && (i("#simpAskQuestion").find(".accordionSimpQA ul").attr("id", "itemContainer"), i("#simpAskQuestion").find(".accordionSimpQA").append('<div class="simPagination"></div>'), i("#simpAskQuestion").find("div.simPagination").jPages({
                containerID: "itemContainer",
                perPage: paginationLimit,
                keyBrowse: !0,
                next: " » ",
                previous: " « ",
                callback: function(t) {
                    1 == t.count && i("#simpAskQuestion").find("div.simPagination").hide()
                }
            }), i("#simpAskQuestion").find(".accordionSimpQA").append('<style type="text/css">.accordionSimpQA { width:100%}.simPagination {margin: 15px 0;clear: both;text-align: center;}.simPagination a { cursor: pointer;margin: 0 5px;color: inherit;}.simPagination a.simp-previous { margin-right: 15px; }.simPagination a.simp-next { margin-left: 15px; }.simPagination a{display: inline-block; margin-right: 4px;} .simPagination a.simp-current,.simPagination a.simp-current:hover {opacity : 0.5;} .simPagination a.simp-disabled, a.simp-disabled:hover {opacity : 0.5;} .simPagination a.simp-current, a.simp-current:hover,.simPagination a.simp-disabled, a.simp-disabled:hover {cursor: default;}.simPagination span { margin: 0 5px; }</style>')), i(".accordionSimpQA p").each(function(s) {
                i(this).html(t(i(this).html()))
            }), i("#askQuestion").submit(function(t) {
                t.preventDefault();
                var s = i("#askQuestion").serialize();
                i("#askQuestion .btn-primary").val("Submitting..."), i("#askQuestion input,#askQuestion textarea").prop("disabled", !0), i.ajax({
                    url: "/a/postData",
                    type: "POST",
                    data: s,
                    dataType: "json",
                    success: function(t, s, e) {
                        i("#askQuestion .btn-primary").val("Submit"), i("#askQuestion input,#askQuestion textarea").prop("disabled", !1), 0 == t.error ? (i(".simpAsk-error-msg").html(""), i(".simpAsk-error-msg").css("display", "none"), i(".simpAsk-success-msg").html(t.message), i("#askQuestion").find("input[type=text], input[type=email], textarea").val(""), i(".simpAsk-success-msg").css("display", "block"), i("#simpAskForm_container").toggle()) : (i(".simpAsk-error-msg").html(t.message), i(".simpAsk-error-msg").css("display", "block"))
                    },
                    error: function(i, t, s) {
                        alert("There is some error while processing your request. Please try again.")
                    },
                    beforeSend: function(i) {}
                })
            }), i(".simpAskQuestion-btn").click(function() {
                i("#simpAskForm_container").show(), i("html,body").animate({
                    scrollTop: i("#simpAskForm_container").offset().top - 70
                }, 1e3)
            }), i(".simpAskQuestionForm-btnOpen").click(function() {
                i("#simpAskForm_container").toggle()
            }), i(".simpAskForm-cancel-btn").click(function() {
                i("#simpAskForm_container").hide()
            }), i("#simpAskQuestion").appear(), i("#simpAskQuestion").on("appear", function(t, e) {
                0 == s && (i.ajax({
                    url: "/a/postData",
                    type: "POST",
                    data: {
                        simpAskAction: "reportView",
                        simpAskProductId: i("#simpAskProductId").val()
                    },
                    dataType: "json"
                }), s = 1)
            })
        })
    };
"undefined" == typeof $ && "undefined" == typeof jQuery ? loadScript("//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", function() {
    loadLibraries(), simpJqueryCustom = jQuery.noConflict(!0), simpAskAppJavaScript(simpJqueryCustom)
}) : (loadLibraries(), simpAskAppJavaScript("undefined" == typeof $ ? jQuery : $));




