function InitPageContact()
{
  $('#FormContactSubject').change(SubjectChange);
  $('#SubmitContact').click(SubmitContactClicked);
}


function SubjectChange()
{
  //alert($('#FormContactSubject').val());

  if($('#FormContactSubject').val() == 'Report Bug')
  {
    $('#MessageArea').addClass('invisible');
    $('.FormContactRightCol').removeClass('invisible');
  }
  else
  {
    $('#MessageArea').removeClass('invisible');
    $('.FormContactRightCol').addClass('invisible');
  }
}


function CheckReqFields()
{
  var Shemp = '';


  if($('#FormContactFullName').val().length == 0)
  {
    alert('Please enter your Name.');
    return false;
  }

  Shemp = $('#FormContactEmail').val();
  if(Shemp.length == 0)
  {
    alert('Please enter your E-MailAddress.');
    return false;
  }
  if(ValidEmail(Shemp) == false)
  {
    alert('Please enter a valid E-MailAddress.');
    return false;
  }

  if($('#FormContactSubject').val() == 0)
  {
    alert('Please select a subject.');
    return false;
  }

  if($('#FormContactSubject').val() != 'Report Bug')
  {
    if($('#FormContactText').val().length == 0)
    {
      alert('Please enter your message.');
      return false;
    }
  }
  else
  {
    if($('#BugInfo').val().length == 0)
    {
      alert('Please enter a description of the bug.');
      return false;
    }
  }

  return true;
}

function SubmitContactClicked()
{
  if(CheckReqFields() == false)
    return;

  $('#FormContact').submit();
}


function LazyDebugger()
{
  var WhatYouSay = confirm("You just hit the secret developer button which will replace anything you've entered on this form.  " +
                           "(This function is only available when logged in as Admin.)");

  if(WhatYouSay == false)
    return;


  $('#FormContactFullName').val('Developer Test');
  $('#FormContactUsername').val('Fhqwhgads');
  $('#FormContactEmail').val(DevMail);
  $('#FormContactPhone').val('1 2 3, ah! ah! ah!');
  $('#FormContactOrgMan').val('DJ Mankiewicz');
  $('#FormContactSubject').val('Report Bug');
  SubjectChange();
  $('#FormContactText').val('Developer Test; this is the regular message field.');
  $('#Url1').val('http://www.biophase.com/');
  $('#Url2').val('http://www.biophase.com/404');
  $('#MemberId').val('Developer');
  $('#OtherId').val('Hremail #24');
  $('#BugInfo').val('Developer Test; this is the bug report field.');
}

