function subtractQty(){document.getElementById("qty").value-1<0||document.getElementById("qty").value--}function subtractQty1(){document.getElementById("qty1").value-1<0||document.getElementById("qty1").value--}function subtractQty2(){document.getElementById("qty2").value-1<0||document.getElementById("qty2").value--}function subtractQty3(){document.getElementById("qty3").value-1<0||document.getElementById("qty3").value--}function subtractQty4(){document.getElementById("qty4").value-1<0||document.getElementById("qty4").value--}function AddProduct(n,t,i){try{if(t==2&&(t=$("#qtyInput").val()),t<=0){$.notify("الرحاء ادخال رقم صحيح و اكبر من الصفر","error");return}if(t=parseInt(t),t+=parseInt(GetLocalProductQTY(n)),t>i){$.notify("عذرا... الكمية المطلوبة غير متوفرة في المتجر حاليا","error");return}$.ajax({url:"/Checkout/AddProductToCart",type:"POST",data:{productID:n,qty:t},success:function(n){var t=JSON.parse(n);addProductsToCookies(t);UpdateShoppingCartMenu();$.notify(" الى سلة المشتريات بنجاح <b>"+t.ProductName+"<\/b> تم إضافة ","success")},error:function(){}});event.stopPropagation()}catch(r){console.log(r.message)}}function addProductsToCookies(n){var u,r,t,i;try{if(u=localStorage.getItem("products"),u==undefined)t=[],t.push(n),localStorage.setItem("products",JSON.stringify(t));else{for(r=JSON.parse(u),t=[],i=0;i<r.length;i++)r[i].ProductID==n.ProductID||t.push(r[i]);t.push(n);localStorage.setItem("products",JSON.stringify(t))}}catch(f){console.log(f.message)}}function UpdateShoppingCartMenu(){var n,f,u,r,t,i;try{for(n=[],f=localStorage.getItem("products"),localStorage.getItem("products")!=undefined&&(n=JSON.parse(localStorage.getItem("products"))),$("#ProductsCount").text(n.length),$("#CartProducts").html(""),u=0,r=0,n.length==0&&(document.getElementById("CartProducts").innerHTML+="<h4 style='text-align: center;'><br><br><br><br><br><br>Your Cart is Empty<\/h4>"),t=0;t<n.length;t++)i=0,n[t].QTY>=n[t].qty1&&(i=n[t].price1),n[t].QTY>=n[t].qty2&&(i=n[t].price2),n[t].QTY>=n[t].qty3&&(i=n[t].price3),n[t].QTY>=n[t].qty4&&(i=n[t].price4),document.getElementById("CartProducts").innerHTML+="<li><a href='/Product/"+n[t].ProductLink+"/'><img src='/ProImg/X1/"+n[t].ImageLink+"'><\/a><button type='button' onclick='DeleteProduct(\""+n[t].ProductID+"\");' class='close'>×<\/button><div class='overflow-h'><span><a href='/Product/"+n[t].ProductLink+"/'>"+n[t].ProductName+"<\/a><\/span><small>"+n[t].QTY+" x "+Number(i).toFixed(2)+" JD <\/small><\/div><\/li>",u+=n[t].QTY,r+=n[t].QTY*i;$("#subTotalPrice").text(Number(r).toFixed(2)+" JD");$("#visbleCount").text(Number(r).toFixed(2)+" JD - "+n.length+" items");$("#yyy").mCustomScrollbar("update")}catch(e){console.log(e.message)}}function GetLocalProductQTY(n){var r,i,t;try{if(r=localStorage.getItem("products"),r==undefined)return 0;for(i=JSON.parse(r),t=0;t<i.length;t++)if(i[t].ProductID==n)return i[t].QTY;return 0}catch(u){}}function DeleteProduct(n){var r,i,u,t;try{if(r=localStorage.getItem("products"),r==undefined)return;for(i=JSON.parse(r),u=[],t=0;t<i.length;t++)i[t].ProductID==n||u.push(i[t]);localStorage.setItem("products",JSON.stringify(u));UpdateShoppingCartMenu();$("#Cartbody").length>0&&UpdateCartPage()}catch(f){}}function DeletFromWISHLIST(n){var r,i,u,t;try{if(r=localStorage.getItem("WISHLIST"),r!=undefined){for(i=JSON.parse(r),u=[],t=0;t<i.length;t++)i[t]==n||u.push(i[t]);localStorage.setItem("WISHLIST",JSON.stringify(u))}$("#WishlistCount").text("Wishlist ("+GetWISHLISTCount()+")")}catch(f){}}function UpdateCartPage(){var n,u,t,i,r;try{for(n=JSON.parse(localStorage.getItem("products")),$("#Cartbody").html(""),(n==undefined||n.length==0)&&$("#Cartbody").html('<tr><td style="text-align:center;"colspan="4"><span><br><br><br><br><br><br> Your Cart Is Empty<br><br><br><br><br><br><br><\/span><\/td><\/tr>'),u=0,t=0;t<n.length;t++)i=0,n[t].QTY>=n[t].qty1&&(i=n[t].price1),n[t].QTY>=n[t].qty2&&(i=n[t].price2),n[t].QTY>=n[t].qty3&&(i=n[t].price3),n[t].QTY>=n[t].qty4&&(i=n[t].price4),u+=Number(n[t].QTY)*Number(i),document.getElementById("Cartbody").innerHTML+=" <tr> <td class='product-in-table'>  <img class='img-responsive' src='/ProImg/X1/"+n[t].ImageLink+"' alt=''><div class='product-it-in'><a class='HoverLink' target='_blank' href='/Product/"+n[t].ProductLink+"/'/><h3>"+n[t].ProductName+"<\/h3><\/a><\/div><\/td><td>"+Number(i).toFixed(2)+" JD<\/td><td>    <button type='button' class='quantity-button' name='subtract' onclick='UpdateProductQTY(\""+n[t].ProductID+'","'+(n[t].QTY-1)+"\")' value='-'>-<\/button><input type='text' class='quantity-field' name='qty1' value='"+n[t].QTY+"' id='qty1'  onchange='UpdateProductQTY(\""+n[t].ProductID+"\",\"-100\")' />    <button type='button' class='quantity-button' name='add' onclick='UpdateProductQTY(\""+n[t].ProductID+'","'+(n[t].QTY+1)+"\")' value='+'>+<\/button><\/td><td class='shop-red'>"+(Number(i)*Number(n[t].QTY)).toFixed(2)+" JD<\/td><td><button type='button'  onclick='DeleteProduct(\""+n[t].ProductID+"\")' class='close'><span>&times;<\/span><span class='sr-only'>Close<\/span><\/button><\/td><\/tr>";$("#subTotal").html(u.toFixed(2));r=(u+TryParseInt($("#shopping").html(),0)).toFixed(2);IsPercentage?($("#Discount").val(Number(r*Percentagediscount/100)),$("#disLbl").text($("#Discount").val()),r=Number(r*(100-Percentagediscount)/100).toFixed(2)):($("#Percentage").val(Number(discount/r*100).toFixed(2)),$("#disLbl").text(discount),r=Number(r-discount).toFixed(2));$("#total").html(" "+r+" ")}catch(f){}}function UpdateProductQTY(n,t){var i,r;try{for(t==-100&&(t=event.target.value),i=JSON.parse(localStorage.getItem("products")),r=0;r<i.length;r++)if(i[r].ProductID==n){i[r].QTY=Number(t);Number(i[r].QTY)<=0&&(event.target.value=1,i[r].QTY=1);Number(i[r].AvailableQTY)<Number(t)&&(event.target.value=i[r].AvailableQTY,i[r].QTY=i[r].AvailableQTY);break}localStorage.setItem("products",JSON.stringify(i));UpdateCartPage();UpdateShoppingCartMenu()}catch(u){}}function TryParseInt(n,t){var i=t;return n!==null&&n.length>0&&(isNaN(n)||(i=parseInt(n))),i}function GetProductsInCartCount(){try{var n=JSON.parse(localStorage.getItem("products"));return n.length}catch(t){return 0}}function addWishlistsToCookies(n){var f,u,t,i,r;try{if(f=localStorage.getItem("WISHLIST"),f==undefined)t=[],t.push(n),r=JSON.stringify(t),localStorage.setItem("WISHLIST",r);else{for(u=JSON.parse(f),t=[],i=0;i<u.length;i++)u[i].ProductID==n.ProductID||t.push(u[i]);t.push(n);r=JSON.stringify(t);localStorage.setItem("WISHLIST",r)}$("#WishlistCount").text("Wishlist ("+GetWISHLISTCount()+")")}catch(e){}}function AddWISHLIST(n){try{var t=localStorage.getItem("WISHLIST");$.ajax({url:"/Checkout/AddProductToWichList",type:"POST",data:{productID:n},success:function(n){var t=JSON.parse(n);addWishlistsToCookies(t);$.notify(" الى قائمة المفضلة<b>"+t.ProductName+"<\/b> تم إضافة ","success")},error:function(){}})}catch(i){}}function GetWISHLISTCount(){var n,t;try{return n=localStorage.getItem("WISHLIST"),n==undefined?0:(t=JSON.parse(n),t.length)}catch(i){}}function LoadWishListpage(){var n,t;try{for(n=JSON.parse(localStorage.getItem("WISHLIST")),$("#Cartbody").html(""),n.length==0&&$("#Cartbody").html('<tr><td style="text-align:center;"colspan="4"><span><br><br><br><br><br><br> Your Wishlist Is Empty<br><br><br><br><br><br><br><\/span><\/td><\/tr>'),t=0;t<n.length;t++)document.getElementById("Cartbody").innerHTML+=" <tr> <td class='product-in-table'><a href='/Product/"+n[t].ProductLink+"/'/><img class='img-responsive' src='/Proimg/X1/"+n[t].ImageLink+"' alt=''><\/a><div class='product-it-in'><a class='HoverLink' href='/Product/"+n[t].ProductLink+"/'/><h3>"+n[t].ProductName+"<\/h3><\/a><\/div><\/td><td><button type='button'  onclick='DeleteWishListroduct(\""+n[t].ProductID+"\")' class='close'><span>&times;<\/span><span class='sr-only'>Close<\/span><\/button><\/td><\/tr>";$("#WishlistCount").text("Wishlist ("+GetWISHLISTCount()+")")}catch(i){}}function DeleteWishListroduct(n){var r,i,u,t;try{if(r=localStorage.getItem("WISHLIST"),r==undefined)return;for(i=JSON.parse(r),u=[],t=0;t<i.length;t++)i[t].ProductID==n||u.push(i[t]);localStorage.setItem("WISHLIST",JSON.stringify(u));LoadWishListpage()}catch(f){}}function init_map(){var n={zoom:14,center:new google.maps.LatLng(32.015609,35.867467),mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("gmap_canvas"),n);marker=new google.maps.Marker({map:map,position:new google.maps.LatLng(32.015609,35.867467)});infowindow=new google.maps.InfoWindow({content:"<b>Mikroelectron<\/b><br/>الاردن - عمان<br/> شارع الجامعة الاردنية <br/> طلوع نيفين محمع خليفة طابق 3"});google.maps.event.addListener(marker,"click",function(){infowindow.open(map,marker)});infowindow.open(map,marker)}function clickedd(n){$("#basicModal").modal("show");$("#modalImage").attr("src",n)}function ProductPageInit(){$(".flexslider").flexslider({animation:"slide",controlNav:"thumbnails"});OwlCarousel.initOwlCarousel()}function CheckOutPageLoaded(){$("#orderform").bind("keypress",function(n){if(n.keyCode==13)return!1});$(".panel").on("show.bs.collapse",function(n){n.currentTarget.id=="1_shipping"||n.currentTarget.id=="2_shipping"?($("#shopping").html("0.00"),UpdateCartPage()):n.currentTarget.id=="3_shipping"?($("#east").trigger("change"),$("#west").trigger("change")):n.currentTarget.id=="4_shipping"&&$("#selectedCity").trigger("change")});$("#east").change(function(){$("#east").is(":checked")==!0&&($("#shopping").html(Number($("#EastAmmanCost").val()).toFixed(2)),UpdateCartPage())});$("#west").change(function(){$("#west").is(":checked")==!0&&($("#shopping").html(Number($("#WestAmmanCost").val()).toFixed(2)),UpdateCartPage())});$("#selectedCity").change(function(){var n=$("#selectedCity option:selected").val();$("#shopping").html(Number(n).toFixed(2));$("#selectedCountryName").val($("#selectedCity option:selected").text());UpdateCartPage()});var n="";$('button[type="submit"]').click(function(t){n=t.target.value});$("#orderform").submit(function(){if(!$(this).valid())return!1;if($("#products").val(localStorage.getItem("products")),GetProductsInCartCount()<=0)return $.notify("سلة المشتريات فارغة","error"),!1;var t=n;if(n="",t=="center")return document.getElementById("overlay").style.display="block",!0;if(t=="univ"){try{if($("#SUniv option:selected").val()==-1)return $.notify("الرجاء تحديد الجامعة","error"),!1;document.getElementById("overlay").style.display="block"}catch(i){alert(i.message)}return!0}return t=="amman"?$("#east").is(":checked")||$("#west").is(":checked")?$("#AmmanAddess").val().length<=0?($.notify("الرجاء ادخال العنوان بالتفصيل","error"),!1):(document.getElementById("overlay").style.display="block",!0):($.notify("الرجاء تحديد مكان الشحن","error"),!1):t=="jordan"?$("#selectedCity option:selected").val()==0?($.notify("الرجاء تحديد المحافظة","error"),!1):$("#JordanAddress").val().length<=0?($.notify("الرجاء ادخال العنوان بالتفصيل","error"),!1):(document.getElementById("overlay").style.display="block",!0):!1});UpdateCartPage();$("#Discount").change(function(){DiscountChanged()});$("#Discount").keyup(function(){DiscountChanged()});$("#Percentage").change(function(){PercentDiscountChanged()});$("#Percentage").keyup(function(){PercentDiscountChanged()})}function DiscountChanged(){discount=Number($("#Discount").val()).toFixed(2);IsPercentage=0;UpdateCartPage()}function PercentDiscountChanged(){Percentagediscount=Number($("#Percentage").val()).toFixed(2);IsPercentage=1;UpdateCartPage()}function updateparameter(n,t){var i=updateQueryStringParameter(window.location.href,n,t);n!="page"&&(i=updateQueryStringParameter(i,"page","1"));window.location.href=i}function updateQueryStringParameter(n,t,i){var r=new RegExp("([?&])"+t+"=.*?(&|$)","i"),u=n.indexOf("?")!==-1?"&":"?";return n.match(r)?n.replace(r,"$1"+t+"="+i+"$2"):n+u+t+"="+i}var App=function(){function n(){jQuery(".carousel").carousel({interval:15e3,pause:"hover"});jQuery(".tooltips").tooltip();jQuery(".tooltips-show").tooltip("show");jQuery(".tooltips-hide").tooltip("hide");jQuery(".tooltips-toggle").tooltip("toggle");jQuery(".tooltips-destroy").tooltip("destroy");jQuery(".popovers").popover();jQuery(".popovers-show").popover("show");jQuery(".popovers-hide").popover("hide");jQuery(".popovers-toggle").popover("toggle");jQuery(".popovers-destroy").popover("destroy")}function t(){jQuery(".search-button").click(function(){jQuery(".search-open").slideDown()});jQuery(".search-close").click(function(){jQuery(".search-open").slideUp()});jQuery(window).scroll(function(){jQuery(this).scrollTop()>1&&jQuery(".search-open").fadeOut("fast")})}function i(){jQuery(".list-toggle").on("click",function(){jQuery(this).toggleClass("active")})}function r(){jQuery(".boxed-layout-btn").click(function(){jQuery(this).addClass("active-switcher-btn");jQuery(".wide-layout-btn").removeClass("active-switcher-btn");jQuery("body").addClass("boxed-layout container")});jQuery(".wide-layout-btn").click(function(){jQuery(this).addClass("active-switcher-btn");jQuery(".boxed-layout-btn").removeClass("active-switcher-btn");jQuery("body").removeClass("boxed-layout container")})}function u(){jQuery(window).scroll(function(){jQuery(window).scrollTop()>100?jQuery(".header-fixed .header-static").addClass("header-fixed-shrink"):jQuery(".header-fixed .header-static").removeClass("header-fixed-shrink")})}function f(){$(document).on("click",".mega-menu .dropdown-menu",function(n){n.stopPropagation()})}function e(){var n=!0;$(document).mouseleave(function(t){t.clientY<0&&n===!0&&($(".g-popup-wrapper").show(),$(".g-popup-wrapper").is(":visible")&&$("body").addClass("g-blur"))});$(".g-popup__close").on("click",function(){$(".g-popup-wrapper").hide();$("body").removeClass("g-blur");n=!1})}return{init:function(){n();t();i();r();u();f();e()},initScrollBar:function(){jQuery(".mCustomScrollbar").mCustomScrollbar({theme:"minimal",scrollInertia:300,scrollEasing:"linear"})},initCounter:function(){jQuery(".counter").counterUp({delay:10,time:1e3})},initParallaxBg:function(){jQuery(".parallaxBg").parallax("50%",.2);jQuery(".parallaxBg1").parallax("50%",.4)}}}();!function(n){var t;jQuery&&(t=n(jQuery));"function"==typeof define&&define.amd&&define("notify",function(){return t||n(jQuery)})}(function(n){var t={},r={},u=function(t){return"string"==n.type(t)&&(t={message:t}),arguments[1]&&(t=n.extend(t,"string"==n.type(arguments[1])?{status:arguments[1]}:arguments[1])),new i(t).show()},i=function(u){this.options=n.extend({},i.defaults,u);this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random());this.element=n(['<div class="alert notify-message">','<button type="button" class="close" aria-hidden="true">&times;<\/button>',"<div>"+this.options.message+"<\/div>","<\/div>"].join("")).data("notifyMessage",this);"error"==this.options.status&&(this.options.status="danger");this.element.addClass("alert-"+this.options.status);this.currentstatus=this.options.status;r[this.uuid]=this;t[this.options.pos]||(t[this.options.pos]=n('<div class="notify notify-'+this.options.pos+'"><\/div>').appendTo("body").on("click",".notify-message",function(){n(this).data("notifyMessage").close()}))};return n.extend(i.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",show:function(){var n,i;if(!this.element.is(":visible"))return n=this,t[this.options.pos].css("zIndex",this.options.zIndex).show().prepend(this.element),i=parseInt(this.element.css("margin-bottom"),10),this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":i},function(){if(n.options.timeout){var t=function(){n.close()};n.timeout=setTimeout(t,n.options.timeout);n.element.hover(function(){clearTimeout(n.timeout)},function(){n.timeout=setTimeout(t,n.options.timeout)})}}),this},close:function(n){var i=this,u=function(){i.element.remove();t[i.options.pos].children().length||t[i.options.pos].hide();i.options.onClose.apply(i,[]);delete r[i.uuid]};this.timeout&&clearTimeout(this.timeout);n?u():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){u()})}}),i.defaults={message:"",status:"default",timeout:2e3,pos:"right",zIndex:10400,onClose:function(){}},n.notify=u});var discount=0,Percentagediscount=0,IsPercentage=0;$("#search").autocomplete({minLength:3,delay:500,source:function(){$("#search").addClass("loading");$.ajax({url:"/Home/autoComplete",data:{term:$("#search").val().trim()},success:function(n){$("#search").removeClass("loading");$("#divResult").html(n);$("#divResult").show()},error:function(){$("#search").removeClass("loading")}})}});$("body").click(function(){$("#divResult").hide()});$("#divResult").on("click",function(n){n.stopPropagation()});$("#searchform").submit(function(){$(this).find("input:text").each(function(){$(this).val($.trim($(this).val()))})});!function(n,t){"function"==typeof define&&define.amd?define(function(){return t(n)}):"object"==typeof exports?module.exports=t:n.echo=t(n)}(this,function(n){"use strict";var r,u,o,s,f,t={},e=function(){},h=function(n){return null===n.offsetParent},c=function(n,t){if(h(n))return!1;var i=n.getBoundingClientRect();return i.right>=t.l&&i.bottom>=t.t&&i.left<=t.r&&i.top<=t.b},i=function(){(s||!u)&&(clearTimeout(u),u=setTimeout(function(){t.render();u=null},o))};return t.init=function(u){u=u||{};var c=u.offset||0,l=u.offsetVertical||c,a=u.offsetHorizontal||c,h=function(n,t){return parseInt(n||t,10)};r={t:h(u.offsetTop,l),b:h(u.offsetBottom,l),l:h(u.offsetLeft,a),r:h(u.offsetRight,a)};o=h(u.throttle,250);s=u.debounce!==!1;f=!!u.unload;e=u.callback||e;t.render();document.addEventListener?(n.addEventListener("scroll",i,!1),n.addEventListener("load",i,!1)):(n.attachEvent("onscroll",i),n.attachEvent("onload",i))},t.render=function(){for(var u,i,s=document.querySelectorAll("img[data-echo], [data-echo-background]"),h=s.length,l={l:0-r.l,t:0-r.t,b:(n.innerHeight||document.documentElement.clientHeight)+r.b,r:(n.innerWidth||document.documentElement.clientWidth)+r.r},o=0;h>o;o++)i=s[o],c(i,l)?(f&&i.setAttribute("data-echo-placeholder",i.src),null!==i.getAttribute("data-echo-background")?i.style.backgroundImage="url("+i.getAttribute("data-echo-background")+")":i.src=i.getAttribute("data-echo"),f||(i.removeAttribute("data-echo"),i.removeAttribute("data-echo-background")),e(i,"load")):f&&(u=i.getAttribute("data-echo-placeholder"))&&(null!==i.getAttribute("data-echo-background")?i.style.backgroundImage="url("+u+")":i.src=u,i.removeAttribute("data-echo-placeholder"),e(i,"unload"));h||t.detach()},t.detach=function(){document.removeEventListener?n.removeEventListener("scroll",i):n.detachEvent("onscroll",i);clearTimeout(u)},t})