$(function(){loadCkeditorPolls();});function loadCkeditorPolls(){$(".ckeditor-poll").each(function(){var urlResource =$(this).attr("data-path");var config = $(this).attr("data-style");var ckeDiv=$(this).attr("id");$.get('/system/modules/com.tfsla.diario.newsTags/elements/polls/poll.jsp',{path:urlResource,style:config},function(data){$("#"+ckeDiv).html(data);return false;});});return false;}function submitPool(idDiv,config){var urlResource=$("#"+idDiv).attr("path");var params="encuestaURL="+urlResource;$('#'+idDiv).find('[name="respuesta"]:checked').each(function(index){params+="&respuesta="+$(this).val(); });$.ajax({url:'/system/modules/com.tfsla.diario.newsTags/elements/polls/votePoll.jsp',data:params,dataType:"xml",success:function(xml){var result=$(xml).find('result').text();if(result=="ok"){$.post('/system/modules/com.tfsla.diario.newsTags/elements/polls/'+config +'/pollClose.jsp',{path:urlResource,style:config,id:idDiv}, function(data){$("#" + idDiv).html(data);});}else {alert($(xml).find('message').text());}return false;},error: function(jqXHR,textStatus,errorThrown) {alert(errorThrown);return false;}});return false;}function viewPopupResultPoll(idDiv,config){if($("#resultPool-"+idDiv).length==0)$("#" +idDiv).append("
");var urlResource =$("#" +idDiv).attr("path");$.post('/system/modules/com.tfsla.diario.newsTags/elements/polls/'+config +'/pollResult.jsp',{path: urlResource,style:config,id:idDiv},function(data){$("#resultPool").html(data);});$('.wpOptions-'+idDiv).fadeOut('fast');}function removePopupResultPoll(idDiv){document.getElementById("resultPool").style.display="block";$('.wpOptions-' +idDiv).fadeIn('slow');$('.wpResul-'+idDiv).fadeOut('fast');}function showClosePool(idDiv,config){var urlResource=$("#"+idDiv).attr("path");var params="encuestaURL="+urlResource;$('#'+idDiv).find('[name="respuesta"]:checked').each(function(index){params+="&respuesta="+$(this).val();});$.post('/system/modules/com.tfsla.diario.newsTags/elements/polls/'+ config + '/pollResult.jsp',{ path: urlResource, style: config, id:idDiv }, function(data){$("#" + idDiv).html(data);}); }function showOpenPool(idDiv, config){var urlResource = $("#" + idDiv).attr("path");var params = "encuestaURL="+urlResource;$('#'+idDiv).find('[name="respuesta"]:checked').each(function(index){params+="&respuesta="+$(this).val(); });$.post('/system/modules/com.tfsla.diario.newsTags/elements/polls/'+config+'/pollOpen.jsp',{path:urlResource,style:config,id:idDiv},function(data){$("#"+idDiv).html(data);});}