jQuery(document).ready(function() {
	design.platform = 'wordpress';
	jQuery.ajax({
		url: siteURL+'platform.php',
		dataType: 'text',
		type: 'get',
		success: function(res) {
			design.platform =res;
			design.products.inicategory();
		}
	});
});

design.products.inicategory = function() {
	var cateurl = baseURL + "ajax.php?type=categories";
	if(typeof design.platform != 'undefined' && design.platform == "opencart")
	{
		var cateurl = siteURL.replace('/tshirtecommerce', '') + "index.php?route=tshirtecommerce/designer/categories";
	}
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: cateurl,
    }).done(function(data) {
        if (typeof data.categories != 'undefined' && data.categories != '') {
            var html = '<select data-level="1" id="parent-categories-1" class="form-control input-sm" onchange="design.products.changeCategory(this)"><option value="0"> ' + lang.designer.category + ' </option>';
            for (i = 0; i < data.categories.length; i++) {
                html = html + '<option value="' + data.categories[i].id + '">' + data.categories[i].title + '</option>';
            }
            if (jQuery('#list-categories').hasClass('mobile')) html = '<div class="col-xs-6">' + html + '</div>';
            else html = '<div class="col-xs-4 col-md-3">' + html + '</div>';
            jQuery('#list-categories').html(html);
        }
    });
}