/**
 * --------------------------------------------------------------------------------------------
 * VP Manufacturer Carousel - Joomla! Module for VirtueMart Store
 * --------------------------------------------------------------------------------------------
 * @package    VP Manufacturer Carousel
 * @author     Abhishek Das
 * @copyright  Copyright (C) 2012-2021 VirtuePlanet Services LLP. All rights reserved.
 * @license    GNU General Public License version 2. http://www.gnu.org/licenses/gpl-2.0.html
 * @link       http://www.virtueplanet.com
 * --------------------------------------------------------------------------------------------
 */
var jQ = jQuery.noConflict();

jQ(document).ready(function() {
	jQ(document).bind('showHideCustomSelection', function() {
		var type = jQ('#jform_params_type').val();
		console.log(type);
		if (type && type == 'selected') {
			if (jQ('#jform_params_manufacturers').closest('div.control-group').length) {
				jQ('#jform_params_manufacturers').closest('div.control-group').show(300);
				jQ('#jform_params_categories_id').closest('div.control-group').hide(300);
			} else {
				jQ('#jform_params_manufacturers').closest('li').show(0);
				jQ('#jform_params_categories_id').closest('li').hide(0);
			}
		} else {
			if (jQ('#jform_params_manufacturers').closest('div.control-group').length) {
				jQ('#jform_params_manufacturers').closest('div.control-group').hide(300);
				jQ('#jform_params_categories_id').closest('div.control-group').show(300);
			} else {
				jQ('#jform_params_manufacturers').closest('li').hide(0);
				jQ('#jform_params_categories_id').closest('li').show(0);
			}
		}
	});
	jQ(document).trigger('showHideCustomSelection');
	jQ('#jform_params_type').change(function() {
		jQ(document).trigger('showHideCustomSelection');
	});
});