$(document).ready(function()
{
  //--  
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
  	sfEls[i].onmouseover=function() {
  		this.className+=" sfhover";
  	}
  	sfEls[i].onmouseout=function() {
  		this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
  	}
  }

  //--  
  $(".formfield").focus(function()
  {
      if ($(this).val() == $(this)[0].title)
          $(this).val("");
  });
  
  $(".formfield").blur(function()
  {
      if ($(this).val() == "")
          $(this).val($(this)[0].title);
  });
  
  $(".formfield").blur();
  
  $("#fLogin").submit(fLogin_OnSubmit);
  $("#fSubscribe").submit(fSubscribe_OnSubmit);
});

function checkStringValue(InputID, DisplayLabel)
{
  if(!CheckString(InputID, DisplayLabel))
    return false;
  if($("#"+InputID).val()==$("#"+InputID)[0].title)
  {
    $("#"+InputID).focus();
    alert('Specify '+DisplayLabel+', please.');
    return false;
  }
  return true;
}

function fLogin_OnSubmit()
{
  if(!CheckEmail('LoginUserName'))
    return false;
  if(!checkStringValue('LoginPassword', 'Password'))
    return false;

  return true;
}

function fSubscribe_OnSubmit()
{
  if(!CheckEmail('SubscribeEmail'))
    return false;

  return true;
}

