jQuery(function($)
{
  $(document).ready(function()
  {
    // toggleBlock
    $('input[rel=toggleBlock]').click(function(){
	    if ($.browser.msie)
	    {
	      if ($(this).attr('checked'))
	      {
	        $('#'+$(this).attr('block')).show();
	      }
	      else
	      {
	        $('#'+$(this).attr('block')).hide();
	      }
	    }
	    else
	    {
	      if ($(this).attr('checked')=='checked')
	      {
	        $(this).attr('checked', '');
	        $('#'+$(this).attr('block')).hide();
	      }
	      else
	      {
	        $(this).attr('checked', 'checked');
	        $('#'+$(this).attr('block')).show();
	      }
	    }       
    });
        
  
    if ( $('#later') )
    {
      $('#later').next('label').attr('for', 'later');
    }
  
    $('#later').click(function()
    {
	    if ($.browser.msie)
	    {
	      switchState( $(this).attr('checked') );
	    }
	    else
	    {
	      if ($(this).attr('checked')=='checked')
	      {
	        $(this).attr('checked', '');
	        switchState( false );
	      }
	      else
	      {
	        $(this).attr('checked', 'checked');
	        switchState( true );
	      }
	    }
    });
  });
});

function switchState( state )
{
  if (state)
  {
    $('#customer_personal_info').hide();
    $('#submit_all').val( $('#submit_all').attr('ht') );
  }
  else
  {
    $('#customer_personal_info').show();
    $('#submit_all').val( $('#submit_all').attr('st') );
  }
}
