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

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

$suspended_list="0";
$mem_q=mysql_query("select * from blockmail where blk_receiverid='$WUserID'");
while($mem=mysql_fetch_array($mem_q))
{
$suspended_list.=",".$mem["blk_senderid"];
}
	
$msgr=mysql_query("SELECT msg_senderid FROM messages WHERE (msg_receiverid='$WUserID') AND msg_receiverdel='N' AND msg_senderid not in ($suspended_list) AND msg_read='U' ORDER BY msg_dateadded") or die(mysql_error());
$count_msgr=mysql_num_rows($msgr);

$friend=mysql_query("SELECT * FROM my_friends WHERE friend_uid ='$WUserID' AND approved='0' AND status='P'");
$count_friend=mysql_num_rows($friend);

$flirtQuery=mysql_query("SELECT * FROM notifications where ntf_receiverid=$WUserID and ntf_response='W' group by ntf_senderid",$link); 
$count_flirt=mysql_num_rows($flirtQuery);

$viewed_visit_query=mysql_query("SELECT enc_viewerid FROM encounters WHERE enc_userid='$WUserID' ORDER BY enc_viewdate DESC",$link) or die(mysql_error());
$viewed_visit_count = mysql_num_rows($viewed_visit_query);

$liked_query=mysql_query("SELECT fav_userid FROM like_list WHERE fav_advid='$WUserID' ORDER BY fav_dateadded DESC",$link) or die(mysql_error());
$liked_count = mysql_num_rows($liked_query);

$comment=mysql_query("SELECT com_memid FROM profile_comment WHERE com_memid ='$WUserID' AND com_approved = '2' ORDER BY com_time DESC",$link) or die(mysql_error());
$comment_count=mysql_num_rows($comment);

$tendayz= date('Y-m-d', (time() - (10 * 24 * 60 * 60)));
$new_query=mysql_query("SELECT * FROM adverts WHERE adv_createdate >= '$tendayz' AND adv_approved='1'");
$new_count=mysql_num_rows($new_query);
?>
<script type="text/javascript">  
jQuery.noConflict();

jQuery(document).ready(function () {
	
	hash2 = document.location.hash.replace(/\?.*$/,'');
//	alert(hash2);
	
	jQuery('a[rel=sub_link]').removeClass('active');
	//highlight the selected link
	jQuery('a[href=' + document.location.hash + ']').addClass('active');
});
</script> 
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><ul id="sidemenu">
      <li><a href="#getStart" rel="sub_link" id="tab_getstart" onclick="javascript: callpage(this.href);">GET START </a></li>
      <li><a href="#mail" rel="sub_link" id="tab_mail" onclick="javascript: callpage(this.href);">Personal Messages (<?=$count_msgr;?>)</a></li>
      <?php if($count_friend>0) {?>
	  <li><a href="#request" rel="sub_link" id="tab_request" onclick="javascript: callpage(this.href);">Somebody Requests (<?=$count_friend;?>)</a></li>
	  <?php } ?>
      <?php if($count_flirt>0) {?>
      <li><a href="#flirt" rel="sub_link" id="tab_flirt" onclick="javascript: callpage(this.href);">Flirts (<?=$count_flirt;?>)</a></li>
	  <?php } ?>
      <li><a href="javascript: void(null)" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/viewed-me.php'}, 'Who&nbsp;Viewed&nbsp;Me', 'viewedMe'); return false;" rel="facebox">Who Viewed Me (<?=$viewed_visit_count;?>)</a></li>
      <li><a href="javascript: void(null)" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/liked-me.php'}, 'Who&nbsp;Liked&nbsp;Me', 'likedMe'); return false;" rel="facebox">Who Liked Me (<?=$liked_count;?>)</a></li>
		<?php if($_SESSION["facebook_login"]=="yes") {?><li><a href="<?=$CONST_LINK_ROOT?>/fpinvite.php" rel="sub_link" id="tab_fbinvite">Invite Friends Via <img src="images/facebook_icon.gif" alt="facebook" width="16" height="16" border="0" align="absbottom" /></a></li>
		<?php } ?>
      <!--li><a href="javascript:void(null)">New Hahapers (<?=$new_count;?>)</a></li>
      <li><a href="javascript:void(null)">Comments (<?=$comment_count;?>)</a></li-->
    </ul></td>
  </tr>
<!--  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><div style="width:80%"><div class="grey_style_back">SOCIALIZER</div>
                  <table width="100%" border="0" cellspacing="0" cellpadding="10" class="white_back_t_xb border-1px">
                    <tr>
                      <td align="center"><img src="images/wauhhsociety.jpg" alt="WauHHSociety" width="86" height="46" border="0" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="dot_line_close">Pre-Beta</td>
                    </tr>
                  </table>
                  <div class="grey_style_back2"><a href="http://socializer.wauhaha.com" target="_self">Go Site</a></div></div></td>
  </tr>
--></table>
