var d=''; var ctrl; $(document).ready(function(){ init_lbox(); }); function init_lbox(){ $('.button_lb_chart').click(function(){ //$('.button_lb_chart').live('click', function(){ d = $(this).attr('name'); ctrl = $(this).attr('ctrl'); }); $('.button_lb_pdf').click(function(){ //$('.button_lb_pdf').live('click', function(){ d = $(this).attr('name'); ctrl = $(this).attr('ctrl'); $('.current_button').removeClass('current_button'); $(this).addClass('current_button'); }); $(".button_lb_chart").fancybox({ 'width':670, 'height':585, 'transitionIn':'elastic', 'transitionOut':'elastic', 'speedIn':500, 'speedOut':500, 'type':'html', 'onStart':function(selectedArray,selectedIndex,selectedOpts){ selectedOpts.content=''; } }); $(".button_lb_pdf").fancybox({ 'transitionIn':'elastic', 'transitionOut':'elastic', 'speedIn':500, 'speedOut':500, 'type':'html', 'onStart':function(selectedArray,selectedIndex,selectedOpts){ var m='year'; if(d.indexOf('-')>=0){m='month';}selectedOpts.content=''; } }); }