<?php
	include("vars.php");
	include("db.php");
?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<link href="../js_css/iframe.css" rel="stylesheet">
</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#1AB9F1">
<script language="javascript" src="../js_css/javascript.js"></script>
<table border="0" width="297" id="table1" cellspacing="0" cellpadding="5">
	<tr>
		<td height="19" colspan="2" width="297">
		<img border="0" src="../img/title/sms_text.jpg" width="196" height="19"></td>
	</tr>
<?php
	
	$msg = "gverdi carielia";
	if($cur_page && $sms_type)
	{
		$msg = "";
		$result = mysql_query("SELECT * FROM sms_book WHERE sms_type = '$sms_type' AND sms_status = '1' ORDER BY sms_date DESC",$db);
		if($myrow = mysql_fetch_array($result))
		{
			$sms_rec = mysql_num_rows($result);
			$page_count = $sms_rec / $cur_page_max;
			$page_count = ceil($page_count);
			//
			echo('<tr>'."\n");
			echo('<td width="10">&nbsp;</td>'."\n");
			$back_page = $cur_page - 1;
			$next_page = $cur_page + 1;
			$msg_left = '<a href="sms_text_book.php?cur_page='.$back_page.'&sms_type='.$sms_type.'" class="link_geo4" target="_self"><<</a>';
			$msg_right = '<a href="sms_text_book.php?cur_page='.$next_page.'&sms_type='.$sms_type.'" class="link_geo4" target="_self">>></a>';
			if($cur_page==1)
			{
				$msg_left = "";
			}
			if($cur_page==$page_count)
			{
				$msg_right = "";
			}
			echo('<td width="287" class="geo"><a href="sms_text.php" class="link_geo4" target="_self">sarCevi</a>&nbsp;&nbsp;'.$msg_left.' <font color="#0F6988">('.$cur_page.' / '.$page_count.')</font> '.$msg_right.'</td>'."\n");
			echo('</tr>'."\n");
			//
			$icount = 0;
			$max_st = $cur_page * $cur_page_max;
			$min_st = $max_st - $cur_page_max;
			do
			{
				if($icount >= $min_st && $icount < $max_st)
				{
					$sms_numb = $icount + 1;
					echo('<tr>'."\n");
					echo('<td width="10" bgcolor="#1895C1" align="left" vAlign="top" class="geo">'.$sms_numb.'&nbsp;</td>'."\n");
					echo('<td width="287" class="geo" bgcolor="#17A8DB">'.$myrow['sms_text'].'<br>avtori - '.$myrow['sms_author'].' ('.$myrow['sms_date'].')<br><a href="javascript:add_sms(\''.$myrow['sms_text'].'\');" class="link_geo4" title="gaugzavne">gaugzavne</a>&nbsp;</td>'."\n");
					echo('</tr>'."\n");
					echo('<tr>'."\n");
					echo('<td width="10" height="5"><img src="../img/design/5px.gif" width="1" height="5" border="0"></td>'."\n");
					echo('<td width="287" class="geo" height="5"><img src="../img/design/5px.gif" width="1" height="5" border="0"></td>'."\n");
					echo('</tr>'."\n");
				}
				$icount = $icount + 1;
			}
			while($myrow = mysql_fetch_array($result));
		}
		else
		{
			$msg = "gverdi carielia";
		}
	}
?>
	<tr>
		<td width="10">&nbsp;</td>
		<td width="287" class="geo"><?=$msg?>&nbsp;</td>
	</tr>
</table>
</body>

</html>
