$(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+'/cercador/0/'+$('#buscar').val();
}
);
$('#buscar').bind('keypress',
function(e){
if (e.which == 13) {
document.location = 'http://'+location.host+'/cercador/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 es pot deixar es camp Nom en blanc');
ok = false;
}
if (ok == true && comEmail == '') {
alert('No es pot deixar es camp Email en blanc');
ok = false;
}
else {
if (ok == true && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(comEmail))) {
alert('La direcció e-mail introduida no es vàlida');
ok = false;
}
}
if (ok == true && comText == '') {
alert('No es pot deixar es camp Text en blanc');
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('Gracies pel seu comentari. En breu, serà publicat');
}
else {
alert("No s'ha enregistrat el seu comentari per qualque problema tècnic o perquè ha intentat enviar més d'un comentari en menys d'un minut. Perdoni les molèsties.");
}
comentando = false;
$('#comEnviar').html("Enviar");
}
});
}
}else{
alert("S'està enviant el seu comentari. Esperi per 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 camp Nom es obligatori");
ok = false;
}
if (ok ==true && $('#email').val() == ""){
alert("El camp Email es obligatori");
ok = false;
}
if (ok ==true && $('#texto').val() == ""){
alert("El camp Comentari es obligatori");
ok = false;
}
if (ok == true){
$('.respuesta').html("Enviant..");
$('.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('Gracies per contactar. En breu, rebrà la nostra resposta');
}else{
$('#campos').show();
$('.respuesta').html('No ha estat possible enviar el formulari. Provi mes tard. Perdoni les molèsties');
}
}
});
}
}
);
$('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 camp Nom es obligatori");
ok = false;
}
if (ok ==true && $('#email').val() == ""){
alert("El camp Email es obligatori");
ok = false;
}
if (ok ==true && $('#empresa').val() == ""){
alert("El camp Empresa es obligatori");
ok = false;
}
if (ok ==true && $('#telefono').val() == ""){
alert("El camp Telèfon es obligatori");
ok = false;
}
if (ok == true){
$('.respuesta').html("Enviant..");
$('.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('Gracies per contactar. En breu, rebrà la nostra resposta');
}else{
$('#campos').show();
$('.respuesta').html('No ha estat possible enviar el formulari. Provi mes tard. Perdoni les molèsties');
}
}
});
}
}
);
$('#lnkRss').bind('click',
function(e){
pageTracker._trackPageview('/rss.php');
}
);
loadCalendar();
});
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 += 'Obres de teatre:
'; html += ''; $('obras obra',edicion).each(function(o){ var obra = $('obras obra',edicion).get(o); html += ' '+$('titulo', obra).text()+' | '; }); html += '
'; html += 'Reportatges:
'; html += ''; $('reportajes reportaje',edicion).each(function(o){ var rep = $('reportajes reportaje',edicion).get(o); html += ' '+$('titulo', rep).text()+' | '; }); html += '
'; html += ' '; html += 'No hi ha resultats
' + titulo + '
'; html += '' + compania + '
'; html += '' + teatro + '
'; if (hora != '') { html += '' + hora + ' h
'; } html += '