<?php
	session_start();
	
	include('config_inc.php'); 
	
	if($_SESSION['database']=="local")
	  {
	     $db_host    = "localhost";
	     $db_user   = "root";
	     $db_pass   = "";
     	     $db_name   = "boutique";

	 }
	
	if($_SESSION['database']=="public")
	  {
  	     $db_host    = "sql2";
   	     $db_user   = "analogde";
 	     $db_pass   = "rainbow";
    	     //$db_type   = "mysql";
	     $db_name   = "analogde";
	 }

  	//$table = "washer"; 

	$table = $_SESSION['table'];

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml" lang="fr"><head>

	
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Patrice Delpy : Lave-Linge</title>

<link rel="SHORTCUT ICON" href="http://www.webdistrib.com/favicon.ico">

<link href="../feuille.css" rel="stylesheet" type="text/css">


<style type="text/css">
.nav-line li.Composants a {background-position: 50% 100% !important;}
</style>

<style media="screen" type="text/css">#a3519779776 {visibility:hidden}</style>

<style type="text/css">
body {
background-color : #EEEEEE;

}

legend {
font: 11px Tahoma;
color : #2266AA;
padding : 0px 4px 0px 4px;
}

fieldset {
border : 1px solid #AAAAAA;
padding : 4px 4px 4px 4px;
}

/*
===========================
balise obligatoire
===========================
*/
.div_select {
border: 1px solid #00CCFF;
width : 150px;
background-color : #FFFFFF;
}

.div_select_header {
border-bottom: 1px solid #00CCFF;
background-color : #00CCFF;
}

.div_select_header td {
padding: 0px 6px 0px 6px;
font: 11px Tahoma;
font-weight: bold;
background-color : #00CCFF;
color: #FFFFFF;
}

.div_select_content td {
padding: 0px 6px 0px 6px;
font: 10px Tahoma;

}

.div_select_content {
width : 150px;
height : 80px ;
overflow : auto;
scrollbar-face-color: #DDDDDD;
scrollbar-shadow-color: #777777;
scrollbar-highlight-color: #ffffff;
scrollbar-3dlight-color: #eeeeee;
scrollbar-darkshadow-color: #000000;
scrollbar-track-color: #eeeeee;
scrollbar-arrow-color: #000000
}

.select_even {
cursor: hand;
background: #FFFFFF;
}

.select_odd {
cursor: hand;
background: #F2FAFF;
}

.select_over {
cursor: hand;
background-color : #CCEEFF;
color: #000000;
font-weight: bold;
}

.select_checked {
cursor: hand;
background-color : #CCFF99;
color: #000000;
font-weight: bold;
}

.div_cadre {
width: 600px;
text-align:center;
background-color: #FFFFFF;
border : 1px dashed #CCCCCC;
padding: 10px 20px 20px 20px;
}

</style>

<script language="javascript" type="text/javascript">

/**
* selectionne l'ensemble des elements d'une liste déroulante avec checkbox
* @param :
* - obj : le nom du pseudo-composant
* - nb : nombre d'elements que contient le composant
*/

function fct() 
{
	alert(" fonction ");
	//document.getElementById('classement').value="ok";
	
	document.form_select.classer.value="ok";
	

}
function selectAll(obj, nb) {
for (i=0; i< nb; i++) {
document.getElementById(obj.id + i).checked = obj.checked;

if(obj.checked)
document.getElementById("tr_"+obj.id+i).className = "select_checked";
else {
if(i % 2)
css = "select_odd"
else
css ="select_even";

document.getElementById("tr_"+obj.id+i).className = css;
}
}
}

/**
* selectionne l'ensemble des elements d'une liste déroulante avec checkbox
* @param :
* - obj : le nom du pseudo-composant
* - el_id : id de l'element (position dans le composant)
* - ev : le type d'evenement
* - css_defaut : le style de la ligne par defaut
* - nb : le nombre d'elements
*/
function setEvenement(obj, el_id, ev, css_defaut, nb, provenance)
 {

	//--- recuperation des balises
	comp = document.getElementById(obj);
	tr = document.getElementById("tr_" + obj + el_id);
	ck = document.getElementById(obj + el_id);

//--- si il s'agit d'un clique
if(ev == "click") {
//--- alors on coche ou decoche la checkbox
if(provenance = "td") ck.checked = !ck.checked;


//--- si on decoche, alors on decoche aussi la checkbox du composant
if(!ck.checked) {
if(comp.checked) comp.checked = false;
}
else {

//---sinon on vérifie que tous les elements sont cochés
var absent = false;
var i = 0;

while(i < nb && absent == false) {
if(i != el_id) {
if(!document.getElementById(obj + i).checked) absent = true;
}
i++;
}

if(comp.checked == absent) comp.checked = !absent;
}
}

//--- autres evenements
switch(ev) {
case "over":
tr.className = "select_over";
break;

case "out":
if(ck.checked)
tr.className = "select_checked";
else
tr.className = css_defaut;
break;
}
}


</script>


</head>

<body class="gecko">
				<!-- page -->
		<div style="z-index: 1000; position: relative;" id="page">

			<!-- header -->
			<div id="header">
				<h1><a name="top" href="http://www.materiel.net/">Materiel.net</a></h1>
			</div>

			<!-- nav -->
			
		<div id="nav">
				<div class="GHeadMenu">

<ul class="nav-line">

<li class=""><a href="../acceuil.php" style="" title="Accueil"><span>Accueil</span></a></li>

<li class="Bonnes affaires"><a href="affaires.php" style="background-image:url(/live/97759.gif);" title="Bonnes affaires"><span>affaires</span></a></li>

<li class="Gros menager"><a href="gros_menager.php" style="background-image:url(/live/97760.gif);" title="Gros menager"><span>Gros Ménager</span></a></li>

<li class="Petit menager"><a href="petit_menager.php" style="background-image:url(/live/97761.gif);" title=" Petit ménager"><span>PEtit Menager</span></a></li>

<li class="Images"><a href="image.php" style="background-image:url(/live/97762.gif);" title="Images"><span>Images</span></a></li>

<li class="Son"><a href="son.php" style="background-image:url(/live/97763.gif);" title="SON"><span>SON</span></a></li>

<li class="Video"><a href="video.php" style="background-image:url(/live/97764.gif);" title="Video"><span>Video</span></a></li>

<li class="Photo et camescope"><a href="photo_camescope.php" style="background-image:url(/live/97769.gif);" title="Photo / cam&eacute;scopes">Photo / cam&eacute;scopes</a></li>

<li class="Telephonie"><a href="telephonie.php" style="background-image:url(/live/97770.gif);" title="T&eacute;l&eacute;phonie">T&eacute;l&eacute;phonie </a></li>

</ul>
<ul class="nav-line">

<li class="art de la table"><a href="art_de_la_table.php" style="background-image:url(/live/97766.gif);" title="Art de la table"><span>Art de la table</span></a></li>

<li class="Accessoires"><a href="accessoires.php" style="background-image:url(/live/97767.gif);" title="Accessoires &amp;Consommables"><span>accessoires &amp;consommables</span></a></li>

<li class="Chauffage & clim"><a href="chauffage_clim.php" style="background-image:url(/live/97768.gif);" title="Chauffage &amp; Clim"><span>chauffage &amp; clim</span></a></li>

<li class="Automobiles"><a href="automobile.php" style="background-image:url(/live/97769.gif);" title="Automobiles"><span>Automobiles</span></a></li>

<li class="GPS"><a href="gps.php" style="background-image:url(/live/97770.gif);" title="GPS"><span> GPS</span></a></li>

<li class="MP3"><a href="mp3.php" style="background-image:url(/live/97771.gif);" title="AUDIO / MP3 / MP4"><span>AUDIO / MP3 / MP4</span></a></li></ul>
			  </div>



            
<!--cached-->			</div>

			<!-- section :content -->
			<div id="section" class="cat">


<div id="cat" style="overflow: auto;">

	<div style="float: left; width: 175px; margin-left: 0px;">
		<h2 style="margin: 0px; background: rgb(51, 153, 51) url(../images/cat_default.png) no-repeat scroll 0% 0%; padding-bottom: 5px; line-height: 18px; text-transform: uppercase; font-weight: normal; text-align: center; font-size: 11px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">Les gammes de produits</h2>
		<ul class="CatList" style="background: transparent url(../images/cat_fond.png) repeat-x scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">

<li style="border-bottom: 3px solid rgb(244, 244, 244);">
<a href="lave-linge.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItemHL">Lave-Linge</a></li>

<!--
<li><a href="" class="CatListSubItem">UN</a></li>
<li><a href="" class="CatListSubItem">DEUX</a></li>
<li><a href="" class="CatListSubItem">TROIS</a></li>
-->


<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="lave-linge-sechant.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Lave-Linge s&egrave;chant</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="seche_linge.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">S&egrave;che-Linge</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="lave_vaisselle.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Lave-Vaisselle</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="refrigerateur.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">R&eacute;frig&eacute;rateur</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="congelateur.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Cong&eacute;lateur</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="cave_vin.php" style="border-bottom:1px solid rgb(153, 153, 153);" class="CatListItem">Cave &agrave; vin</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="table_cuisson.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Table de cuisson</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="four.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Four</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="cuisiniere.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Cuisini&eacute;re</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="micro_onde.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Micro onde</a></li>

<li style="border-bottom: 3px solid rgb(244, 244, 244);"><a href="grillade_barbecue.php" style="border-bottom: 1px solid rgb(153, 153, 153);" class="CatListItem">Grillade / Barbecue</a></li>

				</ul>
                
                
		
	</div>




<div style="border-left: 1px solid rgb(160, 160, 160); float: right; width: 760px; margin-left: 6px; padding-left: 6px; padding-right: 6px; text-align: left;">
	<table class="CatTitle" width="100%" border="0" cellpadding="0" cellspacing="0">
		<tbody><tr>
			<th valign="baseline" width="88%" height="40">
				UNIVERS LAVAGE				
				  <hr>
			</th>
			<td rowspan="2" class="ImgZone" width="12%"><img src="Disques%20durs%20et%20SSD%20%20%20Materiel.net_fichiers/26947.gif" alt=""></td>
		</tr>
		<tr>
			<td style="vertical-align: top;"><a style="color: rgb(51, 153, 51);" href="../acceuil.php">Accueil</a> &gt; <a style="color: rgb(51, 153, 51);" href="gros_menager.php">Gros m&eacute;nager</a> &gt; Lave-Linge</td>
		</tr>
	</tbody></table>

<?php

function checkedSelect( $nom, $structure, $contenu, $selection = null)
{

//////////////// entete du composant \\\\\\\\\\\\\\\\\\\\\\\\\
if(sizeof($selection) == sizeof($contenu))
$checked = "checked";
else
$checked = "";


$str = '<div class="div_select">'
.'<div class="div_select_header">'
.'<table width="100%">'
.'<tr>'
.'<td width="20" align="center"><input type="checkbox" id="'.$nom.'" onClick="javascript:selectAll(this, '.sizeof($contenu).');" '.$checked.'/></td>';

//--- colonnes
for($i = 0, $max = sizeof($structure); $i < $max; $i++)
 {
	$str .= '<td ';
	if(isset($structure[$i]["align"])) $str .= 'align="'.$structure[$i]["align"].'" ';
	if(isset($structure[$i]["width"])) $str .= 'width="'.$structure[$i]["width"].'" ';
	$str .= '>'.$structure[$i]["name"].'</td>';
}

$str .= '<td width="1"></td>'
.'</tr>'
.'</table>'
.'</div>';

//////////////// contenu du composant \\\\\\\\\\\\\\\\\\\\\\\\\
$str .= '<div class="div_select_content" >'
.'<table width="100%">';

//--- pour chaque ligne
for($i = 0, $max = sizeof($contenu); $i < $max; $i++)
 {

	   //--- style css (pair / impair)
           if($i%2)
              $css_defaut = 'select_odd';
           else
              $css_defaut = 'select_even';

	//--- element selectionne ?
	if($selection != null && in_array($contenu[$i][0],$selection))
	 {
	     $checked = ' checked';
	     $css = 'select_checked';
	 }
	else {
		$checked = '';
		$css = $css_defaut;
	     }
		  	
		    $motif = $contenu[$i][0];
		    $string = $_SESSION['select_box'];

		    $pos = strpos($string, $motif);

	             if($pos === false)
	               {
    	                 //echo "No";
    	                 $str .= '<tr id="tr_'.$nom.$i.'" class="'.$css.'" onMouseOver=\'javascript:setEvenement("'.$nom.'","'.$i.'","over","'.$css.'",'.sizeof($contenu).',"td");\' onMouseOut=\'javascript:setEvenement("'.$nom.'","'.$i.'","out","'.$css_defaut.'",'.sizeof($contenu).',"td");\' '
.' onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click", "'.$css_defaut.'",'.sizeof($contenu).',"td");\' >'
.'<td width="20" ><input type="checkbox" id="'.$nom.$i.'" name="'.$nom.'[]"  value="'.$contenu[$i][0].'" onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click","'.$css_defaut.'",'.sizeof($contenu).',"ck");\' '.$checked.' /></td>';

	               }
	 	  else {   //echo "yes";
	 	  	   $str .= '<tr id="tr_'.$nom.$i.'" class="'.$css.'" onMouseOver=\'javascript:setEvenement("'.$nom.'","'.$i.'","over","'.$css.'",'.sizeof($contenu).',"td");\' onMouseOut=\'javascript:setEvenement("'.$nom.'","'.$i.'","out","'.$css_defaut.'",'.sizeof($contenu).',"td");\' '
.' onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click", "'.$css_defaut.'",'.sizeof($contenu).',"td");\' >'
.'<td width="20" ><input type="checkbox" id="'.$nom.$i.'" name="'.$nom.'[]" Checked="Checked" value="'.$contenu[$i][0].'" onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click","'.$css_defaut.'",'.sizeof($contenu).',"ck");\' '.$checked.' /></td>';

	 	  
                       }	

		     /*if(ereg($motif,$chaine)) 
		       {
   		          echo "La chaine contient le motif ";
		       }*/


//--- la checkbox
/*
$str .= '<tr id="tr_'.$nom.$i.'" class="'.$css.'" onMouseOver=\'javascript:setEvenement("'.$nom.'","'.$i.'","over","'.$css.'",'.sizeof($contenu).',"td");\' onMouseOut=\'javascript:setEvenement("'.$nom.'","'.$i.'","out","'.$css_defaut.'",'.sizeof($contenu).',"td");\' '
.' onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click", "'.$css_defaut.'",'.sizeof($contenu).',"td");\' >'
.'<td width="20" ><input type="checkbox" id="'.$nom.$i.'" name="'.$nom.'[]"  value="'.$contenu[$i][0].'" onClick=\'javascript:setEvenement("'.$nom.'","'.$i.'","click","'.$css_defaut.'",'.sizeof($contenu).',"ck");\' '.$checked.' /></td>';
*/

	//Checked="Checked" --- les colonnes
	for($j = 1; $j < sizeof($contenu[$i]); $j++)
 	   {
		$str .= '<td ';
		if(isset($structure[$j-1]["align"])) $str .= 'align="'.$structure[$j-1]["align"].'" ';
		if(isset($structure[$j-1]["width"])) $str .= 'width="'.$structure[$j-1]["width"].'" ';
		$str .= '>'.$contenu[$i][$j].'</td>';
	   }

	$str .= '</tr>';
}

//--- fermeture des balises
$str .= '</table>'
.'</div>'
.'</div>';

return $str;
}

?>


<?php

	if(isset($_GET['classe']))
	  {  $colonne = $_GET['classe'];
	  		
		if($_SESSION['ordre'] == "ASC")
	  	  { $_SESSION['ordre'] = "DESC";
	    	    //echo '<body onLoad="alert(\' DESC ...\')">'; 
	  	  }	
	
		else{ $_SESSION['ordre'] = "ASC";
	      	      //echo '<body onLoad="alert(\' ASC ...\')">'; 
	    	    }	
	  		
	 	 switch($colonne)
	  	       {
			  case "marque" :
			                $_SESSION['option_classer'] = "ORDER BY marque " .$_SESSION['ordre'];
			                //echo '<body onLoad="alert(\' marque ...\')">'; 
					break;
			  case "reference" :
				        $_SESSION['option_classer'] = "ORDER BY reference " .$_SESSION['ordre'];
				        //echo '<body onLoad="alert(\' nom ...\')">'; 
					break;
			  case "prix" :
				        $_SESSION['option_classer'] = "ORDER BY prix_ttc " .$_SESSION['ordre'];
				        //echo '<body onLoad="alert(\' prix ...\')">'; 
				        break;  	  		  
			  }	
	     	
	  	
	}

/***********************************************************************************/	

	

	$connexion = mysql_connect($db_host,$db_user,$db_pass); 
       	mysql_select_db($db_name, $connexion);
  
  
  	/// probléme avec tiret   mysql_query("SHOW TABLE STATUS FROM `ma-base_com1`");
  	
  	$requete = "SELECT filtre FROM categorie WHERE table_article='$table'";	

    	$result = mysql_query($requete);
    	$datas = mysql_fetch_array($result);
    	    	
    	// decoupe la chaine
    	$champs_filtre = explode(",", $datas[0]);
    	
    	//var_dump($champs_filtre);

	$critere01 = array(array());  
	$critere02 = array(array());  
	$critere03 = array(array());  
	$critere04 = array(array());  
	$critere05 = array(array());  
	$critere06 = array(array());  
	$critere07 = array(array());  
	$critere08 = array(array());  
	$critere09 = array(array());  
	$critere10 = array(array());  
	
	$item01 = "item01";
	$struct01 = array ( array("name" => "$champs_filtre[0]", "align" => "center", "width" => "40px"));
	
	$item02 = "item02";
	$struct02 = array ( array("name" => "$champs_filtre[1]", "align" => "center", "width" => "40px"));
	
	$item03 = "item03";
	$struct03 = array ( array("name" => "$champs_filtre[2]", "align" => "center", "width" => "40px"));
	
	$item04 = "item04";
	$struct04 = array ( array("name" => "$champs_filtre[3]", "align" => "center", "width" => "40px"));
	
	$item05 = "item05";
	$struct05 = array ( array("name" => "$champs_filtre[4]", "align" => "center", "width" => "40px"));
	
	$item06 = "item06";
	$struct06 = array ( array("name" => "$champs_filtre[5]", "align" => "center", "width" => "40px"));
	
	for($i=0; $i<count($champs_filtre); $i++) 
	   { 
		$connexion = mysql_connect($db_host,$db_user,$db_pass); 
       		mysql_select_db($db_name, $connexion);
  
  		$critere = $champs_filtre[$i];
  			
  		$requete = "SELECT $critere FROM $table";
  		//echo $requete;
  		//echo "<br>";	
    		
    		$result = mysql_query($requete);
    			
    		$p = 0;
    		$filtre = array();
    		
    		if($i == 0)
    		  { $tab = "critere01";
    		    $cpt = 0;
    		    while($data=mysql_fetch_row($result))  
             		{ 	if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere01[$p][0] = $data[0];
  				    $critere01[$p][1] = $data[0];
             	   		    $p = $p+1;
             			  } 
             			if($cpt > 0)
             			  {    $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
             	   		    else {  $filtre[] = $var;
             	   			    $critere01[$p][0] = $data[0];
  					    $critere01[$p][1] = $data[0];
             	   			    $p = $p+1;
             	   		          }
             	   		   }  
             	   		     $cpt = $cpt +1;   	
		    	}
    		  }	
		if($i == 1)
    		  { $tab = "critere02";
    		    $cpt = 0;
    		    while($data=mysql_fetch_row($result))  
             		{	if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere02[$p][0] = $data[0];
  				    $critere02[$p][1] = $data[0];
             	   		    $p = $p+1;
             			  } 
             			if($cpt > 0)  
             			  {    $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
             	   		    else {  $filtre[] = $var;  
             			            $critere02[$p][0] = $data[0];
  				            $critere02[$p][1] = $data[0];
             	   		            $p = $p+1;
			    	         }
			    	  }  
             	   		     $cpt = $cpt +1;   	
                      }
    		  }	
    		if($i == 2)
    		  { $tab = "critere03";
    		    $cpt = 0;
    		    while($data=mysql_fetch_row($result))  
             		{	if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere03[$p][0] = $data[0];
  				    $critere03[$p][1] = $data[0];
  				    $p = $p+1;
             			  } 
             			if($cpt > 0)
             			 {     $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
				        else {  $filtre[] = $var;  
             	   				$critere03[$p][0] = $data[0];
  						$critere03[$p][1] = $data[0];
             	   				$p = $p+1;
             	   			     }
             	   		 }	      	
             	   		    $cpt = $cpt +1;   	
		    	}
    		  }	
    		if($i == 3)
    		  { $tab = "critere04";
    		    $cpt = 0;
		    while($data=mysql_fetch_row($result))  
             		{       if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere04[$p][0] = $data[0];
 	                            $critere04[$p][1] = $data[0];
             	   		    $p = $p+1;
             			  } 
             			if($cpt > 0)
             			 {     $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
				       else {  $filtre[] = $var;  
             	   			       $critere04[$p][0] = $data[0];
  					       $critere04[$p][1] = $data[0];
             	   		               $p = $p+1;
             	   		            }
             	   		  }	      	
             	   		     $cpt = $cpt +1;        
		    	}	
    		  }	
    		if($i == 4)
    		  { $tab = "critere05";
    		    $cpt = 0;
		    while($data=mysql_fetch_row($result))  
             		{	if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere05[$p][0] = $data[0];
  				    $critere05[$p][1] = $data[0];
             	   		    $p = $p+1;
             			  } 
             			if($cpt > 0)
             			 {     $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
				        else {  $filtre[] = $var;  
             	   				$critere05[$p][0] = $data[0];
  						$critere05[$p][1] = $data[0];
             	   				$p = $p+1;
		    		             }
				 }	      	
             	   		      $cpt = $cpt +1;		    		             	
		        }
    		  }	      
		if($i == 5)
    		  { $tab = "critere06";
    		    $cpt = 0;
		    while($data=mysql_fetch_row($result))  
             		{	if($cpt == 0)
             			  { $filtre[] = $data[0];
             			    $critere06[$p][0] = $data[0];
   		                    $critere06[$p][1] = $data[0];
             	   		    $p = $p+1;
             			  } 
             			if($cpt > 0)
             			 {     $var = $data[0];
             			       if(in_array($var, $filtre))
             			         { $test = false;
				         }
				        else {  $filtre[] = $var;  
             	   				$critere06[$p][0] = $data[0];
  						$critere06[$p][1] = $data[0];
             	   				$p = $p+1;
             	   			     }
		    	           }
             	   		      $cpt = $cpt +1;
    		        }	
	          }
	      
	     }     

/***********************************************************************************/
	   
	if($_POST["submit"])
          {
                              	
  	       $_SESSION['select_box'] = "";
  	       $memoire = "";
  	       
  	       //echo '<body onLoad="alert(\' SUBMIT ...\')">'; 
  	
  	       $_SESSION['recharge'] = true;	
	       
               //echo '<b>Formulaire validé avec les éléments : </b><br>';
	
               $portion_sql = array();
	
	       if(count($critere01) != 0)
	         {
	            //echo '<b>- '.$item01.' :</b> ';
	    	    $chaine01 ="";	
	
	            if(count($_POST[$item01]) != 0)	
	              {
    		           for($i = 0; $i < sizeof($_POST[$item01]); $i++)
	                      {
				  //if($i > 0) 
				  //echo ', ';
			          //echo $_POST[$item01][$i];

				  $champ = $_POST[$item01][$i];

				  if($i<count($_POST[$item01])-1)
		  	            {$chaine01 = $chaine01 ."'$champ'" .", ";
		  	             $memoire = $memoire ." " .$champ .", ";
		  	            }
				  if($i == count($_POST[$item01])-1)
		     	            {$chaine01 = $chaine01 ."'$champ'";
			             $memoire = $memoire ." " .$champ ;
			            }  
			            
	                      }
	                      
	                    //array_push($_SESSION['clic'],$chaine01);  
		            //echo "++++++++ " .$chaine01;
		
		            $final01 = $champs_filtre[0] ." IN (" .$chaine01 .")";
	    	            $portion_sql[] = $champs_filtre[0] ." IN (" .$chaine01 .")";
	             }	
	             
	         }      
         
		//echo '<br /><br />';
          
               if(count($critere02) != 0)
	         {
	             //echo '<b>- '.$item02.' :</b> ';
	             $chaine02 ="";
	
	             if(count($_POST[$item02]) != 0)	
	               {	
	    	           for($i = 0; $i < sizeof($_POST[$item02]); $i++)
	                      {
			//if($i > 0)
			//echo ', ';
			//echo $_POST[$item02][$i];
			
			$champ = $_POST[$item02][$i];

			if($i<count($_POST[$item02])-1)
		  	  {$chaine02 = $chaine02 ."'$champ'" .", ";
		  	   $memoire = $memoire ." "  .$champ .", ";
		  	  }
			if($i == count($_POST[$item02])-1)
		     	  {$chaine02 = $chaine02 ."'$champ'";
		     	   $memoire = $memoire ." " .$champ ;
			  }  
	            }
	         //array_push($_SESSION['clic'],$chaine02);  
	         //echo "++++++++ " .$chaine02;
	       
	         $final02 = $champs_filtre[1] ." IN (" .$chaine02 .")";
	         $portion_sql[] = $champs_filtre[1] ." IN (" .$chaine02 .")";
             }

          }  
	
	//echo '<br /><br />';

	if(count($critere03) != 0)
	  {
	    //echo '<b>- '.$item03.' :</b> ';
	    $chaine03 ="";	
	
	    if(count($_POST[$item03]) != 0)	
	      {
		 for($i = 0; $i < sizeof($_POST[$item03]); $i++)
	            {
			//if($i > 0) 
			//echo ', ';
			//echo $_POST[$item03][$i];
			
			$champ = $_POST[$item03][$i];

			if($i<count($_POST[$item03])-1)
		  	  {$chaine03 = $chaine03 ."'$champ'" .", ";
		  	    $memoire = $memoire ." "  .$champ .", ";
		  	  }
			if($i == count($_POST[$item03])-1)
		     	  {$chaine03 = $chaine03 ."'$champ'";
		     	   $memoire = $memoire ." " .$champ ;
			  }  
	            }
                 //array_push($_SESSION['clic'],$chaine03);    
		 //echo "++++++++ " .$chaine03;
		
	         $final03 = $champs_filtre[2] ." IN (" .$chaine03 .")";
	         $portion_sql[] = $champs_filtre[2] ." IN (" .$chaine03 .")";
	     }	

          }  
	//echo '<br /><br />';
          
        if(count($critere04) != 0)
	  {
	    //echo '<b>- '.$item04.' :</b> ';
	    $chaine04 ="";
	
	    if(count($_POST[$item04]) != 0)	
	      {
	         for($i = 0; $i < sizeof($_POST[$item04]); $i++)
	            {
			//if($i > 0) 
			//echo ', ';
			//echo $_POST[$item04][$i];

			$champ = $_POST[$item04][$i];

			if($i<count($_POST[$item04])-1)
		  	  {$chaine04 = $chaine04 ."'$champ'" .", ";
		  	   $memoire = $memoire ." " .$champ .", ";
		  	  }
			if($i == count($_POST[$item04])-1)
		     	  {$chaine04 = $chaine04 ."'$champ'";
		     	   $memoire = $memoire ." " .$champ ;
			  }  
	           }
                 //array_push($_SESSION['clic'],$chaine04);      
		 //echo "++++++++ " .$chaine04;
		
	         $final04 = $champs_filtre[3] ." IN (" .$chaine04 .")";
	         $portion_sql[] = $champs_filtre[3] ." IN (" .$chaine04 .")";
             }

          }    
          
	//echo '<br /><br />';

	if(count($critere05) != 0)
	  {
	    //echo '<b>- '.$item05.' :</b> ';
	    $chaine05 ="";
	
	    if(count($_POST[$item05]) != 0)	
	      {
	         for($i = 0; $i < sizeof($_POST[$item05]); $i++)
	            {
			//if($i > 0) 
			//echo ', ';
			//echo $_POST[$item05][$i];
		
			$champ = $_POST[$item05][$i];

			if($i<count($_POST[$item05])-1)
		  	  {$chaine05 = $chaine05 ."'$champ'" .", ";
		  	    $memoire = $memoire ." "  .$champ .", ";
		  	  }
			if($i == count($_POST[$item05])-1)
		     	  {$chaine05 = $chaine05 ."'$champ'";
		     	   $memoire = $memoire ." "  .$champ ;
			  }  
	            }
                  //array_push($_SESSION['clic'],$chaine05);      
	          //echo "++++++++ " .$chaine05;
	       
       	          $final05 = $champs_filtre[4] ." IN (" .$chaine05 .")";
	          $portion_sql[] = $champs_filtre[4] ." IN (" .$chaine05 .")";
	     }	

          }  
          
	//echo '<br /><br />';
         
        if(count($critere06) != 0)
	  {
	    //echo '<b>- '.$item06.' :</b> ';
	    $chaine06 ="";
	
	    if(count($_POST[$item06]) != 0)	
	      {	
	
	         for($i = 0; $i < sizeof($_POST[$item06]); $i++)
	            {
			//if($i > 0) 
			//echo ', ';
			//echo $_POST[$item06][$i];
		
			$champ = $_POST[$item06][$i];

			if($i<count($_POST[$item06])-1)
		  	  {$chaine06 = $chaine06 ."'$champ'" .", ";
		  	   $memoire = $memoire ." "  .$champ .", ";
		  	  }
			if($i == count($_POST[$item06])-1)
		     	  {$chaine06 = $chaine06 ."'$champ'";
		     	   $memoire = $memoire ." "  .$champ ;
			  }  
	            }
                 //array_push($_SESSION['clic'],$chaine06);    
	         //echo "++++++++ " .$chaine06;
	       
	         $final06 = $champs_filtre[5] ." IN (" .$chaine06 .")";
	         $portion_sql[] = $champs_filtre[5] ." IN (" .$chaine06 .")";
              }

          }    
        
      
         
        $_SESSION['select_box'] = $memoire;
         
        /*echo "<br>"; 
	echo "<pre>"; 
        var_dump($_SESSION['select_box']);
        echo "</pre>";
        echo "<br>";  
	
	echo "<br>"; 
	echo "<pre>"; 
	var_dump($portion_sql);
	echo "</pre>";
        echo "<br>"; */
        
        $nb_options = count($portion_sql);
        //echo "Options: " .$nb_options;
        //echo "<br>"; 
        
        $_SESSION['nb_options'] = $nb_options ;
        
        if($nb_options != 0 )
          { $_SESSION['mode'] = "filtre";
          }
        else { $_SESSION['mode'] = "defaut"; 
             }  

	$_SESSION['page'] == 1;             
        	
         // construire le requete
	    
	    $portion ="";
	    $chaine = "";
	    
	    for($k=0; $k<=count($portion_sql)-1; $k++) 
  	       { 
  	       	 	$champ = $portion_sql[$k];
  	       		
  	       		if(champ !="")
  	       		  {
  	       	  		if($k<count($portion_sql)-1)
		    		  {$chaine = $chaine .$portion_sql[$k] ." and ";
	            		  }
	          		if($k == count($portion_sql)-1)
		    		  {$chaine = $chaine .$portion_sql[$k];
	            		  }  
	       		  }
	       }		  
	       
	       if($chaine == "")
	         {  $req = " SELECT * FROM $table ";
	         }	
	       else {
	             $req = " SELECT * FROM $table WHERE " .$chaine;
		     //echo $req;
		}
		
		$_SESSION['champ_requete'] = $req;		
		
		$connexion = mysql_connect($db_host,$db_user,$db_pass); 
       	    	mysql_select_db($db_name, $connexion);
	    
	    	//$requete = " SELECT * FROM cruchot WHERE chargement = 'Hublot' or chargement = '2' ";
	    	$result = mysql_query($req);
	    
	    	//echo "<br>"; 
	    	//echo "Nb de resultat:" .mysql_num_rows($result); 
	    	//echo "<br>"; 
	    
	    	$nb_resultats_filtre = mysql_num_rows($result);
    	
	    	if($nb_resultats_filtre != 0)
	          { 	  
	          	  	
    	    	   while($datas = mysql_fetch_assoc($result))
                        {  $_SESSION['reponse_requete'] = true;
                          //echo $datas['reference'];
                          //echo "<br>"; 
                        }
                  }
          	else { //echo "Aucune réponse";
          	       $_SESSION['reponse_requete'] = false;	
          	     } 
	    
	    	//echo "<br>"; 
	    	//echo "<br>"; 
	
}   

/***********************************************************************************/
	
	//$table = "washer"; 

	$connexion = mysql_connect($db_host,$db_user,$db_pass); 
        mysql_select_db($db_name, $connexion);
  
  	$requete = "SELECT filtre FROM categorie WHERE table_article='$table'";	
   	$result = mysql_query($requete);
   	$datas = mysql_fetch_array($result);
    	    	
   	// decoupe la chaine
   	$champs_filtre = explode(",", $datas[0]);
   	
   	echo "-----> " .count($champs_filtre );
	
?>



    <table class="ProdFilter" style="clear: both;" width="100%;" border="0" cellpadding="0" cellspacing="0">
		<tbody><tr>
				<th width="260" align="left" height="30" valign="top">
				<div style="float: left;">Filtres par caract&eacute;ristiques </div>
				<div style="float: right;">
				  <div id="BrandHelpPanel" style="border: 2px solid rgb(51, 51, 51); background: rgb(255, 255, 255) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 300px; position: absolute; display: none; clear: both; z-index: 10;">
					  <div style="padding: 1px; background: transparent url(../images/FooterBarBg.gif) repeat scroll center center; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(255, 255, 255); font-weight: bold; height: 16px;">
							<div style="float: left;">Aide : filtrage par marque:</div>
							<img src="../images/ProdAlerteClose.gif" alt="Fermer" style="cursor: pointer; float: right;" onclick="ShowHideElem('BrandHelpPanel')" width="13" height="14">
					</div>
						<div style="padding: 3px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; text-align: left; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 294px; font-weight: normal; clear: both;">
							<p style="font-weight: bold;">Filtre par marque</p>
							<p>Il vous permet d&#8217;afficher les produits d&#8217;une ou de plusieurs marques. Un simple clic sur une marque vous permet de la <span style="font-weight: bold;">sélectionner</span> ou de la <span style="font-weight: bold;">dé-sélectionner</span>.</p>
							<p>Pour <span style="font-weight: bold;">sélectionner plusieurs marques</span>, utilisez la combinaison de touche Ctrl+clic</p>
							<center><img src="template_fichiers/CatHelpBr1.jpg" alt="" width="207" height="55"></center>
						</div>
				  </div>
				</div>
			</th>
				<th width="500" align="left" height="30" valign="top">&nbsp;</th>
		</tr>
		<tr>
        
        
        
			 
			<td valign="top">
			<table class="ProdFilterList" width="100%" border="0" cellpadding="0" cellspacing="0">
			<tbody>
                    	<tr>
                    
                    	<form name="form_select" method="post" action="">
	              	<div align="center" >
	              	
<!--			
<?php echo "<th width=\"17%\">"; ?> 
<?php echo checkedSelect($item01, $struct01, $critere01, $_POST[$item01]); ?>
<?php echo "<th width=\"17%\">&nbsp;</th>"; ?>            		
-->			       	

	              	
<?php	              	
            		for($j=1; $j<=count($champs_filtre); $j++) 
            		   {   switch($j)
	  		              {
					  case 1 :
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item01, $struct01, $critere01, $_POST[$item01]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;
					  case 2 :
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item02, $struct02, $critere02, $_POST[$item02]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;
					  case 3 :
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item03, $struct03, $critere03, $_POST[$item03]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;  
					  
					  case 4 :
					  	  echo "<th width=\"17%\"></th>";
            					  echo "</tr>";
			          		  echo "<tr>";
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item03, $struct04, $critere04, $_POST[$item04]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;   
					    	  
					  case 5 :
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item05, $struct05, $critere05, $_POST[$item05]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;  
					    	    	   	  	
					  case 6 :
					  	  echo "<th width=\"17%\">"; 
					  	  echo checkedSelect($item06, $struct06, $critere06, $_POST[$item06]);
					  	  echo "<th width=\"17%\">&nbsp;</th>";
					    	  break;    	  
					    	    		  
				     }		 
            		   }	

?>              	
		
<!--		    	   
            		<th width="17%"><?php echo checkedSelect($item01, $struct01, $critere01, $_POST[$item01]); ?> &nbsp;</th>
            		<th width="17%">&nbsp;</th>
            		
            		<th width="17%"><?php echo checkedSelect($item02, $struct02, $critere02, $_POST[$item02]); ?>&nbsp;</th>
            		<th width="17%"></th>
            		
            		<th width="17%"><?php echo checkedSelect($item03, $struct03, $critere03, $_POST[$item03]); ?></th>
            		<th width="17%">&nbsp;</th>


            		
            		<th width="17%">&nbsp;</th>
            		</tr>
	          
          		<tr>
            		
            		<th width="17%"><?php echo checkedSelect($item04, $struct04, $critere04, $_POST[$item04]); ?></th>
            		<th width="17%">&nbsp;</th>
            		
            		<th width="17%"><?php echo checkedSelect($item05, $struct05, $critere05, $_POST[$item05]); ?></th>
            		<th width="17%">&nbsp;</th>
            		
            		<th width="17%"><?php echo checkedSelect($item06, $struct06, $critere06, $_POST[$item06]); ?></th>
            		<th width="17%">&nbsp;</th>
-->             		
            		<td width="83%">&nbsp;</td>
             		<br />
             		
	                	
                	<input type="hidden" name="classer" id="classer" value="">
                	<input type="submit" name="submit" value="envoyer" />
                	</div>
              		</form>
                    
                 	</tr>   
					
			</tbody>
			</table>
                            
			</td>
			</tr>
			<tr style="background: transparent url(../images/CatFiltreLine.gif) repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">
			<td style="padding: 0pt;" align="left"><img src="../images/CatFiltreLeft.gif" alt="" width="8" height="10"></td>
			<td style="padding: 0pt;"><img src="../images/CatFiltreRight.gif" alt="" width="8" align="right" height="10"></td>
			</tr>
			</tbody>
    			</table>
         
    
			<div align="center"></div>
			<div style="clear: both; width: 100%; text-align: right; padding-top: 10px;">


			<a name="prods"></a>
			<div id="ProdListArea" class="ProdList" style="margin-top: 20px;">
			<div id="Plc" class="ProdListCount">
			<div style="float: left; height: 34px;">
			<?php echo $nb_resultats_filtre; ?> produits correspondent à vos critères de sélection</div>
			</div>

			<div style="clear: both;"></div>

<?php
	if($_SESSION['reponse_requete'] == true)
	  {
	    echo "	<table class=\"ProdList\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"750px;\">
			<tbody>
			<tr>
			<th width=\"106\">&nbsp;</th>
			<th width=\"99\"><a href=\"filtre.php?classe=marque\" >Marque</a></th>  
			<th width=\"203\"><a href=\"filtre.php?classe=reference\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 2, 0, 1); return false;\">Référence</a></th>
			<th width=\"63\"><a href=\"filtre.php?classe=prix\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 3, 0, 1); return false;\">Prix TTC</a></th>
			<th width=\"40\"><a href=\"filtre.php?classe=dispo\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 4, 0, 1); return false;\">Dispo</a></th>
			<th width=\"194\">Caracteristiques</th>
			<th colspan=\"2\" width=\"59\">&nbsp;</th>
			</tr>
			
			<tr class=\"ProdListHLine\">
			<td></td> ";
			
			
			if($colonne == "marque") 
			  {  if($_SESSION['ordre'] == "ASC")
			       { echo "<td width=\"99\"><img src=\"../images/ProdListHArrowA.gif\" alt=\"Ordonner\"></td>";
			       }
			     if($_SESSION['ordre'] == "DESC")
			       { echo "<td width=\"99\"><img src=\"../images/ProdListHArrowD.gif\" alt=\"Ordonner\"></td>";
			       }
			     	
			  }
			else { echo "<td width=\"99\"></td>"; }  
			
			if($colonne == "reference") 
			  { if($_SESSION['ordre'] == "ASC")
			      { echo "<td width=\"203\"><img src=\"../images/ProdListHArrowA.gif\" alt=\"Ordonner\"></td>";
			      }
			     if($_SESSION['ordre'] == "DESC")
			       { echo "<td width=\"203\"><img src=\"../images/ProdListHArrowD.gif\" alt=\"Ordonner\"></td>";
			       }	  
			  }
			else { echo "<td width=\"203\"></td>"; }  
			
			if($colonne == "prix") 
			  { if($_SESSION['ordre'] == "ASC")
			      {	echo "<td width=\"63\"><img src=\"../images/ProdListHArrowA.gif\" alt=\"Ordonner\"></td>";
			      }
			    if($_SESSION['ordre'] == "DESC")
			      { echo "<td width=\"63\"><img src=\"../images/ProdListHArrowD.gif\" alt=\"Ordonner\"></td>";
			      }	
			  }
			else { echo "<td width=\"63\"></td>"; }  
			
			echo "
			
			<td width=\"40\"></td>
			<td width=\"194\"></td>
			<td colspan=\"2\" width=\"59\">
			</td>
			</tr> ";
	   }	
    
?>    

<?php

	   $ligne_par_page = 2;
	   
	   if(isset($_GET['page'])) 
	     {  
		$pageActuelle=intval($_GET['page']);
	     }
	    else  { $pageActuelle=1;   
	          }
	
	   if($_SESSION['recharge'] == true)
             {   $_SESSION['recharge'] = false;
                 $pageActuelle=1;
	     }	

	   $premiereEntree=($pageActuelle-1)*$ligne_par_page;    
	  
  	   //echo ">>>>>> " .$_SESSION['option_classer'];
  	   //echo "<br>"; 
	  
  	   if($_SESSION['mode'] == "filtre")
  	     {  //echo "filtrage";
  	        //echo "<br>"; 
  
  		$connexion = mysql_connect($db_host,$db_user,$db_pass); 
       	    	mysql_select_db($db_name, $connexion);	        
       	    	//echo $_SESSION['champ_requete'];
       	    	//echo "<br>"; 
       	    	$r = $_SESSION['champ_requete'];
       	    	
       	    	$cmd = $r ." " .$_SESSION['option_classer'];
       	    	
       	    	//$cmd = $r ." " ."ORDER BY marque " .$_SESSION['ordre'];
       	    	
       	    	$retour_messages = mysql_query($cmd);
  	        //$retour_messages = mysql_query($r);
  	        
  	        $nb_resultats_filtre = mysql_num_rows($retour_messages);
  	     }

  	    if($_SESSION['mode'] == "defaut")
  	     {  //echo "defaut";
  	        //echo "<br>"; 
  	     	
  	     	$connexion = mysql_connect($db_host,$db_user,$db_pass); 
 		mysql_select_db($db_name, $connexion);
  	        
  	        $result = mysql_query("SELECT * FROM $table"); 
  	        $nb_resultats_filtre = mysql_num_rows($result);
  	        
  	        //echo ">>>>>> Resultats : " .$nb_resultats_filtre;
  	        
  	        $connexion = mysql_connect($db_host,$db_user,$db_pass); 
 		mysql_select_db($db_name, $connexion);
  
  		//$cmd = $r ." " .$_SESSION['option_classer'];

  		$cmd = "SELECT * FROM $table " .$_SESSION['option_classer'];
  		
  
	        $retour_messages = mysql_query($cmd); 	
	        //$retour_messages = mysql_query("SELECT * FROM $table"); 	

  	     } 

		//echo "Requete : " .$cmd;
		//echo "<br>"; 
		//echo "Classement : " .$_SESSION['ordre'];
	        //echo "<br>"; 


	        $nombre_pages = ceil($nb_resultats_filtre/$ligne_par_page); 	
	        //echo " >>> Nb pages >>> " .$nombre_pages;
	        //echo "<br>"; 
	  
	        $sauvegarde = array(array()); 
	        $ptr = 0;
	 	   
          while($data=mysql_fetch_assoc($retour_messages)) 
               {
		    $tab = array();
		    $chaine = "";
		    
		    $marque = $data['marque'];
   		    $prix_ttc = $data['prix_ttc'];
 		    $designation = $data['designation'];
   		    $reference = $data['reference'];
		    $dispo = $data['dispo'];
		    $id_catalogue = $data['id_catalogue'];
  		    $s1 = $reference;
  		    
       	   	    $tab[] = $marque;
       	   	    $tab[] = $prix_ttc;
       	   	    $tab[] = $designation;
       	   	    $tab[] = $reference;
       	   	    $tab[] = $id_catalogue;
       	   	    $tab[] = $dispo;
       	   	    $tab[] = $s1;
		   
	    	    $motif_underscore = '_';
		    $espace = " ";
		  
		    for($j=1; $j<count($champs_filtre); $j++) 
	               {  $val = $champs_filtre[$j];
				 
			  if($j<count($champs_filtre) )
			    { $chaine = $chaine ." " .$val ." " .$data[$val] .",";
			    }
	
			   else {  $chaine = $chaine ." " .$val ." " .$data[$val] ;
			        }
				  
			}
	
		     if(preg_match('`\_`', $chaine))
		       { $chaine = str_replace($motif_underscore, $espace, $chaine);
		       }

		     $tab[] = $chaine;	
		     
		     // sauve dans le tableau multidimensionnel
        	     $sauvegarde[$ptr] = $tab;
        	     
        	     $ptr = $ptr + 1;
        	     
        	 }    
        	        
        	 	//echo "<br>"; 
			//echo "<pre>"; 
			//print_r($sauvegarde);
			//echo "</pre>";
             		//echo "<br>"; 
			
			/************************************/
			
			$nb_lignes = count($sauvegarde);
			//echo "nb_lignes: " .$nb_lignes;
			//echo "<br>";

			$limite = $nb_lignes - 1;

			//echo "Start: " .$premiereEntree;
			//echo "<br>";
			
			$final = $premiereEntree + $ligne_par_page;
			
			if($final > $nb_lignes )
			  { $final = $nb_lignes;
			  }	
		
			//echo "Stop: " .$final;
			//echo "<br>";
			//echo "Requete: " .$req;
			//echo "<br>";
			

			/************************************/

	if($_SESSION['reponse_requete'] == true)
	  {	
		for($i=$premiereEntree; $i<$final ; $i++) 
		    {
			  	$marque = $sauvegarde[$i][0];
   		    		$prix_ttc = $sauvegarde[$i][1];
 		    		$designation = $sauvegarde[$i][2];
   		    		$reference = $sauvegarde[$i][3];
   		    		$id_catalogue = $sauvegarde[$i][4];
		    		$dispo = $sauvegarde[$i][5];
  		    		$s1 = $sauvegarde[$i][6];
		    		$chaine = $sauvegarde[$i][7];
		    	
			        if($i%2 ==0)
			          { // paire;
			      	    echo "<tr class=\"ProdListL1\">";
			          }
		    
			        else { // impair;
			        	 echo "<tr class=\"ProdListL1\">";
				     } 
					   
			        switch($dispo)
	  		              {
					  case "24H" :
					          $dispo_logo  = "../images/stock_vert.gif";
					          $dispo_message = "En stock";
					    	  break;
					  case "48H" :
					          $dispo_logo  = "../images/stock_bleu.gif";
					          $dispo_message = "En cours d'approvisionnement";
					    	  break;
					  case "72H" :
					          $dispo_logo  = "../images/stock_rouge.gif";
					          $dispo_message = "Rupture de stock";
					    	  break;  	  		  
				     }		 
					 
				echo "
					<td class=\"Photo\" width=\"106\">
				        <a href=\"page.html\">
					<img src=\"filtre_lave-linge.php_fichiers/99897.htm\" alt=\"message\"></a></td>
					<td class=\"Marque\" width=\"99\">$marque</td>
					<td class=\"Desc  \" width=\"203\">
					<a href=\"visu02_produit.php?ref=$reference&table=$table\">$s1</a>
				        <div class=\"TagLine\">message</div>
				        </td>
					<td class=\"Price\" width=\"63\">$prix_ttc &#8364;</td>
					<td class=\"AlignCenter\" width=\"40\">
					<img src=\"$dispo_logo\" alt=\"$dispo_message\" title=\"$dispo_message\" ></td>
	
	
			                <td class=\"Carac\" width=\"194\">$chaine</td>
					<td class=\"AlignCenter\">
					<input name=\"comp\" value=\"53771\" type=\"checkbox\"></td>
					<td class=\"AlignCenter\" width=\"30\">
					<a href=\"../panier/panier02.php?caddie=ajout&ref=$reference&table=$table\">
					<img src=\"../images/ProdBuySmall.gif\" alt=\"Ajouter au panier\" title=\"Ajouter au panier\" border=\"0\"></a>
					</td>
					</tr>
						";
									
		   
			}
			
    				echo "
					<tr class=\"ProdListBLine\">
					<td width=\"106\">Page $pageActuelle sur $nombre_pages</td>
					<td colspan=\"7\">
					<span class=\"Nav\">&lt;</span>	 ";
					
					
					for($i=1; $i<=$nombre_pages; $i++) 
				   	{ 	if($i == $pageActuelle)
				   		  { echo "<span class=\"Nav\">$i</span>";
				   		  }
				   		else { echo "<span class=\"Nav\">      <a href=\"filtre.php?page=$i \">$i</a></span> ";
					             }
				   	}
					
				echo "	
					<span class=\"Nav\">&gt;</span>
					</td>
					</tr> ";

/*					<tr class=\"ProdListBLine\">
					<td width=\"106\">Page 1 sur 3</td>
					<td colspan=\"7\">
					<span class=\"Nav\">&lt;</span>
					<span class=\"Nav\">1</span>
					<span class=\"Nav\">
					
					
					
					<a href=\"#prods\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 1, 0, 2);\">2</a></span>
					<span class=\"Nav\">
					<a href=\"#prods\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 1, 0, 3);\">3</a></span>
					<span class=\"Nav\">
					<a href=\"#prods\" onclick=\"ProdListUpdate('Disques_durs_internes_SATA', 1, 0, 2);\">&gt;</a></span>
					</td>
					</tr> ";
*/		

             			// pagination
             			/*echo '<p align="center">Page : '; 
	     			for($i=1; $i<=$nombre_pages; $i++)
				   { if($i==$pageActuelle) 
     				       {  echo ' [ '.$i.' ] '; 
     		     		       }	
     				     else {  echo ' <a href="filtre.php?page='.$i.' ">'.$i.'</a> ';
	     			          }
		                   }
				echo '</p>';*/
				
        
	          echo "
	  		<tr>
	  		<td colspan=\"6\" height=\"40\">Afficher
			<select name=\"select\" onchange=\"ProdListPpp('Disques_durs_internes_SATA', this.value);\" style=\"height: 20px; font-size: 10px;\">
			<option value=\"10\">10 produits</option>
			<option value=\"25\" selected=\"selected\">25 produits</option>
			<option value=\"50\">50 produits</option>
			<option value=\"-1\">tous les produits</option>
			</select>
			</td>
		 
			<td colspan=\"2\" align=\"right\">
			<input value=\"Comparer\" onclick=\"ProdComp();\" type=\"button\">
			</td>
			</tr>
        		</tbody>
        		</table>
			</div> ";
		}			

?>

</div>
</div>
</div>			</div>

			<!-- aside -->
			<div id="aside">
			<div id="search-bar">

			<form method="get" action="http://www.materiel.net/search.html">
			<input type="text" name="search" title="Recherche"/>
			<input type="submit" value="Rechercher" />
			</form>
			</div>
			

<?php
            
            //if(isset($_SESSION['connexion']))
			 
			    if($_SESSION['utilisateur_login']== "valide")
				  {         //echo '<body onLoad="alert(\'Identification par le panel.\')">'; 
							echo "
								<div id=\"account\" class=\"on\">
								<ul>
								<li class=\"icon\"><a href=\"compte/compte.php\">Mon espace perso</a></li>
								<li class=\"logout\"><a href=\"compte/logout.php\" title=\"Me d&eacute;connecter\">Me d&eacute;connecter</a></li>
								</ul>
								<div class=\"panel\">
								<ul class=\"buttons\">
								<li class=\"account\"><a href=\"compte/compte.php\">Mon compte client</a></li>
								<li class=\"orders\"><a href=\"commande/suivi_commande.php\">Mes commandes</a></li>
								<li class=\"addresses\"><a href=\"compte/adresse_livraison.php\">Mon carnet d'adresse</a></li>
								<li class=\"repairs\"><a href=\"compte/sav.html\">Mes retours S.A.V</a></li>
								<li class=\"parrainages\"><a href=\"compte/parrainage.html\">Mes parrainages</a></li>
								<li class=\"refunds\"><a href=\"compte/avoir.html\">Mes avoirs</a></li>
								<li class=\"carts\"><a href=\"panier/shopping_liste.php\">Mes paniers</a></li>
								<li class=\"alertes\"><a href=\"compte/alerte.html\">Mes alertes</a></li>
								</ul>
								</div>
								</div> ";
					
				     }
					 
					 else {
						 		echo "
						 		<div id=\"account\">
								<ul>
								<li class=\"icon\"><a href=\"compte/login.php\">Mon espace perso</a></li>
								</ul>

								<div class=\"panel\">
								<form action=\"compte/check.php\" method=\"post\">
								<dl>
								<dt><label for=\"login\">Votre nom utilisateur</label></dt>
								<dd><input name=\"login\" id=\"login\" maxlength=\"20\" type=\"text\"></dd>
								<dt><label for=\"pass\">Votre mot de passe</label></dt>
								<dd><input name=\"pass\" id=\"pass\" maxlength=\"10\" type=\"password\"></dd>
								</dl>
								<input value=\"Connexion\" type=\"submit\">
								<hr>
								<ul class=\"buttons\">
								<li class=\"register\"><a href=\"compte/creation_compte.php\">Créer mon compte</a></li>
								<li class=\"password\"><a href=\"compte/sendpass.php\">Mot de passe oublié ?</a></li>
								</ul>
								</form>
								</div>
								</div> ";
						 
					      }
					 
		/*			 
		if(isset($_POST['classer']))
	          {  echo '<body onLoad="alert(\' Classement ...\')">'; 
		
		     if($_POST['classer'] == "ok")
		       { echo '<body onLoad="alert(\' Classement ...\')">'; 
		       }
	          }	 */

?>
      

<div id="basket" >
	<ul>
		<li id="BasketProdCount"><a href="panier/panier.php">Votre panier est vide</a></li>
		<li id="BasketAmount"></li>
	</ul>
</div>
  </div>
			<!-- footer -->
			

		</div>
	</body></html>