/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
    init();

});

function init(){

    $(".triggers").tooltip({  offset: [30, 1]  });
    lightboxFotos();
    //splash();
    setTotalSplash();
    

}

function lightboxFotos(){

    $('.fotos a').lightBox({
                txtImage: 'Imagem',
		txtOf: 'de',
		overlayBgColor: '#C3C3C1',
		overlayOpacity:			0.8,

        imageLoading:'http://www.ccm.org.br/public/js/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
        imageBtnPrev:'http://www.ccm.org.br/public/js/jquery-lightbox-0.5/images/lightbox-btn-prev.gif',
        imageBtnNext:'http://www.ccm.org.br/public/js/jquery-lightbox-0.5/images/lightbox-btn-next.gif',
        imageBtnClose:'http://www.ccm.org.br/public/js/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
        imageBlank:'http://www.ccm.org.br/public/js/jquery-lightbox-0.5/images/lightbox-blank.gif'

    });

}

var atualSplash = 0;
var idsSplash = new Array();
function setTotalSplash(){
    
    var ns = $(".splashs").length;
    var X = 0;

    if(ns > 0 ){

    $(".splashs").each(function(){
        idsSplash[X] += $(this).html();;
        X++;
        $(this).remove();
    });

    $("#splash").everyTime(5000,function(i) { splash();});
    splash();

    }
    
}
function splash(){
  
  var prox  = parseInt( atualSplash );
  var total = ( idsSplash.length - 1 );
  if( idsSplash[prox] != "" ){

       $("#splash").html(idsSplash[prox].replace(/undefined/, ""));
       //if( atual != -1 ){ $("#"+idsSplash[atual].replace(/undefined/, "")).hide(); }else{ $("#"+idsSplash[total].replace(/undefined/, "")).hide();  }
       atualSplash = prox + 1 ;
       if( atualSplash > total  ){  atualSplash = 0;    }

   }else{

   }
    for (i=0;i<idsSplash.length;i++)
{
           //alert(idsSplash[i]+"\n***********\n"+i);
}

}
