<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$(document).ready(function(){
     // alert(window.innerWidth);
    $(window).bind('scroll', function() {

        if($('.box-vip').length&gt;0){
            var topouner = $('.box-vip').position();
            var topDetail = $('#detail').position();
            var topnewproduct = $('#product-new-bottom').position();
            console.log($(this).scrollTop()+'======'+window.innerHeight+'======'+window.innerHeight);
            if($(this).scrollTop()&gt;=(topnewproduct.top-window.innerHeight)){
                $(".col-left").removeClass('showfix');
                $("#navigation").fadeIn() ;
            }else if($(this).scrollTop()&lt;=(topDetail.top)){
                //console.log($(this).scrollTop()+'======'+topDetail.top);
                $("#navigation").fadeIn() ;
                $(".col-left").removeClass('showfix');
            }else if($(this).scrollTop()&gt;(topouner.top)){
                $(".col-left").addClass('showfix');
                $("#navigation").hide();
            }else if(parseInt($(this).scrollTop())&gt;1770){ 
              
            }else{
                $(".col-left").removeClass('showfix');
                $("#navigation").fadeIn() ;
            }
        }
   
    });
    // Product Detail
   if($('.box-vip').length&gt;0){
        CloudZoom.quickStart();
        $('#slider1').Thumbelina({
            $bwdBut: $('#slider1 .left'),
            $fwdBut: $('#slider1 .right')
        });
        var thumbW = $('.thumbelina li').size() * $('.thumbelina li').width();
        $('.thumbelina li').width(thumbW);
    } 

    if ($(".formvalidate").length &gt; 0)
      //  $(".formvalidate").validate();
    var sync1 = $("#sync1");
    var sync2 = $("#sync2");
    sync1.owlCarousel({
        items : 1,
        singleItem : true,
        slideSpeed : 1000,
        navigation : false,
        pagination : true,
        afterAction : syncPosition,
        responsiveRefreshRate : 200,
    });

    sync2.owlCarousel({
        items : 4,
        itemsDesktop      : [1199,4],
        itemsDesktopSmall     : [979,4],
        itemsTablet       : [768,4],
        itemsMobile       : [479,4],
        navigation:false,
        pagination:false,
        responsiveRefreshRate : 100,
        afterInit : function(el){
            el.find(".owl-item").eq(0).addClass("synced");
        }
    });

    function syncPosition(el){
        var current = this.currentItem;
        $("#sync2")
          .find(".owl-item")
          .removeClass("synced")
          .eq(current)
          .addClass("synced")
        if($("#sync2").data("owlCarousel") !== undefined){
          center(current)
        }
    }

    $("#sync2").on("click", ".owl-item", function(e){
        e.preventDefault();
        var number = $(this).data("owlItem");
        sync1.trigger("owl.goTo",number);
    });

    function center(number){
        var sync2visible = sync2.data("owlCarousel").owl.visibleItems;
        var num = number;
        var found = false;
        for(var i in sync2visible){
          if(num === sync2visible[i]){
            var found = true;
          }
        }

        if(found===false){
          if(num&gt;sync2visible[sync2visible.length-1]){
            sync2.trigger("owl.goTo", num - sync2visible.length+2)
          }else{
            if(num - 1 === -1){
              num = 0;
            }
            sync2.trigger("owl.goTo", num);
          }
        } else if(num === sync2visible[sync2visible.length-1]){
          sync2.trigger("owl.goTo", sync2visible[1])
        } else if(num === sync2visible[0]){
          sync2.trigger("owl.goTo", num-1)
        }
    }

    var listBannerFooter = $(".list-banner-footer");
    listBannerFooter.owlCarousel({
        items : 6,
        responsive:{
            0:{
                items:2
            },
            600:{
                items:3
            },
            768:{
                items:4
            },
            1000:{
                items:6
            }
        },
        lazyLoad:true,
        nav:true,
            //rtl:true,
            loop: true,
            margin: 5,
            autoplay: true,
            autoplayTimeout: 4000,
            autoplayHoverPause: true,
            lazyLoad:true,
            dots: false,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });
    var productSlide = $(".product-slide");
    productSlide.owlCarousel({
        items : 6,
        responsive:{
            0:{
                items:4
            },
            600:{
                items:5
            },
            768:{
                items:5
            },
            1000:{
                items:5
            }
        },
       
        lazyLoad:true,
        dots: false,
        nav:true,
        slideSpeed : 2000,
        autoplayTimeout:3000,
        
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

    var productSlide2 = $(".product-slide2");
    productSlide2.owlCarousel({
        items : 6,
        responsive:{
            0:{
                items:4
            },
            600:{
                items:5
            },
            768:{
                items:5
            },
            1000:{
                items:5
            }
        },
       
        lazyLoad:true,
        dots: false,
        nav:true,
        slideSpeed : 2000,
        autoplayTimeout:3000,
        navigation : true,
        pagination : false,
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

    var productSlide3 = $(".product-slide3.owl-carousel ");
    productSlide3.owlCarousel({
        items :1,
         responsive:{
            0:{
                items:1
            },
            600:{
                items:1
            },
            768:{
                items:1
            },
            1000:{
                items:1
            }
        },
       
        lazyLoad:true,
        dots: false,
       
       slideSpeed : 2000,
        autoplayTimeout:3000,
        navigation : true,
        pagination : false,
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

    var partner = $(".partner");
    partner.owlCarousel({
        items : 6,
        itemsDesktop      : [1199,6],
        itemsDesktopSmall     : [979,6],
        itemsTablet       : [768,4],
        itemsMobile       : [479,2],
       slideSpeed : 2000,
        autoplayTimeout:3000,
        navigation : false,
        pagination : false,
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

    var productHotCate = $(".product-hot-cate");
    productHotCate.owlCarousel({
        items : 7,
        responsive:{
            0:{
                items:2
            },
            600:{
                items:3
            },
            768:{
                items:4
            },
            1000:{
                items:7
            }
        },
       
        lazyLoad:true,
        dots: false,
        slideSpeed : 2000,
        autoplayTimeout:3000,
        navigation : true,
        pagination : false,
        autoPlay: true,
        loop: true,
        lazyLoad: true,
        responsiveRefreshRate : 200,
         autoplayTimeout:1000,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

        var owl = $('#product-vip .owl-carousel,#product-hot .owl-carousel');
          owl.owlCarousel({
            items: 5,
            responsive:{
                0:{
                    items:1
                },
                600:{
                    items:3
                },
                768:{
                    items:4
                },
                1000:{
                    items:5
                }
            },
            nav:true,
            //rtl:true,
            loop: true,
            margin: 5,
            autoplay: true,
            autoplayTimeout: 2000,
            autoplayHoverPause: true,
            lazyLoad:true,
            dots: false,
            navText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
          });
          // $('.play').on('click', function() {
          //   owl.trigger('play.owl.autoplay', [1000])
          // })
          // $('.stop').on('click', function() {
          //   owl.trigger('stop.owl.autoplay')
          // })


    // var productHot = $("#product-vip .product-hot,#product-hot .product-hot");
    //     productHot.owlCarousel({
    //         items:5,
    //         lazyLoad:true,
    //         autoPlay: true,
    //         autolayTimeout:500,
    //         loop:true,
    //         margin:10,
    //         navText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    //     });

    // productHot.owlCarousel({
    //     items : 5,
    //     itemsDesktop      : [1199,5],
    //     itemsDesktopSmall     : [979,5],
    //     itemsTablet       : [768,4],
    //     itemsMobile       : [479,3],
    //    slideSpeed : 2000,
    //     autoplayTimeout:3000,
    //     navigation : true,
    //     pagination : false,
    //     autoPlay: true,
    //     loop: true,
    //     lazyLoad: true,
    //     responsiveRefreshRate : 200,
    //     autolayTimeout:500,
    //     navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    // });




    var provider_specical = $("#provider_specical.owl-carousel");
    provider_specical.owlCarousel({
        items : 1,
        itemsDesktop      : [1199,1],
        itemsDesktopSmall     : [979,1],
        itemsTablet       : [768,1],
        itemsMobile       : [479,1],
        nav:true,
            //rtl:true,
            loop: true,
            margin: 5,
            autoplay: true,
            autoplayTimeout: 3000,
            autoplayHoverPause: true,
            lazyLoad:true,
            dots: false,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });


    var bannerDTVip = $(".banner-slide-dt-vip.owl-carousel");
    bannerDTVip.owlCarousel({
         items : 4,
        itemsDesktop      : [1199,4],
        itemsDesktopSmall     : [979,4],
        itemsTablet       : [768,4],
        itemsMobile       : [479,2],
       slideSpeed : 2000,
        autoplayTimeout:3000,
        lazyLoad:true,
         dots: false,
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    }); 

    var bannerslide = $(".banner-slide.left.owl-carousel");
    bannerslide.owlCarousel({
        items : 1,
         responsive:{
            0:{
                items:1
            },
            600:{
                items:1
            },
            1000:{
                items:1
            }
        },
      
        loop: true,
        lazyLoad:true,
        slideSpeed : 1000,
        nav:true,
        dots: false,
        autoplay: true,
        autoplayTimeout: 12000,
        pagination : false,
        navText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });

    var bannerslide = $(".banner-slide.right.owl-carousel");
    bannerslide.owlCarousel({
          items : 1,
         responsive:{
            0:{
                items:1
            },
            600:{
                items:1
            },
            1000:{
                items:1
            }
        },
        loop: true,
        lazyLoad:true,
        slideSpeed : 1000,
        nav:true,
        dots: false,
        autoplay: true,
        autoplayTimeout: 12000,
        pagination : false,
        navText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });


    var bannerbig = $(".banner-big.owl-carousel");
    bannerbig.owlCarousel({
        items : 1,
        itemsDesktop      : [1199,1],
        itemsDesktopSmall     : [979,1],
        itemsTablet       : [768,1],
        itemsMobile       : [479,1],
        slideSpeed : 2000,
        autoplayTimeout:3000,
        lazyLoad:true,
        responsiveRefreshRate : 200,
        navigationText: ["&lt;i class='fa fa-chevron-left'&gt;&lt;/i&gt;", "&lt;i class='fa fa-chevron-right'&gt;&lt;/i&gt;"]
    });
    ResizeWindows();
    $('.list-type a').on('click', function(e) {
        e.preventDefault();
        $('.list-type a').removeClass('active')
        // if ($(this).hasClass('th-list')) {
        //     $.cookie("list_type", 1);
        //     $('a.th-list').addClass('active');
        //     $('.category-list-body ul').removeClass('th-large').addClass('th-list')
        // } else {
        //     $.cookie("list_type", 2);
        //     $('a.th-large').addClass('active');
        //     $('.category-list-body ul').removeClass('th-list').addClass('th-large')
        // }
    });

    var list_type = $.cookie("list_type");
    // if (1 == list_type) {
    //     $('.list-type a').removeClass('active');
    //     $('.list-type .th-list').addClass('active');
    //     $('.category-list-body').find('ul').removeClass('th-large').addClass('th-list');
    // } else {
    //     $('.list-type a').removeClass('active');
    //     $('.list-type .th-large').addClass('active');
    //     $('.category-list-body').find('ul').removeClass('th-list').addClass('th-large');
    // }
$('.category-list-body').find('ul').removeClass('th-list').addClass('th-list');
    if ($('#expired_date').length &gt; 0) {
        $('#expired_date').datepicker({});
    }
    if ($("#menu_home_root").length &gt; 0) 
        $("#menu_home_root").niceScroll("#menu_home_root_inner");
    if ($("#cate_sub").length &gt; 0) 
        $("#cate_sub").niceScroll("#cate_sub_inner");
    // if ($("img.lazy").length &gt; 0) {
    //     $("img.lazy").lazyload({
    //       effect : "fadeIn"
    //     });
    // }

    var menuHomeConfig= {
        rootDomEle: $("#menu_home_root_inner"),
        rootListDomEle: $("#menu_home_root_inner").find("li"),
        rootLength: 16,
        childDomEle: $("#menu_home_navigate"),
        rootSelected: 0,
        cacheList: [],
        autoInterval: null,
        leaveTimeout: null
    };

    function autoChangeMenu(){
        var key= (menuHomeConfig.rootSelected == 0 ? 0 : menuHomeConfig.rootDomEle.find(".selected").index() + 1);
        if(key &gt;= menuHomeConfig.rootLength) key = 0;
        var iData= menuHomeConfig.rootListDomEle.eq(key).attr("iData");
        changeMenu(iData);
        menuHomeConfig.rootSelected= iData;
        menuHomeConfig.rootListDomEle.removeClass("hover selected");
        menuHomeConfig.rootListDomEle.eq(key).addClass("selected");
    };

    function changeMenu(id){
        if(menuHomeConfig.rootSelected == id) return;
        var domEle= $("#menu_content_"+ id );
        domEle.removeClass("effects").css("display", "block");
        setTimeout(function(){ domEle.addClass("effects"); }, 100);
    }

    function menuHomeMouseLeave(){
        menuHomeConfig.rootListDomEle.removeClass("hover");
        menuHomeConfig.childDomEle.css("display", "none");
    }

    menuHomeConfig.autoInterval= setInterval(autoChangeMenu, 5000);

    menuHomeConfig.rootDomEle.hover(
        function(){ clearTimeout(menuHomeConfig.leaveTimeout); },
        function(){ menuHomeConfig.leaveTimeout= setTimeout(function(){ menuHomeMouseLeave(); }, 200); }
    );
    menuHomeConfig.childDomEle.hover(
            function(){ clearTimeout(menuHomeConfig.leaveTimeout); },
            function(){ menuHomeConfig.leaveTimeout= setTimeout(function(){ menuHomeMouseLeave(); }, 200); }
    );

    menuHomeConfig.rootDomEle.menuAim({
        activate: function(domEle){
            menuHomeConfig.rootListDomEle.removeClass("hover selected");
            $(domEle).addClass("hover selected");
            var iData= $(domEle).attr("iData");
            changeMenu(iData);
            menuHomeConfig.rootSelected= iData;
            if($(domEle).hasClass("empty")) menuHomeConfig.childDomEle.css("display", "none");
            else{
                menuHomeConfig.childDomEle.css("display", "block").find("li").css("display", "none");
                $("#menu_home_" + iData).css("display", "block");
            }
        },
        enter: function(domEle){ if($(domEle).hasClass("selected")) $(domEle).addClass("hover"); },
        exitMenu: function(){ return true; }
    });

    if ($(".news_slide").length &gt; 0) 
        $(".news_slide").niceScroll(".news_slide_ul");
    if ($("#news_slide1").length &gt; 0) 
        $("#news_slide1").niceScroll("#news_slide_ul1");
    if ($("#news_slide2").length &gt; 0) 
        $("#news_slide2").niceScroll("#news_slide_ul2");
    var w = $(window).width();
    var h = $(window).height();
    if ($('#loading').length)
        $('#loading').css({width: w, height: h});
    if($('.buy-item').length){ 
        $('.buy-item').on('click', function(e){
            e.preventDefault();
            var str_ids = $(this).attr('rel-id');
            var data = $(this).attr('reldata');
            if ('' === str_ids || '' === data) {
                alert('HÃ£y chá»n sáº£n pháº©m trÆ°á»›c khi liÃªn há»‡ nhÃ&nbsp; cung cáº¥p!'); return false;
            } else {
                $.ajax({
                    url: base_url + 'mua-hang.html',
                    type: "POST",
                    dataType: "json",
                    data : { id: str_ids,data: data},
                    beforeSend: function() {
                        $('#loading').show();
                        $('.notifi').hide();
                    },
                    success: function (data) {
                        $('#loading').hide();
                        if ('' != data.html) {
                            $('#contact-submit').removeAttr('disabled');
                            $('#contactModal').find('.md-list-pro').html(data.html);
                            $('#contactModal').modal('show');
                        }
                    },
                    error: function (errormessage) {
                        $('#loading').hide();
                        alert('CÃ³ lá»—i xáº£y !'); return false;
                    }
                });
            }
        });
    }
    if ($('.btn-contact').length) {
        $('.btn-contact').on('click', function(e){
            e.preventDefault();
            var str_ids = $(this).attr('rel-id');
            var data = $(this).attr('reldata');
            if ('' === str_ids || '' === data) {
                alert('HÃ£y chá»n sáº£n pháº©m trÆ°á»›c khi liÃªn há»‡ nhÃ&nbsp; cung cáº¥p!'); return false;
            } else {
                $.ajax({
                    url: base_url + 'mua-hang.html',
                    type: "POST",
                    dataType: "json",
                    data : { id: str_ids,data: data},
                    beforeSend: function() {
                        $('#loading').show();
                        $('.notifi').hide();
                    },
                    success: function (data) {
                        $('#loading').hide();
                        if ('' != data.html) {
                            $('#contact-submit').removeAttr('disabled');
                            $('#contactModal').find('.md-list-pro').html(data.html);
                            $('#contactModal').modal('show');
                        }
                    },
                    error: function (errormessage) {
                        $('#loading').hide();
                        alert('CÃ³ lá»—i xáº£y !'); return false;
                    }
                });
            }
            // var str_ids = [];
            // var str_ids_now = $('#product_ids').val();
            // if(str_ids_now!=''){ 
            //     str_ids.push(str_ids_now);
            // }
            // $('.product-input').each(function(index, item) {
            //     if($(item).is(':checked')) {
            //         str_ids.push($(item).val());
            //     }
            // });
            // $('#product_ids').val(str_ids.join(','));

            // if ('' === str_ids) {
            //     alert('HÃ£y chá»n sáº£n pháº©m trÆ°á»›c khi liÃªn há»‡ nhÃ&nbsp; cung cáº¥p!'); return false;
            // } else {
            //     var str_ids_all = $('#product_ids').val();
            //     $.ajax({
            //         url: base_url + 'product/getListChoose',
            //         type: "POST",
            //         dataType: "json",
            //         data : { str_ids: str_ids_all },
            //         beforeSend: function() {
            //             $('#loading').show();
            //             $('.notifi').hide();
            //         },
            //         success: function (data) {
            //             $('#loading').hide();
            //             if ('' != data.html) {
            //                 $('#contactModal').find('.md-list-pro').html(data.html);
            //                 $('#contactModal').modal('show');
            //             }
            //         },
            //         error: function (errormessage) {}
            //     });
            // }
        });
    }

    if ($('#contact_provider').length) {
        $('#contact_provider').submit(function(e) {
            e.preventDefault();
            $('.notifi').html('').hide();
            var fullname = $('#fullname').val()
            , phone = $('#phone').val()
            , email = $('#email').val()
            , address = $('#address').val()
            , description = $('#description').val();
            var str_ids_all = $('#product_ids').val();
            //if ('' == str_ids_all) {
             //   $('.notifi').html('HÃ£y chá»n sáº£n pháº©m trÆ°á»›c khi liÃªn há»‡ nhÃ&nbsp; cung cáº¥p!').css({color: 'red'}).show();
             //   setTimeout(function(){
              //      $('#contactModal').modal('hide');
              //  }, 2000);
              //  return false;
            //} else 
		if (''!=fullname &amp;&amp; ''!=phone &amp;&amp; ''!=email &amp;&amp; ''!=address &amp;&amp; ''!=description ) {
		        if (!isEmail(email)) {
		            $('.notifi').html('Äá»‹a chá»‰ email chÆ°a chÃ­nh xÃ¡c!').css({color: 'red'}).show();
		            return false;
		        } else {
                   
                    $.ajax({
                        //url: base_url + 'product/sendContact',
                        url: base_url + 'fajax/contactsupplier',
                        type: "POST",
                        dataType: "json",
                        data : $(this).serialize(),
                        beforeSend: function() {
                           $('#loading-form').show();
                            $('.notifi').hide();
                            $('#contact-submit').attr('disabled', 'disabled');
                        },
                        success: function (data) {
                            if (data.code == 5000) {
                                $('.notifi').html(data.msg).css({color: 'green'}).show();
                                $('#contact-submit').removeAttr('disabled');
                                $('#loading-form').hide();
                                // setTimeout(function(){
                                //     $('#contactModal').modal('hide');
                                //      window.location.reload();
                                // }, 1000);
                              
                            } return false ;
                        },
                        error: function (errormessage) {}
                    });
                }
            }else{$('.notifi').html('ChÆ°a nháº­p Ä‘á»§ thÃ´ng tin!').css({color: 'red'}).show();}
            return false;
        });
    }

    if ($('.md-list-pro').length) {
        $(document).on('click', '.md-list-pro .remove', function(e) {
            e.preventDefault();
            var pro_id = $(this).attr('data-proid');
            var str_ids_now = $('#product_ids').val();
                console.log(str_ids_now)
                console.log(pro_id)
            if ('' != str_ids_now) {
                var tmp = ',' + pro_id;
                str_ids_now = str_ids_now.replace(tmp, '');
                console.log(str_ids_now)
                $('#product_ids').val(str_ids_now);
                
            }
            $(this).parent().parent().remove();
            $.ajax({
                    url: base_url + 'fajax/removecontact',
                    type: "POST",
                    dataType: "json",
                    data :{str_ids_now:pro_id},
                    beforeSend: function() {
                       $('#loading-form').show();
                        $('.notifi').hide();
                        $('#contact-submit').attr('disabled', 'disabled');
                    },
                    success: function (data) {
                        if (data.code == 5000) {
                            $('.notifi').html(data.msg).css({color: 'green'}).show();
                            
                            $('#loading-form').hide();
                            //$('#product_ids').attr(data.id_booking);
                            console.log('data.id_booking.length',data.id_booking);
                            if(parseInt(data.id_booking) == 1){
                                $('#contact-submit').removeAttr('disabled');
                            }
                            // setTimeout(function(){
                            //     $('#contactModal').modal('hide');
                            //      window.location.reload();
                            // }, 1000);
                          
                        } return false ;
                    },
                    error: function (errormessage) {}
                });
        });
    }
    if ($('.tinrao-body').length) {
        var page = 0;
        renderNeedBuy(page);
    }


    $(".single-select").select2({
        templateResult: formatState,
        templateSelection: formatState
        //data: isoCountries
    });

    if ($('#form-login').length) {
        $('#form-login').submit(function(){
            var t = $(this), email = $('#psignin_email').val(),
            password = $('#psignin_password').val(), captcha = $('#psignin_captcha').val();
            $('.notifi').removeClass('alert-success').addClass('alert-danger');
            if (email == '') {
                $('.notifi').html('ChÆ°a Ä‘iá»n tÃªn truy cáº­p').show();
                $('#psignin_email').focus();
                return false;
            } else if(password == '') {
                $('.notifi').html('ChÆ°a Ä‘iá»n máº­t kháº©u').show();
                $('#psignin_password').focus();
                return false;
            } else if(captcha == '') {
                $('.notifi').html('ChÆ°a Ä‘iá»n mÃ£ xÃ¡c nháº­n').show();
                $('#psignin_captcha').focus();
                return false;
            }
            if (email != '' &amp;&amp; password != '' &amp;&amp; captcha != '') {
                $.ajax({
                    url: base_url + 'authorize/ajaxLogin',
                    type: "POST",
                    dataType: "json",
                    data : t.serialize(),
                    beforeSend: function() {
                        $('#loading').show();
                        $('.notifi').hide();
                    },
                    success: function (data) {
                        $('#loading').hide();
                        if (data.flag) {
                            $('.notifi').removeClass('alert-danger').addClass('alert-success');
                            $('.notifi').html('ÄÄƒng nháº­p thÃ&nbsp;nh cÃ´ng!').show();
                            setTimeout(function() {
                                window.location.reload();
                            }, 300);
                        } else {
                            var error = '';
                            if (data.msg.length &gt; 0) {
                                $.each(data.msg, function (index, value) {
                                    error += value + '&lt;br/&gt;';
                                });
                            }
                            $('.notifi').removeClass('alert-success').addClass('alert-danger');
                            $('.notifi').html(error).show();
                        }
                    },
                    error: function (errormessage) {}
                });
            }
            return false;
        });
    }

    $('.post-pro a').on('click', function(e) {
        e.preventDefault();
        $('html,body').scrollTop(0);
        var link = $(this).attr('href');
        if (user_login) {
            window.location.href = link;
        } else {
            $('#login-modal').modal('show');
        }
    });

    $('.contact-us').on('click', function(e) {
        e.preventDefault();
        $('#contactUsModal').modal('show');
        $('.notifi').html('').hide();
    });

    if ($('#contact_us').length) {
        $('#contact_us').submit(function(e) {
            e.preventDefault();
            $('.notifi').html('').hide();
            var t = $(this)
            , fullname = $('#fullname').val()
            , phone = $('#phone').val()
            , email = $('#email').val()
            , address = $('#address').val()
            , captcha = $('#captcha').val()
            , description = $('#description').val();
            if (''!=fullname &amp;&amp; ''!=phone &amp;&amp; ''!=email &amp;&amp; ''!=address &amp;&amp; ''!=description &amp;&amp; ''!=captcha ) {
                if (!isEmail(email)) {
                    $('.notifi').html('Äá»‹a chá»‰ email chÆ°a chÃ­nh xÃ¡c!').css({color: 'red'}).show();
                    return false;
                } else {
                    $.ajax({
                        url: base_url + 'home/ajaxContactus',
                        type: "POST",
                        dataType: "json",
                        data : t.serialize(),
                        beforeSend: function() {
                            $('.loading-form').show();
                            $('.notifi').hide();
                            $('#contactus-submit').attr('disabled', 'disabled');
                        },
                        success: function (data) {
                            if (data.flag) {
                                $('.notifi').html('Cáº£m Æ¡n báº¡n Ä‘Ã£ liÃªn há»‡!').css({color: 'green'}).show();
                                setTimeout(function(){
                                    $('#contactUsModal').modal('hide');
                                }, 500);
                            } else {
                                var error = '';
                                if (data.msg.length &gt; 0) {
                                    $.each(data.msg, function (index, value) {
                                        error += value + '&lt;br/&gt;';
                                    });
                                }
                                $('.notifi').removeClass('alert-success').addClass('alert-danger');
                                $('.notifi').html(error).show();
                            }
                            $('.loading-form').hide();
                            $('#contactus-submit').removeAttr('disabled');
                        },
                        error: function (errormessage) {}
                    });
                }
            }
        });
    }
  if ($('#contact_gopy').length) {
        $('#contact_gopy').submit(function(e) {
            e.preventDefault();
            $('.notifi_gopy').html('').hide();
            var t = $(this)
            , fullname = $('#fullname_gopy').val()
            , phone = $('#phone_gopy').val()
            , email = $('#email_gopy').val()
            , address = $('#address_gopy').val()
            , captcha = $('#captcha_gopy').val()
            , description = $('#description_gopy').val();
            if (''!=fullname &amp;&amp; ''!=phone &amp;&amp; ''!=email &amp;&amp;  ''!=description ) {
                if (!isEmail(email)) {
                    $('.notifi_gopy').html('Äá»‹a chá»‰ email chÆ°a chÃ­nh xÃ¡c!').css({color: 'red'}).show();
                    return false;
                } else {
                    $.ajax({
                        url: base_url + 'home/ajaxGopy',
                        type: "POST",
                        dataType: "json",
                        data : t.serialize(),
                        beforeSend: function() {
                            $('.loading-form').show();
                            $('.notifi_gopy').hide();
                            $('#gopy-submit').attr('disabled', 'disabled');
                        },
                        success: function (data) {
                            if (data.flag) {
                                $('.notifi_gopy').html('Cáº£m Æ¡n báº¡n Ä‘Ã£ gÃ³p Ã½!').css({color: 'green'}).show();
                                setTimeout(function(){
                                    $('#contactGopyModal').modal('hide');
                                }, 500);
                            } else {
                                var error = '';
                                if (data.msg.length &gt; 0) {
                                    $.each(data.msg, function (index, value) {
                                        error += value + '&lt;br/&gt;';
                                    });
                                }
                                $('.notifi_gopy').removeClass('alert-success').addClass('alert-danger');
                                $('.notifi_gopy').html(error).show();
                            }
                            $('.loading-form').hide();
                            $('#gopy-submit').removeAttr('disabled');
                        },
                        error: function (errormessage) {}
                    });
                }
            }else{ 
                  $('.notifi_gopy').html('Vui lÃ²ng nháº­p Ä‘áº§y Ä‘á»§ thÃ´ng tin gÃ³p Ã½!').css({color: 'red'}).show();
                    return false;
            }
        });
    }
    $('.plogin').on('click', function(e) {
        e.preventDefault();
        $(this).hide(); alert('xxxx');
        $('#form-login').show();
        $('#form-forgot').hide();
        $('.box-head h3').html('ÄÄƒng nháº­p');
        $('#login-modal').find('.notifi').html('').hide();
    });
/*
*
* QUEN MAT KHAU
*
**/
    $('.pforgot').on('click', function(e) {
        e.preventDefault();
        $(this).hide();
        $('#form-forgot').show();
        $('#form-login').hide();
        $('.box-head h3').html('QuÃªn máº­t kháº©u');
        $('#login-modal').find('.notifi').html('').hide();
    });

    if ($('#form-forgot').length) {
        $('#form-forgot').submit(function(){
            var t = $(this), email = $('#forgot_email').val(),
            password = $('#psignin_password').val(), captcha = $('#psignin_captcha').val();
            $('.notifi').removeClass('alert-success').addClass('alert-danger');
            if (email == '') {
                $('.notifi').html('ChÆ°a Ä‘iá»n Ä‘á»‹a chá»‰ email').show();
                $('#forgot_email').focus();
                return false;
            } 
            if (email != '') {
                if (!isEmail(email)) {
                    $('.notifi').html('Äá»‹a chá»‰ email chÆ°a chÃ­nh xÃ¡c!').css({color: 'red'}).show();
                    return false;
                } else {
                    $.ajax({
                        url: base_url + 'authorize/ajaxForgotpassword',
                        type: "POST",
                        dataType: "json",
                        data : t.serialize(),
                        beforeSend: function() {
                            $('#loading').show();
                            $('.notifi').hide();
                        },
                        success: function (data) {
                            $('#loading').hide();
                            if (data.flag) {
                                $('.notifi').removeClass('alert-danger').addClass('alert-success');
                                $('.notifi').html(data.msg[0]).show();
                                setTimeout(function() {
                                    window.location.reload();
                                }, 300);
                            } else {
                                var error = '';
                                if (data.msg.length &gt; 0) {
                                    $.each(data.msg, function (index, value) {
                                        error += value + '&lt;br/&gt;';
                                    });
                                }
                                $('.notifi').removeClass('alert-success').addClass('alert-danger');
                                $('.notifi').html(error).show();
                            }
                        },
                        error: function (errormessage) {}
                    });
                }
            }
            return false;
        });
    }
/*
*
* SEARCH 
*
**/
    $('#tabs-search a[data-toggle=tab]').on('click', function() {
        var id = $(this).attr('data-id');
        $.cookie('tab-search-index', id);
    });

    var tab_search_index = $.cookie('tab-search-index') ? $.cookie('tab-search-index') : 1;
    $('#tabs-search').find('.nav').find('li').removeClass('active');
    $('#tabs-search').find('.tab-pane').removeClass('active');
    $('#tabs-search .nav-item'+tab_search_index).addClass('active');
    $('#tabs-search .tab-item'+tab_search_index).addClass('active');

    $('.box-cate .title-text i').on('click', function() {
        var t = $(this);
        if (!t.hasClass('on')) {
            t.addClass('on');
            $('.box-cate ul').show();
        } else {
            t.removeClass('on');
            $('.box-cate ul').hide();
        }
    });
    $('#navigation .category-title h2').on('click', function() { $('#navigation div.nv_tablet').show();
        var t = $(this);
        if (!t.hasClass('on')) {
            t.addClass('on');
            $('#navigation ul.nv_mobile').show();
            $('#navigation div.nv_tablet').show();
        } else {
            t.removeClass('on');
            $('#navigation ul.nv_mobile').hide();
            $('#navigation div.nv_tablet').hide();
        }
    });
    Response.action(function() {
        if ( Response.band(768) ) {  //&gt;=768
            $('.info-support').show();
        }
        else {  //&lt; 768
            $('.info-support').hide();
            $('#contact_us .notifi').before($('.info-site'));
            $('#contact_provider .notifi').before($('.md-list-pro'));
        }
    });
    
});

// select2
function formatState(state) {
    if (!state.id) {
        return state.text;
    }
    var $state = $(
        '&lt;span&gt;&lt;span class="flag-wrapper"&gt;&lt;i class="flag flag-icon-' + state.element.value.toLowerCase() + '"&gt;&lt;/i&gt;&lt;/span&gt;' + state.text + '&lt;/span&gt;'
    );
    return $state;
};

function renderNeedBuy(page) {
    $.ajax({
        url: base_url + 'buyer/ajaxNeedBuy',
        type: 'GET',
        dataType: "json",
        data : {'page': page},
        beforeSend: function() {
            $('#loading-needbuy').css('display', 'block');
        },
        success: function (data) {
            $('#loading-needbuy').hide();
            if (data) {
                $('.tinrao-body').find('tbody').html(data.arrList);
                $('#page-needbuy').html(data.link_pagination);
            }
        },
        error: function (errormessage) {}
    });
}

$(document).ready(function(){
    $(window).bind('scroll', function() {
        200 &lt;= $(this).scrollTop() ? $("#to_top").fadeIn() : $("#to_top").fadeOut();
        $(document).scroll(function(){
            if($(window).scrollTop() &gt; 150){
                $('.adsLeft, .adsRight').stop().animate({top:$(window).scrollTop()+20},1000);
            }
        });
    });
});

function ResizeWindows() {
    var Xwidth = $(window).width();
    if(Xwidth &lt;= 800){
        $('#menu').mmenu().on( "closed.mm", function() {
            $('#menu').removeAttr('style');
        });
        $('#mobileMenu').click(function(){
            $("#menu").trigger("open.mm").show();
        });
    }
}
function gopy(){
    $('#contactGopyModal').modal('show');
}
function replaceUrlParam(url, paramName, paramValue){
    if(paramValue == null)
        paramValue = '';
    var pattern = new RegExp('\\b('+paramName+'=).*?(&amp;|$)')
    if(url.search(pattern)&gt;=0){
        return url.replace(pattern,'$1' + paramValue + '$2');
    }
    return url + (url.indexOf('?')&gt;0 ? '&amp;' : '?') + paramName + '=' + paramValue 
}

function isEmail(email) {
  var __email = email || '';
  var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  if (!filter.test(__email)) {
    return false;
  } else {
    return true;
  }
}
$(window).on('resize', function() {
    ResizeWindows();
});

window.onorientationchange = ResizeWindows;
</pre></body></html>