// modules.catalog.lib.js.productListManagement-1-fr 
var Context = {
MODULE_ACCESSOR:'module',
ACTION_ACCESSOR:'action',
CALLER_MODULE:'website',
CALLER_ACTION:'Display',
W_HOST_PREFIX:'http://',
W_HOST:'www.persomed.com',
UIHOST_PREFIX:'http://',
UIHOST:'www.persomed.com',
UIBASEURL:'http://www.persomed.com',
DEV_MODE:false,
inDragSession:false,
W_LANG:'fr',
FORWARD_TO_MODULE:'fmodule',
FORWARD_TO_ACTION:'faction',
RICHTEXT_PRESERVE_H1_TAGS:false,
CHROME_BASEURL:false};

var K = {
WEBEDIT_MODULE_ACCESSOR:'wemod',
COMPONENT_ACCESSOR:'cmp',
COMPONENT_ID_ACCESSOR:'cmpref',
COMPONENT_LANG_ACCESSOR:'lang',
GENERIC_MODULE_NAME:'generic',
PARENT_ID_ACCESSOR:'parentref',
VALUE_ACCESSOR:'value',
LABEL_ACCESSOR:'label',
TREE_FILTER:'treeFilter',
LANG_ACCESSOR:'lang',
FULL_TREE_CONTENT_ACCESSOR:'fullTreeContent',
LINKED_COMPONENT_ACCESSOR:'lnkcmp'};
// Checkbox change.
jQuery(document).ready(function() {
	jQuery('.product-selector').change(function() { 
		// If the box is check and the quantity equals 0, set it to 0.
		if (this.checked == true)
		{
			jQuery(this).parents('.product-line').find('.quantity-selector').each(function() { 
				if (parseInt(this.value) == 0)
				{
					this.value = '1';
				}
			});
		}
		// If the box is unchecked, set the quantity to 0.
		else
		{
			jQuery(this).parents('.product-line').find('.quantity-selector').each(function() { 
				this.value = '0';
			});
		}
	});
});

// Quantity change.
jQuery(document).ready(function() {
	jQuery('.quantity-selector').change(function() { 
		// If there is no value for the quantity, set it to 0.
		if (this.value == '')
		{
			this.value = 0;		
		}	
		
		// Quantity equals 0, uncheck the box.
		if (parseInt(this.value) == 0)
		{
			jQuery(this).parents('.product-line').find('.product-selector').each(function() { 
				this.checked = false;
			});
		}
		// Else check the box.
		else
		{
			jQuery(this).parents('.product-line').find('.product-selector').each(function() { 
				this.checked = true;
			});
		}
	});
});


