var _c = '186';
var _a = '13';
var _l = false;
function reproducir(r) {
$.ajax({
type: 'POST', url: '/radio/js/libreria.aspx', cache: false, dataType: 'xml', data: {'c':_c, 'r':r, 'a':_a}
})
.done(function(xml) {
var html = '';
$(xml).find('reproductor').each(function(){
var id = $(this).find('id').text();
var contenido = $(this).find('contenido').text();
var activo = $(this).find('activo').text();
var alerta = $(this).find('alerta').text();
var img = '';
if (activo == '1') {
if (_a != id)
$('#Reproductor').html($(this).find('contenido').text());
if (id == '1' || id == '8' || id == '9' || id == '11' || id == '13' || id == '14')
img = '
';
else if (id == '6' || id == '10' || id == '12')
img = '
';
else if (id == '2')
img = '
';
else if (id == '3')
img = '
';
else if (id == '4')
img = '
';
$('#playerActivated').html(img);
_a = id;
}
else {
if (id == '1' || id == '13' || id == '14')
html += '
';
else if (id == '6' || id == '10' || id == '12')
html += '
';
else if (id == '2')
html += '
';
else if (id == '3')
html += '
';
else if (id == '4')
html += '
';
}
if (alerta == '1')
$('#alerta').removeClass('hidden');
});
if (html != '')
$('#OtrosReproductores').html('Otros Reproductores:' + html);
})
.fail(function(xhr, status, error) {
console.log(error);
});
}
function votar(v) {
$('.btn-star[data-rank="'+ v.toString() + '"]').addClass('active');
$.ajax({
type: 'POST', url: '/radio/js/libreria.aspx', cache: false, dataType: 'xml', data: {'c':_c, 'v':v}
})
.done(function(xml){
$(xml).find('votacion').each(function(){
$('.valorationMedia').text(parseFloat($(this).find('promedio').text()).toFixed(2));
$('.totalVotes').text($(this).find('votos').text());
$('.btn-star[data-rank]').prop('onclick',null).off('click');
});
})
.fail(function(xhr, status, error) {
console.log(error);
});
}
function enviar(form){
var msg = '';
var divAlert = $('.alert'), cnt = $('#escribeEmisora'), classCss, msg;
$.ajax({
type: 'POST', url: '/radio/js/libreria.aspx', cache: false, dataType: 'xml', data: {'m': 1, 'c':_c, 'nombre':form.nombre.value, 'email':form.email.value, 'mensaje':form.mensaje.value, 'g-recaptcha-response':document.getElementById('g-recaptcha-response').value},
})
.done(function(xml) {
var error = $(xml).find('error').text();
if (error != null && error != '') {
msg = 'Hubo un error enviado el mensaje. Intente nuevamente.';
classCss = 'error red';
}
else {
$(xml).find('respuesta').each(function(){
switch (parseInt($(this).find('id').text())) {
case 0:
msg = 'El mensaje fue enviado a la emisora.';
classCss = 'success green'
form.mensaje.value = '';
document.getElementById('g-recaptcha-response').value = '';
grecaptcha.reset();
break;
case 1:
msg = 'Faltan algunos datos.';
classCss = 'error red'
break;
case 2:
msg = 'Hubo un error enviado el mensaje. Intente nuevamente.';
classCss = 'error red';
break;
case 10:
msg = 'Verifique si usted no es un robot :)';
classCss = 'error red';
break;
default:
msg = 'Hubo un error enviado el mensaje. Intente nuevamente.';
classCss = 'error red';
break;
}
});
}
createAlert(cnt, msg, classCss);
})
.fail(function () {
msg = 'Hubo un error enviado el mensaje. Intente nuevamente.';
classCss = 'error red';
createAlert(cnt, msg, classCss);
});
}
function reportar(){
var divAlert = $('.alert'), cnt = $('#noSenal'), classCss, msg;
$.ajax({
type: 'POST', url: '/radio/js/libreria.aspx', cache: false, dataType: 'xml', data: {'s':1, 'c':_c}
})
.done(function (xml) {
var error = $(xml).find('error').text();
if (error != null && error != '') {
msg = 'Hubo un error reportando la señal, intente nuevamente.';
classCss = 'error red';
createAlert(cnt, msg, classCss);
}
else
$('#noSenal').html('
La señal fue reportada con éxito, muy pronto la estaremos revisando.
Agradecemos su información.