function sendToFriendValidation()
{      
      var IsValid;
      if (!isValidEmail(document.getElementById("RecipientEmail").value))
      {
            
            document.getElementById("RecipientEmail").value = "Valid e-mail required";
            document.getElementById("RecipientEmail").style.color = "red";           
            IsValid = false;            
      }     
      else
      {
            IsValid = true;
      }
      if (!isValidEmail(document.getElementById("YourEmail").value))
      {
            document.getElementById("YourEmail").value = "Valid e-mail required";
            document.getElementById("YourEmail").style.color = "red";        
            IsValid = false;
      } 
      else
      {
            IsValid = true;
      }
      
      var FormNames = "RecipientName|RecipientLastName|YourName|YourLastName";
      for(var i = 0; i < FormNames.split('|').length; i++)
      {          
          if(document.getElementById(FormNames.split('|')[i]).value == '')
          {
             document.getElementById(FormNames.split('|')[i]).value = "*";   
             document.getElementById(FormNames.split('|')[i]).style.color = "red";
             IsValid = false;
          }     
      } 
      if(IsValid == true)
      {
         sendWithClick();         
      }
      return IsValid;      
  }
  
  function sendToFreindValidationCaptureEnterKey()
  {      
       document.onkeydown = null;
       document.onkeydown = sendToFriendValidationKeyBoardEvents;                     
       if(window.addEventListener)
       {        
            window.addEventListener("keydown", sendToFriendValidationKeyBoardEvents, false);            
       }     
  }    
  
  function sendToFriendValidationKeyBoardEvents(evt)
  {
      var keyCode = document.layers ? evt.which : document.all ? event.keyCode : document.getElementById ? evt.keyCode : 0;
      
      if(keyCode == 13)
      {             
          if(sendToFriendValidation() == true)
          {                                  
              var button = document.getElementById("sendToFriendHidden");              
              button.click();                                 
          }              
          else
          {
              return false;
          }                
      }     
  }  
  
  function sendWithClick()
  {
      var button = document.getElementById("sendToFriendHidden");              
      button.click(); 
  }