<?PHP
/*
    Contact Form from HTML Form Guide
    This program is free software published under the
    terms of the GNU Lesser General Public License.
    See this page for more info:
    http://www.html-form-guide.com/contact-form/creating-a-contact-form.html
*/
require_once("./include/fgcontactform.php");
require_once("./include/captcha-creator.php");

$formproc = new FGContactForm();
$captcha = new FGCaptchaCreator('scaptcha');

$formproc->EnableCaptcha($captcha);

//1. Add your email address here.
//You can add more than one receipients.
ini_set('sendmail_from','Strngmontacargas@gmail.com');
$formproc->AddRecipient('Strngmontacargas@gmail.com'); //<<---Put your email address here


//2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
// and put it here

$formproc->SetFormRandomKey('CnRrspl1FyEylUj');


if(isset($_POST['submitted']))
{
   if($formproc->ProcessForm())
   {
        $formproc->RedirectToURL("thank-you.php");
   }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
      <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
      <title></title>
      <link rel="STYLESHEET" type="text/css" href="contact.css" />
       <link href="UnispaceCSS/unispace.css" rel="stylesheet" type="text/css" />
       <link href="AmbleCSS/amble.css" rel="stylesheet" type="text/css" />
      <script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<script type='text/javascript' src='scripts/fg_captcha_validator.js'></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

-->
</style></head>
<body>

<!-- Form Code Start -->
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text'  class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
</legend>
<div class='short_explanation'>* campos requeridos</div>

<div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div>
<div id="campos-izquierda">
  <div class='container'>
    <label for='name' >Nombre</label>
    <input type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' 
    maxlength="50" /><br/>
        <span id='contactus_name_errorloc' class='error'></span>
  </div>
  <div class='container'>
    <label for='email' >Email</label>
    <input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
    <span id='contactus_email_errorloc' class='error'></span>
  </div>
  <div class='container'>
    <label for='tel' >Teléfono</label>
   
    <input type='text' name='tel' id='tel' value='<?php echo $formproc->SafeDisplay('phone') ?>' maxlength="15" /><br/>
    <span id='contactus_phone_errorloc' class='error'></span>
  </div>
  
</div>
<div class='container-mensaje'>
  <label for='mensaje' >Mensaje</label>
   
    <textarea rows="10" cols="600" name='mensaje' id='mensaje'><?php echo $formproc->SafeDisplay('message') ?></textarea><br/> <span id='contactus_message_errorloc' class='error'></span>
</div>
<div class='container-mensaje01'>
    <div style="width:auto; float:left"><img src='show-captcha.php?rand=1' alt='Captcha image' align="middle" id='scaptcha_img' /></div>
    <label for='scaptcha' style="padding-top:5px; padding-right:5px;"></label>
    <input type='text' name='scaptcha' id='scaptcha' maxlength="10" /><br/>
    <span id='contactus_scaptcha_errorloc' class='error'></span>
    <div class='short_explanation'>No puede leer la imagen?
    <a href='javascript: refresh_captcha_img();'>Click aqui para refrescar</a>.</div>
</div>


<div class='container-enviar'>
  <input type='submit' name='Submit' value='ENVIAR' />
</div>

</fieldset>
</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->

<script type='text/javascript'>
// <![CDATA[

    var frmvalidator  = new Validator("contactus");
    frmvalidator.EnableOnPageErrorDisplay();
    frmvalidator.EnableMsgsTogether();
    frmvalidator.addValidation("name","req","Por favor ingrese su nombre");

    frmvalidator.addValidation("email","req","Por favor ingrese su email");

    frmvalidator.addValidation("email","email","Por favor ingrese un email valido");
	
	frmvalidator.addValidation("tel","req","Por favor ingrese su telefono");
	
	frmvalidator.addValidation("mensaje","req","Por favor ingrese su consulta");

    frmvalidator.addValidation("mensaje","maxlen=2048","El mensaje es demasiado largo!(mas de 2KB!)");


    frmvalidator.addValidation("scaptcha","req","Por favor ingrese el codigo de arriba");

    document.forms['contactus'].scaptcha.validator
      = new FG_CaptchaValidator(document.forms['contactus'].scaptcha,
                    document.images['scaptcha_img']);

    function SCaptcha_Validate()
    {
        return document.forms['contactus'].scaptcha.validator.validate();
    }

    frmvalidator.setAddnlValidationFunction("SCaptcha_Validate");

    function refresh_captcha_img()
    {
        var img = document.images['scaptcha_img'];
        img.src = img.src.substring(0,img.src.lastIndexOf("?")) + "?rand="+Math.random()*1000;
    }

// ]]>
</script>


</body>
</html>