$(document).ready(function(){

function corBgCompromisso(){
    //cor dos dias com compromisso
    $("div#calendario #cal a.eventDay")
    .parent()
    .css({
        backgroundColor:"#666",
        border:"1px solid #9fbce8"
    });
}
/*
 *Plugin TooTip
 **/
function tootipCompromisso(){
    //mostra um tootip para os compromissos
    $('#calendario table a').tooltip({
        track: true,
        delay: 0,
        showURL: false,
        extraClass: "right"

    });
}
//var dadosS;
function loadAgenda(dadosS){
    $.ajax({
        type: "POST",
        url: urlAbs +"Agenda-eventos/index/rand="+ Math.floor(Math.random()*100),
        data: dadosS,
        success: function(ret){
           $('div#calendario div table').remove();
           $('div#calendario div').html(ret);
           tootip();
        }
    });	//fim ajax
}
    $('a.mudarMes').live('click',function(e){
        e.preventDefault();//tira o infame do som (qando clicado no IE)
        $('div#calendario div table').fadeTo('fast',0.6);
       // $('div#calendario div table').loading(true, { img:'http://localhost/fasne/public/site/imgs/loading.gif', align:'center'});
        dadosS = $(this).attr('rel');
        // alert(dadosS);
        loadAgenda(dadosS);
       
    });
    tootip();
    function tootip(){
    	// Define corners and opposites arrays
    	var corners = [
    	   'bottomLeft', 'bottomRight', 'bottomMiddle',
    	   'topRight', 'topLeft', 'topMiddle',
    	   'leftMiddle', 'leftTop', 'leftBottom',
    	   'rightMiddle', 'rightBottom', 'rightTop'
    	];
    	var opposites = [
    	   'topRight', 'topLeft', 'topMiddle',
    	   'bottomLeft', 'bottomRight', 'bottomMiddle',
    	   'rightMiddle', 'rightBottom', 'rightTop',
    	   'leftMiddle', 'leftTop', 'leftBottom'
    	];
    	// By suppling no content attribute, the library uses each elements title attribute by default
    	   $('table#cal a.eventDay').qtip({
    	      content: {
    	         text: false // Use each elements title attribute
    	      },
    	      position: {
    	          corner: {
    	        	 tooltip: 'bottomRight', // Use the corner...
    	             target: 'topLeft' // ...and opposite corner
    	          }
    	       },
    	       style: {
                   border: {
                      width: 5,
                      radius: 10
                   },
                   padding: 10, 
                   textAlign: 'left',
                   tip: true, // Give it a speech bubble tip with automatic corner detection
                   name: 'dark' // Style it according to the preset 'cream' style
                }
    	       
    	   });
    }
});


