function fcGenerateEmbedCode(id) { var feeds = ""; var users = ""; var smedias = ""; $("input:checkbox").each(function() { if ($(this).attr("id").indexOf("fcFeedSelected_") == 0 && $(this).is(":checked")) { feeds += $(this).attr("id").replace("fcFeedSelected_", "")+","; } if ($(this).attr("id").indexOf("fcUserSelected_") == 0 && $(this).is(":checked")) { users += $(this).attr("id").replace("fcUserSelected_", "")+","; } if ($(this).attr("id").indexOf("fcFeedSMTypes_") == 0 && $(this).is(":checked")) { smedias += $(this).attr("id").replace("fcFeedSMTypes_", "")+","; } }); feeds = feeds.substring(0, feeds.length - 1); users = users.substring(0, users.length - 1); smedias = smedias.substring(0, smedias.length - 1); if ($("#fcEmbedReferer").val() != "") { $("#"+id).val(""); } else { $("#"+id).val(""); } }