$(document).ready(function()
{
    $(document).pngFix();
    
    // fill form fields 
    $(".formfield").focus(function()
    {
        if ($(this).val() == $(this)[0].title)
            $(this).val("");
    });
    
    $(".formfield").blur(function()
    {
        if ($(this).val() == "")
            $(this).val($(this)[0].title);
    });
    $(".formfield").blur();

    // contact form
    $("#fcontact").submit(fContact_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 fContact_OnSubmit()
{
  if(!checkStringValue('name', 'Name'))
    return false;
  if(!CheckEmail('email'))
	    return false;
  if(!checkStringValue('phone', 'Phone'))
    return false;
  if(!checkStringValue('message', 'Message'))
    return false;

  return true;
}

