$(document).ready(function(){
var comentando = false;
//Aplicamos el hack para las transparencias en IE
$('body').supersleight({shim: 'http://'+location.host+'/img/pixel.gif'});
$('body').supersleight();
//Método que comprueba que la estructura central tenga la altura mínima
comprobarEstructura();
$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});
$('#buscarButton').bind('click',
function(e){
e.preventDefault();
document.location = 'http://'+location.host+'/buscador/0/'+$('#buscar').val();
}
);
$('#buscar').bind('keypress',
function(e){
if (e.which == 13) {
document.location = 'http://'+location.host+'/buscador/0/'+$('#buscar').val();
}
}
);
$('#comEnviar').bind('click',
function (e){
e.preventDefault();
if (!comentando) {
var comNick = $('#comNick').val();
var comWeb = $('#comWeb').val();
var comEmail = $('#comEmail').val();
var comValoracion = $('#comValoracio').val();
var comText = $('#texto').val();
var comId = $('#registro').val();
var comTipo = $('#comTipo').val();
var ok = true;
if (ok == true && comNick == '') {
alert('No se puede dejar el campo Nombre en blanco');
ok = false;
}
if (ok == true && comEmail == '') {
alert('No se puede dejar el campo Email en blanco');
ok = false;
}
else {
if (ok == true && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(comEmail))) {
alert('La dirección e-mail introducida no es válida');
ok = false;
}
}
if (ok == true && comText == '') {
alert('No se puede dejar el campo Texto en blanco');
ok = false;
}
if (ok == true) {
$('#comEnviar').html("Enviant..");
comentando = true;
$.ajax({
url: "http://" + location.host + "/ajax.php",
cache: false,
dataType: 'xml',
data: {
action: 'comentario',
nick: comNick,
email: comEmail,
web: comWeb,
texto: comText,
puntos: comValoracion,
tipo: comTipo,
id: comId
},
type: 'POST',
success: function(data, textStatus){
var result = $("results result:eq(0)", data).text();
if (result == "true") {
alert('Gracias por su comentario. En breve, será publicado');
}
else {
alert("No se ha registrado su comentario por algún tipo de problema técnico o porque ha intentado enviar más de un comentario en menos de un minuto. Perdone las molestias.");
}
comentando = false;
$('#comEnviar').html("Enviar");
}
});
}
}else{
alert("Se está enviado su comentario. Espere por favor...");
}
}
);
//Abre la publicidad en una ventana nueva o cambia la url de la página
$("a[rel='nofollow']").bind('click',
function(e){
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf(location.host) > 0){
document.location = url;
}else{
window.open(url);
}
}
);
$('#mesAnt').click(function(e){
if (month == 1){
if ((year - 1) >= 2009){
month = 12
year = year - 1;
}
}else{
month = month - 1;
}
loadCalendar();
});
$('#mesSig').click(function(e){
if (month == 12){
month = 1
year = year + 1;
}else{
month = month + 1;
}
loadCalendar();
});
$(".visorFotos ul li a.enlFoto").bind('click',
function(e){
e.preventDefault();
$('.fotosTheatrerViewer').html('');
$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});
position = $(this).text();
}
);
$("#fotSig").bind('click',
function(e){
e.preventDefault();
actualPosition = parseInt(position);
if ((actualPosition +1) > numFotosGallery){
position = 1;
}else{
position = actualPosition + 1;
}
showFotoInTheatre(position);
}
);
$("#fotAnt").bind('click',
function(e){
e.preventDefault();
actualPosition = parseInt(position);
if ((actualPosition - 1) <= 0){
position = numFotosGallery;
}else{
position = actualPosition - 1;
}
showFotoInTheatre(position);
}
);
$('#otrosEstrenosSelect').bind('change',
function(e){
if (e.target.value != '') {
document.location = e.target.value;
}
}
);
var numFotosGallery = $(".visorFotos ul li a.enlFoto").length;
var position = 1;
$('#leerTodaCritica').bind('click',
function(e){
e.preventDefault();
$('.leerToda').hide('normal');
$('#restoCritica').slideDown('normal');
}
);
$('#mes').bind('change',
function(e){
e.preventDefault();
loadArchivo();
}
);
$('#any').bind('change',
function(e){
e.preventDefault();
loadArchivo();
}
);
$('.web').bind('click',
function(e){
e.preventDefault();
window.open($(this).attr('href'));
}
);
$('.fotoCabecera').bind('click',
function(e){
e.preventDefault();
document.location = $('.ampliar a').attr('href');
}
);
if ($('#resultadoArchivo').length == 1){
$('.ord').bind('click',
function(e){
e.preventDefault();
orden = $(this).attr('rel');
loadArchivo();
}
);
loadArchivo();
}
$('#enviarContacta').bind('click',
function(e){
e.preventDefault();
var ok = true;
if (ok ==true && $('#nombre').val() == ""){
alert("El campo Nombre es obligatorio");
ok = false;
}
if (ok ==true && $('#email').val() == ""){
alert("El campo Email es obligatorio");
ok = false;
}
if (ok ==true && $('#texto').val() == ""){
alert("El campp Comentario es obligatorio");
ok = false;
}
if (ok == true){
$('.respuesta').html("Enviando..");
$('.respuesta').show();
$('#campos').hide();
$.ajax({
url : "http://"+location.host+"/ajax.php",
cache : false,
dataType : 'xml',
data : {
action : 'contacta',
nombre : $('#nombre').val(),
email : $('#email').val(),
comentario : $('#texto').val()
},
type : 'POST',
success : function(data, textStatus){
var result = $("results result:eq(0)",data).text();
if (result == "true"){
$('.respuesta').html('Gracias por contactar. En breve, recibirá nuestra respuesta');
}else{
$('#campos').show();
$('.respuesta').html('No ha sido posible enviar el formulario. Pruebe más tarde. Perdone las molestias.');
}
}
});
}
}
);
$('a[rel="linkExt"]').bind('click',
function(e){
e.preventDefault();
window.open($(this).attr('href'));
}
);
$('#enviarAnunciate').bind('click',
function(e){
e.preventDefault();
var ok = true;
if (ok ==true && $('#nombre').val() == ""){
alert("El campo Nombre es obligatorio");
ok = false;
}
if (ok ==true && $('#email').val() == ""){
alert("El campo Email es obligatorio");
ok = false;
}
if (ok ==true && $('#empresa').val() == ""){
alert("El campo Empresa es obligatorio");
ok = false;
}
if (ok ==true && $('#telefono').val() == ""){
alert("El campo Telefono es obligatorio");
ok = false;
}
if (ok == true){
$('.respuesta').html("Enviando..");
$('.respuesta').show();
$('#campos').hide();
$.ajax({
url : "http://"+location.host+"/ajax.php",
cache : false,
dataType : 'xml',
data : {
action : 'anunciate',
nombre : $('#nombre').val(),
email : $('#email').val(),
empresa : $('#empresa').val(),
telefono : $('#telefono').val()
},
type : 'POST',
success : function(data, textStatus){
var result = $("results result:eq(0)",data).text();
if (result == "true"){
$('.respuesta').html('Gracias por contactar. En breve, recibirá nuestra respuesta');
}else{
$('#campos').show();
$('.respuesta').html('No ha sido posible enviar el formulario. Pruebe más tarde. Perdone las molestias.');
}
}
});
}
}
);
$('#lnkRss').bind('click',
function(e){
pageTracker._trackPageview('/rss.php');
}
);
});
function loadArchivo(){
$('#body #structure #content #loadingArchivo').show();
$.ajax({
url : "http://"+location.host+"/ajax.php",
cache : false,
dataType : 'xml',
data : {
action : 'archivo',
month : $('#mes').val(),
year : $('#any').val(),
order : orden,
limit : limit
},
type : 'POST',
success : function(data, textStatus){
var totalRes = $("rows resultados:eq(0) total",data).text();
html = '
'+position+'. '+months[$("mes",edicion).text()]+' '+$("any",edicion).text()+'
'; html += 'Películas:
'; html += ''; $('peliculas pelicula',edicion).each(function(o){ var pelicula = $('peliculas pelicula',edicion).get(o); html += ' '+$('titulo', pelicula).text()+' | '; }); html += '
'; html += 'Reportajes:
'; html += ''; $('reportajes reportaje',edicion).each(function(o){ var rep = $('reportajes reportaje',edicion).get(o); html += ' '+$('titulo', rep).text()+' | '; }); html += '
'; html += ' '; html += 'No hay resultados