<?php
define('USERNAME_REQUIRED', TRUE);
define('ACCOUNT_REQUIRED', TRUE);
include('global.php');
define("THIS_SCRIPT", 'rooms');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<head>
<title><?php echo $sitename." - ".$lang['popular_rooms']; ?></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript" src="Public/JS/jquery.history.js"></script>
    <link type="text/css" rel="stylesheet" href="Public/Styles/<?php echo $currentstyle ?>/CSS/main.css" />
</head> 
 
<body> 
 
<div class="mainBox"> 
	<?php include("header.php"); ?>
	<?php include("system/homenav.php"); ?>

	<div class="mid" id="midcontent"> 

<div class="column" id="column1">

	<div class="contentBox">
		<div class="boxHeader"><?php echo $lang['popular_rooms']; ?></div>
		<div class="boxContent">
			<?php
			$roomq = mysql_query("SELECT * FROM rooms WHERE users_now > 0 ORDER BY users_now DESC LIMIT 20");
			while($room = mysql_fetch_array($roomq))
			{
				?>
				<div class="RoomsBox">
					<div class="RoomSearchResultsIcon" style="background-image:url(Public/Images/rooms/<?php if($room['roomtype'] == 'private')echo $room['model_name']; else echo 'public'; ?>.gif);"></div>
					<div class="Roomsname"><?php echo $room['caption']; ?></div>
					<div class="Roomsinfo"><?php echo $lang['owner']; ?>: <?php if($room['roomtype'] == 'private')echo '<a href="home.php?u='.$room['owner'].'">'.$room['owner'].'</a>'; else echo 'N/A'; ?></div>
                    <div class="Roomsinfo"><?php echo $lang['room_visitors']; ?>: <?php echo $room['users_now']; ?></div>
                    <div class="Roomsinfo"><?php echo $lang['room_rating']; ?>: <?php echo $room['score']; ?></div>
                    <div class="Roomsinfo"><?php echo $lang['room_state']; ?>: <?php echo $room['state']; ?></div>
				</div>
            <?php
			}
			?>
		</div>
	</div>
</div>
		
<div class="column" id="column2">
	<?php
	$query = mysql_query("SELECT * FROM cms_news ORDER BY published DESC LIMIT 1");
	$num = mysql_num_rows($query);
	if($num > 0)
	{
		$news = mysql_fetch_array($query);
		echo'<div class="newsHeader">
				<div class="HeadlineStory" id="'.$news["id"].'" style="background: url('.$news["image"].') no-repeat; display:block;">
					<p class="Mainheadline"><a href="articles.php?story='.$news["id"].'">'.stripslashes($news["title"]).'</a></p>
					<p class="Mainstory">'.strip_tags($news["shortstory"], '<br><br/><br />').'</p>
				</div>
		</div>';
		$color = 'odd';
		$query = mysql_query("SELECT * FROM cms_news ORDER BY published DESC LIMIT 5");
		while($news = mysql_fetch_array($query))
		{
			echo'<div class="storybox" id="'.$color.'" ref="'.$news["id"].'">
				<p class="headline"><a href="articles.php?story='.$news["id"].'">'.$news["title"].'</a></p>
				<p class="date">'.@date("d-m-Y", $news['published']).'</p>
			</div>';
			if($color == 'odd')
			$color='even';
			else
			$color='odd';
		}
	}
	?>
		<div class="storyboxEnd">
			<div class="readmore"><a href="articles.php">Read More &raquo;</a></div>
		</div>
</div>
		
<?php include("system/sideads.php"); ?>

	</div> 

	<?php include("system/footer.php"); ?>
</div> 

</body> 
</html>