<? global $lang, $config; ?>
<div id="contact-left">
  <? if (  \admin\factory\Settings::getSystemSettings( 'google_map_key' ) && \admin\factory\Settings::getSystemSettings( 'street' ) && \admin\factory\Settings::getSystemSettings( 'city' ) ):?>
    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?= \admin\factory\Settings::getSystemSettings( 'google_map_key' );?>' type='text/javascript'></script>
    <script type='text/javascript'>
      $(document).ready(function()
      {
        map       = new GMap2(document.getElementById( 'mapa' ));
        var geo   = new GClientGeocoder();
        var adres = '<?= \admin\factory\Settings::getSystemSettings( 'street' ) . ' ' .  \admin\factory\Settings::getSystemSettings( 'city' );?>';
        geo.getLatLng(adres,function(punkt){
        map.setCenter(punkt,16);
        map.addOverlay(new GMarker(punkt));
        map.panTo(punkt);
        map.setUIToDefault();
        });
      });
    </script>
    <div id='mapa'></div>
  <? endif;?>  
  <?
  if ( isset( $this -> _contact_form ) && $this -> _contact_form == 1 )
  {
    ?>
    <div class="contact">
      <div class="line">
        <?= ucfirst( $lang -> getTrans( 'T_TWOJ_EMAIL' ) );?>:<br />
        <input type='text' id="email" />
      </div>
      <div class="line">
        <?= ucfirst( $lang -> getTrans( 'T_TEMAT' ) );?>:<br />
        <input type='text' id="subject" value="Zapytanie ze strony <?= $config['page'];?>" />
      </div>
    </div>
    <div class="contact">
      <div class="line">
        <?= ucfirst( $lang -> getTrans( 'T_TRESC' ) );?>:<br />
        <textarea id="text" cols='35' rows='6'></textarea>
      </div>
    </div>
    <div class="contact">
      <a class='button' onClick='sendContactForm();'><?=$lang -> getTrans( 'T_WYSLIJ' );?></a>
    </div>
    <?
  }
  ?>
  <div class="contact_details">
    <h2>Adres</h2>
    <? if ( isset( $this -> _firm_name ) && $this -> _firm_name ):?>
      <div class="bold"><?= $this -> _firm_name;?></div>
    <? endif;?>
      <div class="line"><?= $this -> _street;?></div>
      <div class="line"><?= $lang -> getTrans( 'T_TEL' ) . ' ' . $this -> _phone;?></div>
      <div class="line"><?= $this -> _postal_code . ' ' . $this -> _city;?></div>
      <div class="line"><a href="mailto:'<?= $this -> _email;?>"><?= $this -> _email;?></a></div>
    <? if ( isset( $this -> _info ) ):?>
      <div class="clearfix" style="margin: 10px 0;"><?= $this -> _info;?></div>
    <? endif;?>
  </div>
</div>
<div class="clearfix"></div>
<script type='text/javascript'>
  function sendContactForm()
  {
    var email   = $("#email").val();
    var subject = $("#subject").val();
    var text    = $("#text").val();
    $.prompt( '<?=$lang -> getTrans( 'T_TRWA_WYSYLANIE_FORMULARZA' );?>', { title: 'Komunikat', buttons: { 'Zamknij': true }, focus: 1 });
    xajax_sendContactForm( email, subject, text, '<?= mktime();?>'  );
  }
</script>