var DORCATEGORY = {
	init:function(){
		window.addEventListener('load', function (){
		    DORCATEGORY.AjaxLoadData();
		});
	},
	ReloadProcess:function(){
		var html = "";
		html += '<div class="graph__preloader">';
	        html += '<div class="js-preloader preloader">';
	          html += '<b class="preloader__bar -bar1"></b>';
	          html += '<b class="preloader__bar -bar2"></b>';
	          html += '<b class="preloader__bar -bar3"></b>';
	          html += '<b class="preloader__bar -bar4"></b>';
	          html += '<b class="preloader__bar -bar5"></b>';
	        html += '</div>';
	    html += '</div>';
	    return html;
	},
	
	AjaxLoadData:function(){
		var checkAjax = jQuery(".tab_category_container").attr("data-ajaxload");
		var processHtml = DORCATEGORY.ReloadProcess();
		if(typeof checkAjax == "undefined") return false;
		
		jQuery(".tab_category_container").css("min-height",365);
		jQuery(".tab_category_container .graph__preloader").remove();
		jQuery(".tab_category_container").append(processHtml);
		var urlAjax = jQuery(".tab_category_container").attr("data-ajaxurl");
		var params = {}
		jQuery.ajax({
            url: urlAjax,
            data:params,
            type:"POST",
            success:function(data){
            	setTimeout(function(){
            		var results = JSON.parse(data);
	            	jQuery(".tab_category_container .graph__preloader").remove();
	            	jQuery(".tab_category_container").html(results);
	            	jQuery(".tab_category_container").css("min-height","auto");
					if(typeof DORTHEME != "undefined" && typeof DORTHEME.ToolTipBootstrap == "function"){
						DORTHEME.ToolTipBootstrap();
					}
					
					if(typeof DORTHEME.DorQuantity != "undefined" && typeof DORTHEME.DorQuantity == "function"){
	            		//DORTHEME.DorQuantity();
	            	}
					if(typeof DORTHEME != "undefined" && typeof DORTHEME.LazyLoad != "undefined" && typeof DORTHEME.LazyLoad == "function"){
	            		DORTHEME.LazyLoad();
	            	}
            	},300);
                return false;
            }
        });
	}
}
jQuery(document).ready(function(){
	DORCATEGORY.init();
});