<center>
<?php
if(isset($_POST['motcle'])) {

$motcle = stripslashes($_POST['motcle']);
// on remplace les caractères spéciaux
$motcle = str_replace(array('à','á','â','ã','ä','å'),'a',$motcle);
$motcle = str_replace(array('ò','ó','ô','õ','ö','ø'),'o',$motcle);
$motcle = str_replace(array('è','é','ê','ë'),'e',$motcle);
$motcle = str_replace('ç','c',$motcle);
$motcle = str_replace(array('ì','í','î','ï'),'i',$motcle);
$motcle = str_replace(array('ù','ú','û','ü'),'u',$motcle);
$motcle = str_replace('ÿ','y',$motcle);
$motcle = str_replace('ñ','n',$motcle);
// passage des majuscule en minuscule
$motcle = strtolower($motcle);

$search_list = explode("\n", htmlentities($motcle));
$tmp = 0;

foreach($search_list as $search_string) {

	$url_amazon = 'http://www.amazon.fr/s/ref=sr_nr_p_n_binding_browse-b_0?rh=n%3A405322%2Ck%3A' . $search_string . '%2Cp_n_binding_browse-bin%3A383375011&keywords=' . $search_string . '&ie=UTF8&qid=1367488814&rnid=383374011'; 
    $url_amazon = str_replace(" ","+",$url_amazon);
	list($hds,$erreur) = getListHDAmazon($url_amazon);


	if(!empty($hds)) {

		foreach($hds as $unHD)
		{
			echo '<form name="allocine" method="post" action="index.php?page=BluRay&action=info">';

			echo '<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
				<td height="91" valign="bottom" background="./images/img_hd/f_hd_h.png"><table width="200" border="0" cellspacing="0" cellpadding="0">
				<tr>
				<td width="170" height="33" align="center"><input type="hidden" name="hdinfo[' . $tmp . '][titre]" value="' . $unHD['titre'] . '" /><input type="hidden" name="hdinfo[' . $tmp . '][id]" value="' . $unHD['id'] . '" /><input type="image" src="./images/fiche_valid.png" border="0" name="go" title="Selectionner cette Fiche" onmouseover="javascript:this.src=\'./images/fiche_valid1.png\';" onmouseout="javascript:this.src=\'./images/fiche_valid.png\';" /></td>
				<td align="center"><a href="http://www.amazon.fr/' . $unHD['id'] . '" target="_blank"><img src="./images/amz.png" title="Voir la Fiche Complète sur Amazon.fr" width="38" height="26" border="0" onmouseover="javascript:this.src=\'./images/amz1.png\';" onmouseout="javascript:this.src=\'./images/amz.png\';" /></a></td>
				</tr><tr><td height="33"></td><td></td></tr></table></td></tr><tr>
				<td background="./images/img_hd/f_hd_c.png">';

			echo '<div class="films" ><table border="0" cellspacing="0" cellpadding="0">';
			echo '<tr><td width="10"></td><td rowspan="2">';
            echo '<div style="background:url(./images/list/dvd.png); ">
<img src="' . $unHD['affiche'] . '" width="100" height="136" style="border: 15px solid transparent;" title="Affiche de ' . $unHD['titre'] . '" /></div></td><td width="30"></td><td width="550"><div style="border:#000000 1px solid; background:url(./images/list_film.gif); background-repeat: repeat-x;">';
			echo '<span class="noir"><strong>Titre :</strong> ' . $unHD['titre'] . '</span><br />';
			echo '<span class="noir"><strong>Auteurs :</strong> ' . $unHD['auteur'] . '</span><br />';
			echo '<span class="noir"><strong>Date :</strong> ' . $unHD['date'] . '</span>';

			echo '</div></td></tr>';
			echo '</table></center></div>';

			echo '<br /></td></tr><tr><td height="13" background="./images/img_hd/f_hd_b.png"></td></tr></table>';

			echo '</form><br />';
			$tmp++;
		}

		}else{
		if(!empty($erreur)) {
		echo '<center><meta http-equiv="refresh" content="5;url='.$PHP_SELF.'?page=BluRay" />
			<div style="background-color:#FFCCCC; border:#000000 1px double; width:100%">
			<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
			<td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0" /></td>
			<td width="100%" align="center" valign="middle"><p>/!\ --- ### ATTENTION ### --- /!\</p>
			<p>Une erreur s\'est produite, Veuillez nous en escuser ....</p>
			<p>&raquo; La cause de cette erreur est certainement due au serveur interne de FREE</p>
			<p>&raquo; Veuillez patientez le temp de la maintenance des techniciens de FREE et utiliser la version Prez-Manuelle</p>
			<p>(Redirection dans 5 secondes)</p></td>
			<td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0" /></td>
			</tr></table></div><br /><a href="index.php?page=BluRay"><input name="manuel" value="manuel" type="hidden" /><img src="./images/err.png" title="Erreur de recherche" border="0" onmouseover="javascript:this.src=\'./images/err1.png\';" onmouseout="javascript:this.src=\'./images/err.png\';" /></a><br />
<script language="javascript" type="text/javascript">
//<![CDATA[
google_ad_client = "pub-5294692897836007" ;
/* 468x60, date de création 22/03/09 pour liste non trouvé */
google_ad_slot = "4491154872";
google_ad_width = 468;
google_ad_height = 60;
//]]>
</script>
<script language="javascript" type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></center>';

	}else {

	echo '<center><meta http-equiv="refresh" content="5;url='.$PHP_SELF.'?page=BluRay" />
		<div style="background-color:#FFCCCC; border:#000000 1px dashed; width:100%">
		<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
		<td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0" /></td>
		<td width="100%" align="center" valign="middle"><p>/!\ --- ### ATTENTION ### --- /!\</p>
		<p>&quot; Vous avez specifié un mot clé incorrect , ou il n\'existe pas &quot;</p>
		<p>Veuillez retaper un mot clé svp ...</p>
		<p>(Redirection dans 5 secondes)</p></td>
		<td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0" /></td>
		</tr></table></div><br /><a href="index.php?page=BluRay"><input name="manuel" value="manuel" type="hidden" /><img src="./images/err.png" title="Erreur de recherche" border="0" onmouseover="javascript:this.src=\'./images/err1.png\';" onmouseout="javascript:this.src=\'./images/err.png\';" /></a><br />
<script language="javascript" type="text/javascript">
//<![CDATA[
google_ad_client = "pub-5294692897836007" ;
/* 468x60, date de création 22/03/09 pour liste non trouvé */
google_ad_slot = "4491154872";
google_ad_width = 468;
google_ad_height = 60;
//]]>
</script>
<script language="javascript" type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></center>';

	}
	}
	

}
}else{ echo '<meta http-equiv="refresh" content="0; url='.$PHP_SELF.'?page=BluRay" />';}
?>

</center>