$(document).ready(function()
{
    $(document).pngFix();
    
    h = $('#content_left').height();
    height_center = $('#content_center').height();
    height_right = $('#content_right').height();
    if(h<height_center)
    	h = height_center;
    if(h<height_right)
    	h = height_right;
    $('#content_left').height(h);
    $('#content_center').height(h);
    $('#content_right').height(h);

    $(".formfield").focus(function()
    {
        if ($(this).val() == $(this)[0].title)
            $(this).val("");
    });
    
    $(".formfield").blur(function()
    {
        if ($(this).val() == "")
            $(this).val($(this)[0].title);
    });
    
    $(".formfield").blur();

    $("img.reflect").each(function(){
    	$(this).load( 
    		function(){ 
                            Reflection.add(this, { height: 2/3, opacity: 1/3 });
    		} 
    	);
    });

    $("#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;
}

