$(document).ready( function(){

//     $(".has_event").hover( function(){
//         $(this).addClass('has_event_over');
//         info_div = $(this).children("div").show();
//     }, function(){
//         $(this).removeClass('has_event_over');
//         $(this).children("div").hide();
//     });
//     $(".has_event").mousemove( function(e){
//         $(this).children("div").css('top', e.pageY- 70 )
//         //$("#cabecera").html('posx:'+e.pageX);
//         $(this).children("div").css('left', e.pageX-5)
//     })

    $('.has_event a').cluetip({
//         splitTitle: '|', // use the invoking element's title attribute to populate the clueTip...
                     // ...and split the contents into separate divs where there is a "|"
//         showTitle: true, // hide the clueTip's heading
        tracking:true,
//         local:true,
  });


    $("#calendario_anterior").click( function(){
        selected = $(".calendar_wrapper.calendar_shown");
        prev_div = selected.prev('div');
        if ( prev_div.length >0 ){
            selected.fadeOut(function(){
                prev_div.fadeIn();
                prev_div.addClass('calendar_shown');
                selected.removeClass('calendar_shown');
            });
        }
        return false;
    });
    $("#calendario_posterior").click( function(){
        selected = $(".calendar_wrapper.calendar_shown");
        next_div = selected.next('div.calendar_wrapper');
        next_id = next_div.attr('id')
        if ( next_id != undefined ){
            selected.hide();
            selected.fadeOut( function(){
                next_div.fadeIn();
                next_div.addClass('calendar_shown');
                selected.removeClass('calendar_shown');
            })
        }
        return false;
    });

    /* Imagen de las flechas */
//     $("#calendario_anterior, #calendario_posterior").hover(function(){
//         $(this).css('background-position','0px 15px');
//     },function(){
//         $(this).css('background-position','0px 0px');
//     });

//     /* F O R M U L A R I O     D E    B U S Q U E D A */
//     $("input[@name=buscar]").click( function(){
//         dia = $("select[@name=dia]/option:selected").val();
//         mes = $("select[@name=mes]/option:selected").val();
//         año = $("select[@name=anyo]/option:selected").val();
//         dias_en_mes = new Date(año,mes,0);
//         if (dia != ""){
//             if ( dia > dias_en_mes.getDate() ){
//                 alert("La fecha introducida no es correcta, se selecciona automáticamente el último día del mes");
//                 $("select[@name=day]/option:eq("+dias_en_mes.getDate()+")").attr('selected','selected');
//                 return false
//             }
//         }
//     });
//
//     $("select[@name=mes]").change( function(){
//         mes = $("select[@name=mes]/option:selected").val();
//         alert(mes)
//         año = $("select[@name=anyo]/option:selected").val();
//         dias_en_mes = new Date(año,mes,0);
//         $("select[@name=dia]").empty();
//         $("select[@name=dia]").append('<option value="" selected="selected">Todos</option>')
//         for (i=1; i<=dias_en_mes.getDate();i++){
//             $("select[@name=dia]").append('<option value="'+i+'">'+i+'</option>')
//         }
//         $("select[@name=dia]/option:eq(0)").attr('selected','selected');
//     });
});