<?php
if ($IS_TABLE_DEF != 1)
{

$IS_TABLE_DEF = 1;

function table_up($title, $width = "100%", $bgcolor = "white")
{
	global $IMAGES_DIR;
?>
<table width="<?php echo $width?>" border=0 cellspacing="0" cellpadding="0">
<tr>
	<td <?php echo $MyBgColor ?> class=smallDark>
<?php
}

function table_down()
{
?>
			</td>
		</tr>
	</table>
<?php
}

function table2_up($title_image, $width = "100%", $border_color = "#FFCC00", $bgcolor = "white")
{
	global $IMAGES_DIR;

	if ($title_image != "")
	{
		echo "<table border=0 cellpadding=0 cellspacing=0 width=".$width.">";
		echo "<tr><td width=220 align=left valign=bottom bgcolor=$border_color><img src=\"".$IMAGES_DIR."tableaux/titres/".$title_image."\"></td>";
		echo "<td align=right valign=bottom bgcolor=$border_color><img src=\"".$IMAGES_DIR."spacer.gif\"></td>";
		echo "</tr>";
		echo "</table>";
	}
	echo "<table cellpadding=5 cellspacing=1 width=".$width." bgcolor=".$border_color.">";
	echo "<tr><td class=smallDark bgcolor=".$bgcolor." width=100% align=left valign=top>";
}

function table2_down()
{
	echo "</td>";
	echo "</tr>";
	echo "</table>";
}

function tableBlackList_up($title_image, $width = "100%",$height = "", $border_color = "#FFCC00", $bgcolor = "white")
{
	global $IMAGES_DIR;

	if ($title_image != "")
	{
		echo "<table border=0 cellpadding=0 cellspacing=0 width=".$width." >";
		echo "<tr><td width=220 align=left valign=bottom bgcolor=$border_color><img src=\"".$IMAGES_DIR."tableaux/titres/".$title_image."\"></td>";
		echo "<td align=right valign=bottom bgcolor=$border_color><img src=\"".$IMAGES_DIR."spacer.gif\"></td>";
		echo "</tr>";
		echo "</table>";
	}
	echo "<table cellpadding=5 cellspacing=1 width=".$width." bgcolor=".$border_color." height=".$height.">";
	echo "<tr><td class=smallDark bgcolor=".$bgcolor." width=100% align=left valign=top>";
}

function tableBlackList_down()
{
	echo "</td>";
	echo "</tr>";
	echo "</table>";
}

function table3_up($title, $width = "100%", $bgcolor = "#005F3F")
{
	global $IMAGES_DIR;

	if ($title != "")
	{
		if ($bgcolor == "#CCCCCC")
			$title_class = "boldDarkGreen";
		else
			$title_class = "boldLight";
		echo "<table border=0 cellpadding=0 cellspacing=0 width=".$width.">";
		echo "<tr><td class=".$title_class." align=left height=16 valign=middle bgcolor=$bgcolor>&nbsp;".$title."</td>";
		echo "</tr>";
		echo "</table>";
	}
	echo "<table cellpadding=10 cellspacing=1 width=".$width." bgcolor=".$bgcolor.">";
	echo "<tr><td class=smallDark bgcolor=#FFFFFF width=100% align=left valign=top>";

}

function table3_down()
{
	echo "</td>";
	echo "</tr>";
	echo "</table>";
}

// affiche une ligne pointillée
function print_ligne($couleur, $longueur)
{
	global $IMAGES_DIR;
	echo "<table border=0 cellpadding=0 cellspacing=0>";
	echo "<tr><td>";

	// on fait une approx sur le nb d'image à accoler pour arriver à la bonne longueur
	$nb_elements = floor($longueur / 18);
	$image_a_afficher = "<img src=\"".$IMAGES_DIR."lignes/ligne_";
	if (strstr($couleur, "#") != false)
		$image_a_afficher .= substr($couleur, 1);
	else
		$image_a_afficher .= $couleur;
	$image_a_afficher .= ".gif\">";

	for ($i = 0 ; $i < $nb_elements ; $i++)
	{
		echo $image_a_afficher;
	}
	echo "</td></tr>";
	echo "</table>";
}

}


function table_register_up( $titre, $bordure=0 )
{
echo "
<table id=\"registration-bloc\" border=0>
		<th id='head1'></th>
		<th id='head2'>
			<span>$titre</span>
		</th>
		<th id='head3'></th>
	<tr>
		<td rowspan=2 id='corps1' ".(($bordure==1)?"class=bordure":"")."></td>
		<td>
";

}

function table_register_down( $bordure=0 )
{
echo "
		</td>
		<td rowspan=2 id='corps3' ".(($bordure==1)?"class=bordure":"")."></td>
	</tr>
	<tr><td ".(($bordure==1)?"class=bordure":"")."></td></tr>
</table>
";

}


function table_ktf_up( $titre, $width, $couleur="noir", $bordure=0, $titlesize='12px', $titlecolor='#fff', $bgcolor='#fff' )
{
echo "
<table class=\"bloc\" id=\"$couleur\" style='width:$width;'>
		<th id='head1'></th>
		<th id='head2'>
			<span style='color:$titlecolor;font-size:$titlesize'>$titre</span>
		</th>
		<th id='head3'></th>
	<tr>
		<td rowspan=2 id='corps1' ".(($bordure==1)?"class=bordure":"")."></td>
		<td id='corps2' style='background-color:$bgcolor;' align=center>
";

}

function table_ktf_down( $couleur="noir", $bordure=0, $bgcolor='#fff' )
{
echo "
		</td>
		<td rowspan=2 id='corps3' ".(($bordure==1)?"class=bordure":"")." style='background-color:#FFF;'></td>
	</tr>
	<tr><td ".(($bordure==1)?"class=bordure":"")." style='background-color:$bgcolor;'></td></tr>
</table>
";

}


function table_kdo( $titre,$image,$qte, $prix, $giftName,$sess )
{
	global $SERVER_URL,$IMAGES_DIR,$REGISTRATION_PAGE,$SHOP_PAGE;
	echo "
	<table cellpadding=0 cellspacing=0 style=\"background: url('".$IMAGES_DIR."boite_cadeau.jpg');width:300px;height:250px\" >
		<tr>
			<td align=center class=Bigboldwhite>		
					".$titre."
			</td>
		</tr>
		<tr>
			<td align=center class=smallwhite>	
					<img src='".$SERVER_URL.$image."'>
					<br>(photo non contractuelle)
			</td>
		</tr>
		<tr>
			<td align=center class=smallboldwhite>		
					Quantité disponible : ".$qte."
			</td>
		</tr>	
		<tr>
			<td align=center class=smallboldwhite>		
					KF requis : ".number_format($prix,0,""," ")."&nbsp;<img align=absmiddle src='".$IMAGES_DIR."icone_kf.jpg'>	
			</td>
		</tr>
		<tr>
			<td align=center>
		";
	if($sess != 0)
	{
		if($sess->memberid == -1)
		{
			echo "<a class=smallDarkLink href='".$sess->link3($REGISTRATION_PAGE, "")."'><img src='".$IMAGES_DIR."boutons/btn_inscription_cadeau.gif' border=0 alt=\"je m'inscris !\"></a>";
		}
		else
		{
			echo "<a class=smallDarkLink href=\"".$sess->popup2($SHOP_PAGE, "giftName=".base64_encode($giftName),"",540,570)."\"><img src='".$IMAGES_DIR."boutons/btn_voir_cadeau.gif' border=0 alt='je veux ce cadeau'></a>";
		}
	}
	else
		echo"<br>";
		
	echo "
		</td>
		</tr>	
	</table>					
	";

}



?>