function RegisterNewsletter(){
    var errors = "" ;
    x = $('#txtVisitorName').val();
    if ((x == "") || (x == "الاسم")) errors += 'Name must not be empty.\n';          
    
    x = $('#txtVisitorEmail').val(); 
    if ((x == "") || (!validate_email(x))) errors += 'Email must not be empty.\n';    

    if (errors) 
        alert('Please fill-in the missing fields : \n' + errors);
    else {        
        $.ajax({
            type: "POST",
            url: "ajaxFc.php",
            data:   "visitorName=" + $('#txtVisitorName').val() + 
                    "&visitorEmail=" + $('#txtVisitorEmail').val() +
                    "&countryId=" + $('#cmbCountries').val() +
                    "&action=Newsletter",
            success: function(html){
                $("#divNewsletter").html(html);               
            }
        });
    }        
} 

function validate_email(field, alerttxt)
    {
    with (field)
      {
          apos = field.indexOf("@");
          dotpos = field.lastIndexOf(".");
          if (apos <1 || dotpos-apos < 2)  {
              if (alerttxt != "") alert(alerttxt);
              return false;
          } else {
              return true;
          }
      }
    } 

function contactUs()
{
    var errors = "" ;
    x = $('#txtGuestName').val();
    if (x == "") errors += 'Name must not be empty.\n';                   

    x = $('#txtGuestEmail').val(); 
    if ((x == "") || (!validate_email(x))) errors += 'Email must not be empty.\n';
    
    x = $('#txtMessage').val();
    if (x == "")  errors += 'Message must not be empty.\n';    

    
    if (errors) 
        alert('Please fill-in the missing fields : \n' + errors);
    else {        
        $.ajax({
            type: "POST",
            url: "ajaxFc.php",
            data:   "name=" + $('#txtGuestName').val() +
                    "&email=" + $('#txtGuestEmail').val() +  
                    "&country=" + $('#cmbGuestCountries').val() +   
                    "&inquiry=" + $('#txtMessage').val() + 
                    "&action=ContactUs",
            success: function(html){
                $("#divContactUs").html(html);               
            }
        });
    }      
}
