<?php $famitypen = array('K'=>'Kind','P'=>'Partner','HV'=>'Hauptvers.'); ?>
     <form name="usertable" action="<?=$_SERVER['REQUEST_URI']?>" action="POST" width="650">
       <input type="hidden" name="module" value="<?=$module?>" />
       <input type="hidden" name="action" value="<?=$action?>" />
       <input type="hidden" name="state" value="<?=$state?>" />
       <script language="JavaScript">
         var background;
         function highlight(id)
         {
             row = document.getElementById(id);
             background = row.style.backgroundColor;
             row.style.backgroundColor = '#ffffff';
             row.style.cursor = 'hand';
         }
         function lowlight(id)
         {
             row = document.getElementById(id);
             row.style.backgroundColor = background;
         }
       </script>
       <table border="0" cellspacing="1" cellpadding="3" style="border: 1px solid black">
         <tr bgcolor='#dddddd'>
           <td width="5%"><a href="javascript:formsubmit('anrede')">Anrede&nbsp;Titel</a></td>
           <td width="15%"><a href="javascript:formsubmit('name')">Name</a></td>
           <td width="20%"><a href="javascript:formsubmit('plz')">Adresse</a></td>
           <td width="20%"><a href="javascript:formsubmit('email')">E-Mail</a></td>
           <td width="10%"><a href="javascript:formsubmit('versnummer')">Vers.Nr.</a></td>
           <td width="10%"><a href="javascript:formsubmit('versnummer')">Fam.-Typ</a></td>
           <td width="20%">&nbsp;</td>
         </tr>
<?php
$color[0] = "#eeeeee";
$color[1] = "#f2f2f2";
$colnr=0;
for ($i = 0; $i < sizeof($users); $i++) :
    $user = $users[$i];
    $colnr=1-$colnr;
    $mycolor = $color[$colnr];
    if ((isset($userId)?$userId:0) == $user->userId) :
        $mycolor = '#fff2f2';
    endif;
    $link = " onclick=\"window.location='" . $_SERVER['PHP_SELF']. "?module=$module&action=edit&userId=".$user->userId."&deleted=$deleted'\"";
    if ($user->userId == 0) :
        $link = " onclick=\"window.location='" . $_SERVER['PHP_SELF']. "?module=$module&action=abgleich&userid=" . $userId . "&id=" . $user->id . "&versnummerneu=". $user->versnummerneu. "'\"";
        $mycolor = '#ffa2a2';
    endif;
?>
         <tr bgcolor="<?=$mycolor?>" onMouseOver="highlight('zeile<?=$i?>')" onMouseOut="lowlight('zeile<?=$i?>')" id="zeile<?=$i?>">
           <td<?=$link?>><?=$user->anrede?>&nbsp;<?=$user->titel?></td>
           <td<?=$link?>><?=$user->vorname?>&nbsp;<?=$user->name?></td>
           <td<?=$link?>><?=str_replace(' ','&nbsp;', $user->strasse . " " . $user->hausnummer)?><br/>
           <?=$user->plz?>&nbsp;<?=$user->ort?><br/>
           <?=$user->land?></td>
           <td<?=$link?>><?=$user->email?></td>
           <td<?=$link?>><?=$user->versnummer?> <?=$user->rechtskreis?></td>
           <td<?=$link?>><?=$famitypen[$user->famityp]?></td>
           <td>
<?php 
    if ($user->userId) : ?>
             <table>
               <tr>
                 <td>
                   <a href="<?=$_SERVER['PHP_SELF']?>?module=<?=$module?>&action=edit&userId=<?=$user->userId?>&deleted=<?=$deleted?>"><img src="/grafik/button_edit.png" border="0" alt="Editieren" /></a>
                 </td>
                 <td>
                   <a href="mailto:<?=$user->email?>"><img src="/grafik/button-mail.gif" border="0" alt="EMail" /></a>
                 </td>
                 <td>
                   <a href="<?=$_SERVER['PHP_SELF']?>?module=<?=$module?>&action=addpoints&userId=<?=$user->userId?>&deleted=<?=$deleted?>"><img src="/grafik/button_points.png" border="0" alt="Punkte vergeben" /></a>
                 </td>
                 <td>
                   <a href="<?=$_SERVER['PHP_SELF']?>?module=<?=$module?>&action=<?=$action?>&command=delete&userId=<?=$userId?>&famiId=<?=$user->userId?>"><img src="/grafik/button_drop.png" border="0" alt="Familienmitglied loeschen" /></a>
                 </td>
               <tr>
             </table>
<?php  
    endif; ?>
           </td>
         </tr>
<?php
endfor; 
?>
</table>
</form>
