function replace_photo_thumbs(){
    thumb_path = "http://cometemallorca.com/wp-content/themes/cometemallorca-V3/static/img/sube-fotografias-mini.jpg";
    $(".excerpts .post img").each( function() {
        if (this.src.indexOf("sube-fotografias.jpg") > -1) {
            this.src = thumb_path;
        }
    })
}

function add_important_event_thumb(element){
    img_src = $(element).children().eq(1).children().eq(0)[0].src;
    thumb = '<a href="javascript:void(0)" onclick="show_event(\''+$(element)[0].id+'\')" id>';
    thumb += '<img src="'+img_src+'" width="100" height="100" alt=""/>';
    thumb += '</a>';

    $("#important_events_thumbs").append(thumb);
}

function important_events(){
    $(".important_events").each( function() {
        $(this).css("display","none");
        add_important_event_thumb(this);
    });
    elements = $(".important_events");
    if (elements.size() > 0) {
        $(elements[0]).css("display","block");
    }
}

function show_event(id) {
    element = $("#" + id);
    $(".important_events").each( function() {
        $(this).css("display","none");
    })
    $(element).css("display","block");
}

function tunear_formularios() {
    $(".clickreset").click(function() {this.value =""});
}

$(document).ready(function() {
    replace_photo_thumbs();
    important_events();
    tunear_formularios();
    $("*[rel=lightbox[album]]").lightBox();
});

