
// *************************************************************
// **
// **     	check_enable_cart
// **		checks alle data for the shopping cart to be enabled
// **		enables the shopping cart if all data is set
// **		disables the shopping cart if not all data is set
// **
// **************************************************************

function check_enable_cart(){
	
	// try to get id send element
	var id_elm = false;
	if(!(id_elm = getObj('id'))){
		alert('check_enable_cart(): id send element not found!');
	}
	
	// try to get name element
	var name_elm = false;
	if(!(name_elm = getObj('name'))){
		alert('check_enable_cart(): name send element not found!');
	}
	
	// try to get price element
	var price_elm = false;
	if(!(price_elm = getObj('price'))){
		alert('check_enable_cart(): price send element not found!');
	}
	
	// try to get color element
	var color_elm = false;
	if(!(color_elm = getObj('color'))){
		alert('check_enable_cart(): color send element not found!');
	}
	
	// try to get size element
	var size_elm = false;
	if(!(size_elm = getObj('size'))){
		alert('check_enable_cart(): size send element not found!');
	}
	
	// try to get image file element
	var image_file_elm = false;
	if(!(image_file_elm = getObj('image_file'))){
		alert('check_enable_cart(): image file send element not found!');
	}
	
	// try to get image width element
	var image_width_elm = false;
	if(!(image_width_elm = getObj('image_width'))){
		alert('check_enable_cart(): image width send element not found!');
	}
	
	// try to get image height element
	var image_height_elm = false;
	if(!(image_height_elm = getObj('image_height'))){
		alert('check_enable_cart(): image height send element not found!');
	}
	
	// try to get path element
	var path_elm = false;
	if(!(path_elm = getObj('path'))){
		alert('check_enable_cart(): path send element not found!');
	}
	
	// try to get cart parent
	var cart_parent_elm = false;
	if(!(cart_parent_elm = getObj('cart'))){
		alert('check_enable_cart(): cart parent element not found!');
	}
	
	// try to get the enabled cartholder element
	var enabled_cartholder_elm = false;
	if(!(enabled_cartholder_elm = getObj('cart_holder'))){
		//alert('check_enable_cart(): enabled cart holder element not found!');
	}

	// try to enable cart
	if(
		id_elm &&
		name_elm &&
		price_elm &&
		color_elm &&
		size_elm &&
		image_file_elm &&
		image_width_elm &&
		image_height_elm &&
		path_elm &&
		id_elm.value != '' &&
		name_elm.value != '' &&
		price_elm.value != '' &&
		color_elm.value != '' &&
		size_elm.value != '' &&
		image_file_elm.value != ''  &&
		image_width_elm.value != ''  &&
		image_height_elm.value != ''  &&
		path_elm.value != '' &&
		
		cart_parent_elm &&
		enabled_cartholder_elm &&
		enabled_cartholder_elm.innerHTML != ''
	){
		
		// insert the enabled cart
		cart_parent_elm.innerHTML = enabled_cartholder_elm.innerHTML;
		
		// remove the inner HTML so the id is unique
		enabled_cartholder_elm.innerHTML = '';
	}
}

