$(document).ready(function()
{
  //$('#competition-enter-details').hide();
  //$('#competition-terms-conditions').hide();

  /*
  $('#show-competition-tc').click(function()
  {
    $('#competition-details').hide();
    $('#competition-terms-conditions').show();
    return false;
  });
  
  $('#close-competition-tc').click(function()
  {
    $('#competition-details').show();
    $('#competition-terms-conditions').hide();
    return false;
  });
  
  
  $('#competition-enter-now').fancybox({
    'overlayOpacity'  :  0.3,
    'overlayColor'    :  '#000',
    'hideOnContentClick': false,
    'frameHeight' : 520,
    'frameWidth' : 670
  });*/
  
  $('#subscribe').live('click', function()
  {
    $(this).trigger('change');
  });
  $('#subscribe').live('change', function()
  {
    //alert($(this).is(':checked'));
    var checked = $(this).is(':checked');
    var subscribeForm = $(this).parents('form').find('#subscribe-form');
    
    if (checked)
    {
      $(subscribeForm).show();
    }
    else
    {
      $(subscribeForm).hide();
    }
    });
    $('#subscribe').trigger('change');
    $('#signup-username, #signup-firstname, #signup-lastname, #signup-phone').attr('readonly', true);

    $('#first_name').live('keyup', function(){
        $(this).parents('form').find('#signup-firstname').val($(this).val());
    });
    $('#surname').live('keyup', function(){
        $(this).parents('form').find('#signup-lastname').val($(this).val());
    });
    $('#email').live('keyup', function(){
        $(this).parents('form').find('#signup-username').val($(this).val());
    });
    $('#phone').live('keyup', function(){
        $(this).parents('form').find('#signup-phone').val($(this).val());
    });

  //On Blur copy competition details to signup form
    $('#first_name').blur(function() {
        $(this).parents('form').find('#signup-firstname').val($(this).val());
    });
    $('#surname').blur(function() {
        $(this).parents('form').find('#signup-lastname').val($(this).val());
    });
    $('#email').blur(function() {
        $(this).parents('form').find('#signup-username').val($(this).val());
    });
    $('#phone').blur(function() {
        $(this).parents('form').find('#signup-phone').val($(this).val());
    });
  
});
/*
$(window).ready(function() {
  $('.scrollable-content').height($('.scrollable-content .items').height());
  $('.scrollable-content').scrollable({size:1,clickable:false}).navigator({indexed:true, navi: ".navi-content"});
  if($('.navi-content').children().length == 1) {
    $('.navi-content').css({visibility:"hidden"});
  }
  $('.navi-content').children().each(function(i){
    var elements = $(this).children().children();
    if(elements.length == 1) {
      $(this).children().addClass('one-item');
    }
  });
});
*/
