$(document).ready(function()
{
	$("#googleproductcategorytext").hide();
	$(document).on("click","#select_feed",function()
	{
		var feedIDs	= [];
		var j=0;
		$('#checkFeedIDs:checked').each(function(){
			feedIDs[j] = $(this).val();
			j++;
		});	
		
		var productIDs = $('#productID').val().split(",");
		$.ajax({
			type: "POST",
			url: GLOBAL_BASE_PATH + "/googlepla/ajaxUpdateFeed/",
			data: "productIDs="+productIDs+"&feedIDs="+feedIDs,
			success: function (msg) {
				parent.$.colorbox.close();
				parent.location.reload();
			}
		});
				
	});
	$("#googleproductcategory").change(function()
	{
		if ($(this).val() === 'Other') 
		{
			$("#googleproductcategorytext").show();
		}
		else
		{
			$("#googleproductcategorytext").hide();
		}
	});
	
	$(document).on("click","#submitProduct",function()
	{
		var productIDs = $('#productID').val().split(",");
		$.ajax({
			type: "POST",
			url: GLOBAL_BASE_PATH+"/googlepla/ajaxProductAdd/",
			data: {countryIsoA2: $('#countryIsoA2').val(),ProductContLn: $('#ProductContLn').val(),Condition: $('#Condition').val(),googleproductcategory: $('#googleproductcategory').val(),productIDs: productIDs},
			success: function(data)
			{
				
			}
		});
	});
	
});