<h1><?= $this->translate('#search#') ?></h1>
<div class="searchHeadBlock">
  <?= $this->form; ?>
</div>
<div id="cse" style="width: 100%;">Loading</div>

<?php 
$this->headScript()->appendFile('http://www.google.com/jsapi');
$this->headLink()->appendStylesheet('http://www.google.com/cse/style/look/default.css');

$this->inlineScript()->captureStart(); ?>
  google.load('search', '1', {language : 'fr'});
  $(document).ready(function(){
    var customSearchControl = new google.search.CustomSearchControl('<?= $this->googleSearchKey ?>');
    customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
    customSearchControl.draw('cse');

  
<?php if($this->q):?>

	$('input.gsc-input').focus();
	$('input.gsc-input').attr('value',"<?= $this->escape($this->q) ?>");
	$('input.gsc-search-button').click();

<?php endif;?> 



});  
<?php $this->inlineScript()->captureEnd(); ?>

