<?php
include("includes/site_info.php");
include("session_handler.inc");
include("includes/functions.php");
include('lib/lib.Functions.php');
include_once __INCLUDE_CLASS_PATH."/class.Picture.php";
$picture = new Picture();

$WUserID = $_SESSION['Sess_UserId'];
$WUserType = $_SESSION['Sess_UserType'];

################

$flirtQuery=mysql_query("SELECT * FROM notifications LEFT JOIN members ON (ntf_senderid=mem_userid) where ntf_receiverid=$WUserID and ntf_response='W' group by ntf_senderid order by ntf_dateadded desc",$link); 

?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" class="white_back_t_xb">
  <tr class="grey_12 orange_row_back solid_line_separator">
    <td><img src="images/icon-addre.gif" width="30" height="15" align="absmiddle" /> Alerts - Flirts</td>
  </tr>
  <tr>
    <td valign="top"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="white_back_t_xb p5">
        <tr>
          <td valign="top"><div id="sub_content">
              <table width="100%" border="0" align="left" cellpadding="5" cellspacing="0" class="white_back_t_xb p5">
                <?php 
	 while ($ret_pic = mysql_fetch_object($flirtQuery)) {
if ($WUserID==$ret_pic->mem_userid) {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_pic->mem_userid' and pic_default='Y'") or die(mysql_error()); 
} else {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_pic->mem_userid' and pic_default='Y' and pic_private='N'") or die(mysql_error()); 
}
$pics_count = mysql_num_rows($photo_query);
$aPicture = mysql_fetch_object($photo_query);
if ($pics_count > 0) {
	$medium = $aPicture->pic_picture."_ps.".$aPicture->ext;
	$male1_picture1 = "members/$ret_pic->mem_username/picture/$medium";
             }else{
$male1_picture1=$picture->GetProfilePicture($ret_pic->mem_userid);
}

if ($ret_pic->mem_profileid != null) { $male1_name1= $ret_pic->mem_profileid; }
else { $male1_name1= $ret_pic->mem_username; }

?>
                <tr class='solid_line_separator'>
                  <td width='50px' align='left' valign="top"><a href="<?=$CONST_LINK_ROOT?>/<?=$male1_name1?>"><img src="<?=$CONST_LINK_ROOT?>/<?=$male1_picture1?>" width="50" height="50" class="image_border" title="Name:&nbsp;<?=ucwords($male1_name1)?>"/></a></td>
                  <td align='left' width='100%'>
                    <div id="formlayer_<?=$ret_pic->ntf_id?>"> <div><strong><?=ucwords($male1_name1)?></strong> <?=$ret_pic->ntf_msg?></div>
<form action="javascript:void(null);" name="form_<?=$ret_pic->ntf_id?>" id="form_<?=$ret_pic->ntf_id?>">
  <textarea name="flirt-msg" cols="60" rows="2" id="flirt-msg"></textarea>
  <input type='hidden' name='flirt_id' value='<?=$ret_pic->ntf_id?>' />
  <input type='hidden' name='RUserID' value='<?=$ret_pic->mem_userid?>' />
  <input type='hidden' name='RUserName' value='<?=$ret_pic->mem_username?>' /><br />
  <input name="Flirt" type="button" class="button" id="Flirt" onclick="javascript:flirtback(this.parentNode, 'inbox_flirt', 'formlayer_<?=$ret_pic->ntf_id?>');" value="Flirt Back" />
    <input id="Remove" type="button" class="button" onclick="javascript:flirtback(this.parentNode,'inbox_remove', 'formlayer_<?=$ret_pic->ntf_id?>');" value="Remove" />
                    </form> </div></td>
                </tr>
                <? 
				$i++;
				} ?>
              </table>
            </div>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table></td>
  </tr>
</table>
