function PeriodicallySwitchForm()
{
  if( ($('#greetingMsg').val() == undefined || $('#greetingMsg').val() == '') && ($('#greetingName').val() == undefined || $('#greetingName').val() == '') )
  { 
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: 'index.php?module=greetings&action=callSwitcher',
      async: false
    }).responseText;
    $('#greetingsFormSwitcher').html(html);
  }
}
  
$(document).ready(function(){
  /*
   * Zdarzenie dla buttona 'Dodaj trase' na stronie glownej
   * author: Robert Alabrudzinski
   */

  $('#lnGreetingsSwitcher').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
        //$('#CreateTourLoader').hide();
      }
    }).responseText;
    $('#GreetingsSwitcherFeedback').html(html);
    return false;
  });
  
  $('.lnGreetingsIsPublished').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
      }
    }).responseText;
    $(this).parents('.boxGreetingsIsPublished').html(html);
    return false;
  });
  
  $('.lnGreetingsPublishAgain').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
      }
    }).responseText;
    $('#greetingsList').html(html);
    return false;
  });
  
  $('#BtnSendGreeting').livequery('click',function(){
    $('#SendGreetingLoader').show();
    var html = $.ajax({
      type: 'POST',
      data: $(this).parents('form').serialize(),
      dataType: 'html',
      url: $(this).parents('form').attr('action'),
      async: false,
      success: function(){
        $('#SendGreetingLoader').hide();
      }
    }).responseText;
    $('#SendGreetingFeedback').html(html);
    return false;
  });
  
  $('.lnGBookIsPublished').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
      }
    }).responseText;
    $(this).parents('.boxGBookIsPublished').html(html);
    return false;
  });
  
  $('.lnGBookAdd').livequery('click',function(){
    $('#SendGBookForm').show();
    $(this).hide();
    $('.lnGBookHide').show();
    return false;
  });
  
  $('.lnGBookHide').livequery('click',function(){
    $('#SendGBookForm').hide();
    $('.lnGBookAdd').show();
    $(this).hide();
    return false;
  });
  
  $('#BtnSendGBook').livequery('click',function(){
    $('#SendGBookLoader').show();
    var html = $.ajax({
      type: 'POST',
      data: $(this).parents('form').serialize(),
      dataType: 'html',
      url: $(this).parents('form').attr('action'),
      async: false,
      success: function(){
        $('#SendGBookLoader').hide();
      }
    }).responseText;
    $('#SendGBookFeedback').html(html);
    return false;
  });
  
  $('.lnToplistIsAccepted').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
      }
    }).responseText;
    $(this).parents('.boxToplistIsAccepted').html(html);
    return false;
  });
  
  $('.lnVote').livequery('click',function(){
    var html = $.ajax({
      type: 'GET',
      dataType: 'html',
      url: $(this).attr('href'),
      async: false,
      success: function(){
      }
    }).responseText;
    $('#toplistList').html(html);
    return false;
  });
  
  $('#BtnToplistAdd').livequery('click',function(){
    $('#toplistAddIndicator').show();
    var html = $.ajax({
      type: 'POST',
      data: $(this).parents('form').serialize(),
      dataType: 'html',
      url: $(this).parents('form').attr('action'),
      async: false,
      success: function(){
        $('#toplistAddIndicator').hide();
      }
    }).responseText;
    $('#toplistAddFeedback').html(html);
    return false;
  });
});
