{assign var='page_lang' value=$cgsimple->get_root_alias()}
{global_content name='header'}
  <!-- START CONTENT -->

{content}

<!-- IF RO -->
{if 'ro' === $page_lang }

{* ROMANA *}
{assign var='FullName' value='Nume Prenume'}
{assign var='Company' value='Companie'}
{assign var='Phone' value='Telefon'}
{assign var='Email' value='E-mail'}
{assign var='Message' value='Mesaj...'}
{assign var='Submit' value='Trimite mesaj'}

{else}<!-- ELSE EN -->

{* ENGLEZA *}
{assign var='FullName' value='Full Name'}
{assign var='Company' value='Company'}
{assign var='Phone' value='Phone'}
{assign var='Email' value='Email'}
{assign var='Message' value='Message...'}
{assign var='Submit' value='Send'}

{/if}<!-- END IF -->

<div id="contact_form_vismark" class="content_page bgk_gray">
    <div class="text">
      <div class="container about pbottom60 ptop30 contact">
        <div class="row text-center">
        {if 'en' === $page_lang}
          <h3 class="title pbottom0">Get In Touch</h3>
          <p>We're here for you, and we're wearing our thinking caps. <br> You might also find what you're looking for by visiting our <a href="{cms_selflink href='faq'}">FaQ</a> page.</p>
        {else}
          <h3 class="title pbottom0">Contacteaza-ne</h3>
          <p>Iti vom raspunde intr-un timp foarte scurt. <br> Daca mai ai si alte intrebari, te invitam sa accesezi sectiunea <a href="{cms_selflink href='intrebari-frecvente'}">FaQ</a>.</p>
        {/if}
        </div>
        <div id="result" class="form-group text-center"></div>
        <div class="contact-form">
            <form id="contact_form" action="">
            <input type="hidden" name="page_lang" value="{$page_lang}">
              <div class="form-group">
                <input type="text" name="FullName" id="FullName" class="form-control input-lg" placeholder="{$FullName}" required style="margin: 0;">
              </div>
              <div class="form-group">
                <input type="text" name="Company" id="Company" class="form-control input-lg" placeholder="{$Company}" style="margin: 0;">
              </div>
              <div class="form-group">
                <input type="text" name="Phone" id="Phone" class="form-control input-lg" placeholder="{$Phone}" required style="margin: 0;">
              </div>
              <div class="form-group">
                <input type="text" name="Email" id="Email" class="form-control input-lg" placeholder="{$Email}" required style="margin: 0;">
              </div>
              <div class="form-group">
                    <textarea name="Message" id="Message" rows="6" class="form-control input-lg" placeholder="{$Message}" required></textarea>
              </div>
              <div class="form-group">
                    <input type="submit" value="{$Submit}" class="btn-block" style="margin-top:0;">
                    <div id="error_container" class="hide"></div>
              </div>
            </form>
            <script src="/js/bootstrapValidator.min.js"></script>
            <script>
                $(document).ready(function() {
                    $('#contact_form').bootstrapValidator({
                        container: '#error_container',
                        excluded: [':disabled', ':hidden', ':not(:visible)'],
                        message: ' ',
                        feedbackIcons: {
                            valid: 'fa fa-check',
                            invalid: 'fa fa-times',
                            validating: 'fa fa-refresh'
                        },
                        live: 'enabled',
                        fields: {
                            Phone: { // Nume
                                validators: {
                                    regexp: {
                                        regexp: /^[0-9]+$/i,
                                    }
                                }
                            },
                            Email: { //Email
                                validators: {
                                    emailAddress: {}
                                }
                            }
                        } // Fileds Obj.   
                    })
                    .on('success.field.fv', function(e, data) {
                        if (data.fv.getInvalidFields().length > 0) {    // There is invalid field
                            data.fv.disableSubmitButtons(true);
                        }
                    })
                    .on('success.form.bv', function(e) {
                      // Prevent default form submission
                      e.preventDefault();

                      var $form = $(e.target);

                      // Send all form data to back-end
                      $.ajax({
                          url: 'contact_process.php',
                          type: 'POST',
                          data: $form.serialize(),
                          dataType: 'json',
                          success: function(response) {
                              if(response.type == 'error')
                              {
                                  output = response.text;
                              }else{
                                  output = response.text; 
                                  $form.bootstrapValidator('resetForm', true);
                              }
                              $("#result").hide().html(output).slideDown();

                          }
                      }); //ajax
                    }); //ON function
                });
            </script>
        </div>
      </div>
    </div>
  </div>

  <!-- END CONTENT -->
  {global_content name='footer'}