var tps17 = {
	saveDesignClick: function() {
		$('.product-footer').prop('disabled', true);
		var check_validate = false;
	    if ($("#tshirtecommerce-designer").length > 0) {
	        var iframe = document.getElementById("tshirtecommerce-designer");
	        var product = app.admin.product_detail();
	        check_validate = iframe.contentWindow.productInfo2(product);
	    }

	    //if (check_validate == true) $('#submit').click();
	    $('#submit').click();
		$('.product-footer').prop('disabled', false);
	}
};

// since version 2.2.3
$(document).ready(function() {
	if (jQuery('#form_id_product').length && $('.product-footer input#submit.save').length) {
		$('.product-footer input#submit.save, .product-footer button.js-btn-save[type="submit"], .product-footer #product_form_save_go_to_catalog_btn,.product-footer .go-catalog.js-btn-save, #product_form_save_new_btn, .product-footer .new-product.js-btn-save').bind('click', function() {
			var valid_submit = false;

			if ($("#tshirtecommerce-designer").length > 0) {
		        var iframe = document.getElementById("tshirtecommerce-designer");
		        var product = app.admin.product_detail();
		        valid_submit = iframe.contentWindow.productInfo2(product);
		    } else {
		    	valid_submit = true;
		    }

			return valid_submit;
		});
	}

	return true;
});
