window.animation_speed = 150;

function signUp()
{
  // Toggle the sign up form
  $('#toggle_signin').hide(window.animation_speed);
  $('#toggle_signup').toggle(window.animation_speed, function (){$('input#firstname').focus();} );
  return false;
}

function signIn()
{
  // Toggle the sign up form
  $('#toggle_signup').hide(window.animation_speed);
  $('#toggle_signin').toggle(window.animation_speed, function (){$('input#u_email').focus();} );  
  return false;
}

function closeSignIn()
{
  // Toggle the sign up form
  $('#toggle_signin').hide(window.animation_speed);
  return false;
}

function closeSignUp()
{
  // Toggle the sign up form
  $('#toggle_signup').hide(window.animation_speed);
  return false;
}

//function siteMenuClose()
//{
//  return siteMenu();
//}

//function siteMenu()
//{
  // Toggle the sign up form
//  $('#site_menu_links').show(window.animation_speed);
//  return false;
//}

function closeIssueBar()
{
  // Toggle the sign up form
  $('#issue_bar').toggle(window.animation_speed);
  return false;
}

function activateIssueBar()
{
  // Does nothing at the moment in Ecards
}

function trialService()
{
  // Disable the credit card fields
  $('.required').each(function(i) {this.disabled = 'true'; this.value = ''});
  $('#cc_form').hide(window.animation_speed * 2);
  $('#ccc_form').hide(window.animation_speed * 1);
  $('#assuring_hint').hide(window.animation_speed * 1);
}

function purchaseService()
{
  // Enable credit card fields
  $('.required').each(function(i) {this.disabled = '';});
  $('#cc_form').show(window.animation_speed * 2);
  $('#ccc_form').show(window.animation_speed * 1);
  $('#assuring_hint').show(window.animation_speed * 1);
}


function siteMenu()
{
  $('#site_menu_links').fadeIn(250);
}

function siteMenuClose()
{
  $('#site_menu_links').fadeOut(250);
}

function toggleCheckbox(does_not_need_consent, parental_guidance, email_field_id)
{
  var lyr = document.getElementById(parental_guidance);
  var checkbox = document.getElementById(does_not_need_consent);
  var email_field = document.getElementById(email_field_id);
  
  if (checkbox.checked == false)
  {
    // If we need concent
    lyr.style.display = 'block';
    email_field.className = 'input required';
  }
  else
  {
    // If we don't need the email address for concent
    lyr.style.display = 'none';
    email_field.className = 'input';
  }
}

// Contacts list.
function showEdit(i) { // Toggle the edit/remove form
//  $('#view_contact_'+i).toggle('fast');

	$('#view_the_contact_'+i).toggle();
	$('#edit_remove_contact_'+i).toggle();
  return false;
}
var ADD_A_SPECIAL_DATE = null;
function showEventAdd(i) { // Toggle the edit/remove form
  $('#add_event_'+i).toggle();
	
	ADD_A_SPECIAL_DATE = ADD_A_SPECIAL_DATE || $('#add_event_href_' + i).text();
	if ($('#add_event_href_' + i).text() == ADD_A_SPECIAL_DATE) {
  	$('#add_event_href_' + i).text('Cancel');
  }else{
		$('#add_event_href_' + i).text(ADD_A_SPECIAL_DATE);
	}
  return false;
}

function showEventEdit(i) { // Toggle the edit event form
	$('#event_'+i).toggle();
	$('#edit_event_'+i).toggle();
 	return false;
}
