
$('a.theme').live('click', function() {
  $.cookie('css', null);
  var $rel = $(this).attr('rel');
  $.cookie('css',$rel, {domain: 'zsslovanka.cz', path: '/'});
  window.location.reload();
});


// ITC Officina Serif Std
Cufon.replace('.cufon',  {fontFamily:'ITC Officina Serif Std', hover: true});	
Cufon.replace('.nadpis a',  {fontFamily:'OfficinaSerifC', hover: true});	

function getCss() {
  var $css = $.cookie('css');  
  
  if( $css != null )
    return $css;
  
  var d = new Date();
  var month = d.getMonth();
  var day = d.getDate();
  var css = '';
  month++;
  // check border in winter
  if( month == 12 && day >= 21 ) {
    css = 'winter';
  }
  else if( month == 12 ) {
    css = 'autumn';
  }
  
  // check border in springs
  if( ( month == 3 || month == '03')  && day >= 21 ) {
    css = 'spring';
  }
  else if( month == 3 ) {
    css = 'winter';
  }
  
  // check border in springs
  if( ( month == 6 || month == '06')  && day >= 21 ) {
    css = 'summer';
  }
  else if( month == 6 ) {
    css = 'spring';
  }
  
  // check border in springs
  if( ( month == 9 || month == '09' )  && day >= 23 ) {
    css = 'autumn';
  }
  else if( month == 9 ) {
    css = 'summer';
  }
  
  if( css != '' ) {
    return css;
  }
  else {
    if( month == 1 || month == 2 )
      css = 'winter';
    else if( month == 4 || month == 5  ) 
      css = 'spring';
    else if( month == 7 || month == 8  ) 
      css = 'summer';
    else if( month == 10 || month == 11  ) 
      css = 'autumn';
  }
  
  return css;
}



$(document).ready(function() {
    
    $('.tooltip').tipsy();
    
    
  $('.leftMenu .kalendar .top').html('<img src="/gfx/' + getCss() + '/kalendar.png" alt="Kalendář"/>');
    
  $.cookie('css',getCss(),{domain: 'zsslovanka.cz', path: '/'});
    
  $('.header .page').mouseover(function() {
    $(this).addClass("page-hover");
  });
    
  $('.header .page').mouseout(function() {
    $(this).removeClass("page-hover");
  });
    
  $('#sddm  li').has('ul').mouseover(function() {
    $(this).addClass("active");
    $('ul:first', $(this)).show();
  });
    
  $('#sddm  li').has('ul').mouseout(function() {
    $(this).removeClass("active");
    $('ul:first', $(this)).hide();
  });
  
  $('#sddm li ul li:last-child').addClass('last');
    
  jQuery('#hpcarousel').jcarousel();
  $(".fg_profil_3 a").colorbox({slideshow:false});

  $(".kalendar td a").tipsy('calendar', 'title');
});  
