<script type="text/javascript"> 
	function selectAll(value) 
	{

		var i = 1;
		
		while(document.getElementById("email"+i)) 
		{	 
			var myCheckBox = document.getElementById("email"+i);	 
			 
			//if the header checkbox is checked, then check the checkboxes in the grid			 
			if (value == true)			 
				myCheckBox.checked = true;
			 
			else			 
				myCheckBox.checked = false;		
			
			i++;
		 
		} 
	} 
	</script>

<table id=register_main>
<tr>
	<td valign=top id="register_maingauche">
		<?php include( $ARCHIVES_DIR . "tag_300x250_bookmaker.html"); ?>
		<br><br>
		<?php include( $ARCHIVES_DIR . "tag_300x250.html"); ?>
	</td>
	<td id="register_maindroit" >		
	

	<?php
		table_ktf_up( "<h1 class='h1table'>Connectez vous à votre carnet d'adresse ".$typecompte."</h1>", $BOX_WIDTH, 'green',1,'','','#FFFFFF' );
	
	if($error)
	{
		echo "<div>".$error."</div>";
	}
	
	?>
	


		<?php
		$form_action = $sess->action($CARNETADRESSE_PAGE);
		$form_name = "carnetadresse";			
		include($FORM_HEADER);

		if($checkboxes == "")
		{
		?>
			<div class="text12bold blanc" style="margin-top:20px;margin-left:0px;text-align:center;">
			<?php
					if($result)
					{
						echo "<div style='margin-top:10px;margin-bottom:10px' class='text12bold blanc'>".$result."</div>";
					}
					?>
				<div style="width:200px;margin-left:auto;margin-right:auto;text-align:left;">
					<div style="height:68px;margin-bottom:10px;">
						<img src="<?php echo $IMAGES_DIR."carnet_".$typecompte.".png";?>"/>
					</div>
					<div style="height:50px;">
						utilisateur : 
						<br/>
						<input type="text" name="email" class="input_field" style="width:180px;"/>
					</div>
					<div style="height:50px;">
						Mot de passe : 
						<br/>
						<input type="password" name="pwd" class="input_field" style="width:180px;" />
					</div>
					<?php
					/*if($error)
					{
						//echo "<div style='margin-top:10px;margin-bottom:10px;text-align:center;' class='text12bold rouge'>".$error."</div>";
					}*/
					?>
						
				</div>

				<div  id="bouton" style="text-align:center;width:220px;margin-left:auto;margin-right:auto;margin-top:10px;margin-bottom:10px;">
					<a href="<?php echo $sess->link4($ADD_FRIENDS_PAGE,"");?>"><img src="<?php echo $IMAGES_DIR."boutons/bouton_retour.gif";?>" style="float:left;" border=0  /></a>
					<input type="image" src="<?php echo $IMAGES_DIR."boutons/bouton_valider.gif";?>" style="float:left;" name="valider" onclick="document.getElementById('loadingImg').style.display='block';document.getElementById('bouton').style.display='none';document.forms.carnetadresse.submit();" />			
				</div>
				<div id="loadingImg" style="display:none;text-align:center;width:208px;margin-left:auto;margin-right:auto;margin-bottom:10px;">
					<img src="<?php echo $IMAGES_DIR."Ajax/loadingAnimation.gif";?>" />
				</div>
			</div>
			
			
			
		<?php
		}
		else
		{
		?>
			<?php
				if($result)
				{
					echo "<div style='margin-top:10px;margin-bottom:10px' class='text12bold blanc'>".$result."</div>";
				}
				
			?>
			<div class="text12 blanc" style="margin-top:5px;margin-bottom:5px;">
				<a href="#" onclick="selectAll(true);return false;" class="smalldark">Tout sélectionner</a>
				-
				<a href="#" onclick="selectAll(false);return false;" class="smalldark">Tout désélectionner</a>
			</div>
			<div id="CheckBoxesList" class="text11bold blanc" style="margin-top:10px;margin-left:0px;width:100%;text-align:left;">
		<?php
			echo $checkboxes;
		?>
			</div>
			<div style="text-align:center;margin-top:10px;">
				<input type="hidden" name="listEmail" value="1"/>	
				<input type="hidden" name="email" value="<?php echo $email;?>"/>
				<input type="hidden" name="pwd" value="<?php echo $pwd;?>" />
				<input type="image" src="<?php echo $IMAGES_DIR."boutons/bouton_valider.gif";?>" name="valider"  />
			</div>

		<?php
		}
		?>
		<input type="hidden" name="typecompte" value="<?php echo $typecompte;?>"/>	
		<input type="hidden" name="GameId" value="<?php echo $GameId;?>"/>	
		<?php
		include($FORM_FOOTER);
		?>
	<?php
	table_ktf_down("",1); 
	?>
	
	
	</td>
</tr>
</table>