/*** ***/
try{
var rutaFotos = "wp-content/pragma/uploads/";
function get(idv){return document.getElementById(idv)}
function getDatosEmisora(){
$(document).ready(function(){
var myIFrame = document.getElementById('framer');
var content = navigator.userAgent.indexOf("MSIE") != -1 ? myIFrame.contentWindow.document : myIFrame.contentDocument;
return content;
});
}/***/
/**/
function hideLogin(){
$('#dv_pedidos').show('normal');
$('#dv_registro').hide('fast');
}
function loadAuth(abrirPerfil){
//$('#dv_registro').html($('#__waitContent').html());
$.get(__HOMEBLOG+'/wp-content/themes/craftwork/registro.php?rnd='+Math.random(), function(data) {
/****/
$('#dv_registro').html(data);
if(abrirPerfil==true){
$('#crearPerfil').show();
$('#editarPerfil').hide();
miPerfil();
}else{
$('#editarPerfil').show();
$('#crearPerfil').hide();
}
//initUploadFoto();
})
}
function loadTop(){
$('#topTableC').html($('#__waitContent').html());
$.get(__HOMEBLOG+'/wp-content/themes/craftwork/top10.php', function(data) {
$('#dv_top10').html(data);
//initUploadFoto();
})
}
/*** Para la carga de fotos ***/
function initUploadFoto(){
function uploadSuccess(file, serverData) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
//progress.setStatus("Completado.");
progress.toggleCancel(false);
currentPhoto = rutaFotos+serverData;
if(serverData=="false"){
alert("Ha ocurrido un error al subir tu foto, por avor inténtalo de nuevo");
}else{
$("#fsUploadProgress2").html("
");
$("#userFoto").val(currentPhoto);
}
} catch(ex){alert(ex);}
}
function uploadError(e){alert(e);}
SWFUpload.prototype.uploadStart = function (file) {
$("#fsUploadProgress2").html("
 |
");
file = this.unescapeFilePostParams(file);
this.queueEvent("return_upload_start_handler", file);
};
var swfu = new SWFUpload({
upload_url: __HOMEBLOG+"/wp-content/pragma/util.php?cmd=upload&wip="+$("#tp_wp_id").val(),
post_params: {},
file_size_limit : "1024", // 200 kb
file_types : "*.jpg;*.gif;*.png",
file_types_description : "Image Files",
file_upload_limit : "0",
file_queue_limit : "0",
file_dialog_start_handler : fileDialogStart,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
button_image_url : __HOMEBLOG+"/wp-content/pragma/upload/XPButtonUploadText_61x22.png",
button_placeholder_id : "spanButtonPlaceholder1",
button_width: 61,
button_height: 22,
button_text_left_padding : 3,
button_text_top_padding : 2,
// Flash Settings
flash_url : __HOMEBLOG+"/wp-content/pragma/upload/swfupload.swf",
custom_settings : {
progressTarget : "fsUploadProgress1",
cancelButtonId : "btnCancel1"
},debug: false
});
}
/**** fin de carga de fotos****/
function logout(){
$('#dv_perfil').hide('fast');
$('#__wait').show('fast');
$.get(__HOMEBLOG+'/wp-content/themes/craftwork/registro.php?logout=1', function(data) {
$('#dv_registro').html(data);
})
}
function loginAction(){
/** ***** **/
if($("#fl_user").val()==""||$("#fl_password").val()=="") return;
//$('#dv_login').hide('fast');
$('#dv_entradilla').show();
$('#loginError').hide();
$('#dv_login').hide('fast');
$('#wait_login').show('normal');
/* **/ /***/
//$.post("/php/NOL/blog/wp-content/pragma/util.php?cmd=auth&u="+$("#fl_user").val()+"&p="+$("#fl_password").val(),{u:$("#fl_user").val(),p:$("#fl_password").val()},
$.post(__HOMEBLOG+"/wp-content/pragma/util.php?cmd=auth",{u:$("#fl_user").val(),p:$("#fl_password").val()},
function(data){
$('#wait_login').hide('normal');
/******/
if(data.error){
//$('#dv_login').show('fast');
$('#dv_login').show('fast');
$('#loginOk').hide('fast');
$('#dv_entradilla').hide();
$('#loginError').show('fast');
}else{
loadAuth(data.nuevo)
}
},"json");
}
function miPerfil(){
$.facebox(function() {
$.get(__HOMEBLOG+"/wp-content/themes/craftwork/miperfil.php", function(data) {
$.facebox(data);
initUploadFoto();
$("#nav-shadow li").fadeTo("fast", 0.7);
$("#nav-shadow li").hover(
function(){
$(this).fadeTo("fast", 1);
},
function(){
if($(this).attr("id")!=fondoSeleccionado) $(this).fadeTo("fast", 0.7);
}
);
$("#nav-shadow li").click(function(){
if(fondoSeleccionado!=null) $("#"+fondoSeleccionado).fadeTo("fast", 0.7);
fondoSeleccionado = $(this).attr("id");
$("#"+fondoSeleccionado).fadeTo("fast", 1);
$("#userFondo").val(fondoSeleccionado);
//$("#lay_carne").add_layer("url('"+__HOMEBLOG+"/wp-content/themes/craftwork/images/carnes/"+(fondoSeleccionado.replace(/fondo/ig, "back"))+".jpg')");
//$("#lay_carne").css({backgroudImage: "url("+__HOMEBLOG+"/wp-content/themes/craftwork/images/carnes/"+(fondoSeleccionado.replace(/fondo/ig, "back"))+".jpg)"});
$("#lay_carne").css('backgroundImage',"url("+__HOMEBLOG+"/wp-content/themes/craftwork/images/carnes/"+(fondoSeleccionado.replace(/fondo/ig, "back_"))+".jpg)");
});
$("#"+$("#userFondo").val()).fadeTo("fast", 1);
fondoSeleccionado = $("#userFondo").val();
})
})
}
function guardarPerfil(){
var mifoto = $("#userFoto");
var minombre = $("#minombre");
var mifrase = $("#mifrase");
var migenero = $("#migenero");
var mifondo = $("#userFondo");
if(minombre.val()=="" ){
alert("Debes ingresar tu nombre");
return;
}
$('#dv_btnGuardar').hide('fast');
$('#__guardarWait').show('fast');
$('#msgGuardar').hide('fast');
$.post(__HOMEBLOG+"/wp-content/pragma/util.php?cmd=miperfil",{f:mifoto.val(),n:minombre.val(),fr:mifrase.val(),g:migenero.val(),fn:mifondo.val()},
function(data){
//alert("grabando ...foto:"+mifoto.val()+" ,minombre="+minombre.val()+" ,nombre="+mifrase.val()+" ,migenero="+migenero.val()+" ,fondo="+mifondo.val());
//alert(data);
if(data.error){
$('#__guardarWait').hide('fast');
$('#dv_btnGuardar').show('fast');
alert("Se ha presentado un error alguardar tus datos, por favor intentalo de nuevo.");
}else{
loadAuth(false);
$('#__guardarWait').hide('fast');
$('#dv_btnGuardar').show('fast');
$('#msgGuardar').show('fast');
}
},"json");
}
/***/ /***/ /***/ /***/ /***/
/***/ /***/ /***/ /***/
function opinar(){
resp = $("input[@name='rad_opinion']:checked").val();
enc = $("#curpoll").val();
if(resp==undefined || enc=="") return;
$('#dvOpini').html(""+$('#__waitContent').html()+"
");
$.post(__HOMEBLOG+"/wp-content/pragma/util.php?cmd=opinion",{r:resp,e:enc},
function(data){
if(!data.error){
$.cookie('blogpoll_'+enc, resp, { expires: 365 });
}else{
alert("No se puedo enviar tu votacion, intentalo de nuevo");
}
reloadPoll();
},"json");
/***/ /***/ /***/
}
function reloadPoll(){
$.get(__HOMEBLOG+"/wp-content/themes/craftwork/opinion.php", function(html) {
$('#dv_opinion').html(html);
});
}
var fondoSeleccionado = null;
function registrarPeticion(){
var cancion = $("#cancion");
var artista = $("#artista");
var comentario = $("#comentario");
if(cancion.val()=="" && artista.val()==""){
alert("Debes ingresar la cancion o el(la) artista");
return;
}
/*if(comentario.val()==""){
alert("Debes ingresar el comentario");
return;
}*/
$('#mainPedidos').hide('fast');
$('#loadingPedidos').show('fast');
$.post(__HOMEBLOG+"/wp-content/pragma/util.php?cmd=peticion",{ca:cancion.val(),a:artista.val(),co:comentario.val()},
function(data){
//alert(data);
try{
if(data.error){
$('#loadingPedidos').hide('fast');
$('#mainPedidos').show('fast');
if(data.errno=="2"){
alert("Para poder realizar un pedido, debes ser parte de nuestro blog, autenticate y realiza de nuevo el pedido");
}else{
alert("Se ha presentado un error al enviar tus datos, por favor intentalo de nuevo");
}
}else{
loadTop();
$('#loadingPedidos').hide('fast');
$('#exitoPedido').show('fast');
$('#mainPedidos').show('fast');
}
}catch(e){alert(e);}
/*$('#wait_login').fadeOut('normal');
//if(error){
if(data.error){
$('#loginOk').hide('fast');
$('#loginError').show('fast');
}else{
$('#dv_pedidos').show('fast');
$('#dv_registro').hide('normal');
}*/
},"json");
}
var currPage = 1;
$(document).ready(function(){
loadGal();
});
var usrCache = new Array();
var _pagTotalRegs = 0;
function loadGal(){
$.ajax({
type: "GET",
url: __HOMEBLOG+"/wp-content/pragma/util.php?cmd=list&last="+currPage+"&rnd="+Math.random(),
dataType: "xml",
success: function(xml) {
counter = 0;
_pagTotalRegs = $(xml).find('total').text();
$(xml).find('row').each(function(){
//$('#td_t_'+counter).hide("fast");
var xml_id = $(this).attr('id');
var xml_nombre = $(this).find('nombre').text();
var xml_email = $(this).find('email').text();
var xml_foto = $(this).find('foto').text();
var xml_fondo = $(this).find('fondo').text();
var xml_frase = $(this).find('frase').text();
var xml_genero = $(this).find('genero').text();
usrCache[xml_id] = new Array();
usrCache[xml_id]["nombre"] = xml_nombre;
usrCache[xml_id]["email"] = xml_email;
usrCache[xml_id]["foto"] = xml_foto;
usrCache[xml_id]["fondo"] = xml_fondo;
usrCache[xml_id]["frase"] = xml_frase;
usrCache[xml_id]["genero"] = xml_genero;
//$('#td_t_'+counter).html(";
$()
");
//$('#td_t_'+counter).html(""+__HOMEBLOG+"/"+xml_foto+" ");
counter++;
/****** *****/
});
valNavegador()
}
});
}
function next(){
$("#tbl_gal td div").html('
');
++currPage;
loadGal();
}
function prev(){
$("#tbl_gal td div").html('
');
--currPage;
loadGal();
}
function valNavegador(){
if(currPage<=1) $("#prev").hide();
else $("#prev").show();
if(currPage>=(_pagTotalRegs/12)) $("#next").hide();
else $("#next").show();
}
function siguiente(){
$("#instrucciones").hide();
$("#custom").show();
}
function facebook(){
window.open('http://www.facebook.com/sharer.php?t=Musica%20Nosotras&u=http://www.nosotrasonline.com/php/NOL/blog/wp-content/pragma/facebook3.html', 'facebook','toolbar=no,width=700,height=400'); return false;
}
var carrusel;
function mycarousel_itemLoadCallback(carousel, state){
carrusel = carousel;
if (carousel.has(carousel.first, carousel.last)) return;
$('#wait_busquedaHistorias').fadeIn('normal');
search = $('#fanbuscar').val();
$.get(
__HOMEBLOG+'/wp-content/pragma/util.php?cmd=list&s='+search+'&cs='+__currentCarneSeleccionado,{
first: carousel.first,
last: carousel.last
},
function(xml){
mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
},'xml'
);
};
function mycarousel_itemAddCallback(carousel, first, last, xml){
try{
carousel.size(parseInt(jQuery('total', xml).text()));
$('row', xml).each(function(i){
itemd = $(this).text();
var hid = $(this).attr('id');
var nombre = $(this).find('nombre').text();
var email = $(this).find('email').text();
var foto = __HOMEBLOG+"/"+$(this).find('foto').text();
var fondo = $(this).find('fondo').text();
//fondo = fondo.replace(/fondo/i, "fondo_");
var frase = $(this).find('frase').text();
var genero = $(this).find('genero').text();
carousel.add(first + i, mycarousel_getItemHTML(hid,nombre,email,fondo,foto,frase,genero));
/*$("#lay_carne").ready(function() {
//alert("cargado");
});*/
});
}catch(e){alert(e);}
$('#wait_busquedaHistorias').fadeOut('normal');
};
function mycarousel_getItemHTML(hid,nombre,email,fondo,foto,frase,genero){
return $("#dv_carne").html().replace(/#nombre/g,nombre).replace(/#email/g,email).replace(/#fondo/g,fondo.replace(/fondo/,"back_")).replace(/#frase/g,frase).replace(/#genero/g,genero).replace(/#foto/g,foto);
//return "xxx"
};
var __currentCarneSeleccionado = null;
function showCarnes(xx){
__currentCarneSeleccionado = xx;
$.facebox(function() {
$.get(__HOMEBLOG+"/wp-content/themes/craftwork/fanaticas.php?sc="+__currentCarneSeleccionado, function(data) {
$.facebox(data);
$(document).ready(function() {
initCarnes()
});
});
});
}
function initCarnes(){
$('#mycarousel').jcarousel({
vertical: false,
scroll: 1,
size: 12,
itemLoadCallback: mycarousel_itemLoadCallback
});
}
function initCarnes2(){
$(document).ready(function() {
$('#wrap *').remove();
$('#wrap').append('')
initCarnes()
});
}
/*** xxx **/
function openPerfil(xid){
$.facebox(function() {
$.get(__HOMEBLOG+"/wp-content/themes/craftwork/otroPerfil.php", function(data) {
data = data.replace(/#nombre/g,usrCache[xid]["nombre"]).replace(/#email/g,usrCache[xid]["email"]).replace(/#fondo/g,usrCache[xid]["fondo"].replace(/fondo/,"back_")).replace(/#frase/g,usrCache[xid]["frase"]).replace(/#genero/g,usrCache[xid]["genero"]).replace(/#foto/g,usrCache[xid]["foto"]);
$.facebox(data);
})
})
}
function limitText(limitField, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
}
}
function detectPopupBlocker() {
var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
if (!myTest) {
//alert("Parece que los popup estan deshabilitados");
msg = "Si no puedes escuchar la emisora
Es probable que tu navegador este bloqueando las ventanas emergentes.
Haz clic en la barra amarilla que aparece en la parte superior de tu pantalla y elige la opcion permitir elementos emergentes
";
$.facebox(msg);
} else {
myTest.close();
//alert("No popup blocker was detected.");
}
}
window.onload = detectPopupBlocker;
}catch(e){alert(e)}
/*** otras funciones ***/
function isValidEmail(strEmail){ validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i; if(strEmail.search(validRegExp) == -1) return false; return true; }
function isInteger(s){ var i; if(isEmpty(s)){ if(isInteger.arguments.length == 1) return 0; }else return (isInteger.arguments[1] == true); for(i = 0; i < s.length; i++){ var c = s.charAt(i); if(!isDigit(c)) return false; } return true;}
function isEmpty(s){ return ((s==null)||(s.length==0))}
function isDigit(c){ return ((c>="0")&&(c<="9"))}
/**** fin ****/