<script type="text/javascript">
$('#statlink, #viptasks').tipTip();
</script>
<?

$sql = mysql_query("SELECT * FROM tb_statlinks WHERE balance >= price and modered = 1 and paused = 0 ORDER BY RAND() LIMIT 5") or die(mysql_error());
$flor_br = 1;
while ($row = mysql_fetch_assoc($sql)) {
	if($row['balance'] < $row['price']) {
		mysql_query("UPDATE tb_statlinks SET paused = 1, balance = 0 WHERE id = '" . $row['id'] . "'") or die(mysql_error());
	}
	
	?><div style="margin-top: -5px; padding-left: 7px;" class='contextlink' > 
	<a  href='/st_url.php?link=<?=$row['id'] ?>' id="statlink" target='_blank' title='переходов <?=$row['views'] ?>'>
	<?=substr($row['description'], 0, 32) ?><span><?=substr($row['texto'], 0, 32) ?><br />
	<span class='urlcontext'><?=substr($row['url'], 0, 40) ?></span></span></a></div>
	
<?
$flor_br ++;
}
if($flor_br > 1 ) { ?><br /><?}
?>
<?php
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
include_once 'functiones.php';
    ?>
    <br /><div style="text-align: center; font-size: 12px; color: #212121; text-shadow: 0 1px 0 #f8f8f8; padding-bottom: 3px; margin-top: -7px;">V.I.P задания</div>
    <div class="right_line"></div>
    <? $sql = mysql_query("SELECT name, reyt, price, id FROM seo_tasks WHERE modered = 1 and balance >= price and paused = 0 and inblock > 0 ORDER BY RAND() LIMIT 5");
    $flor_br_task = 1;
	while ($row = mysql_fetch_assoc($sql)) {
        ?>
        <div style="margin-top: -5px; padding-left: 7px;" class='uptask'><a href='tasks/view=<?=$row['id']; ?>' id="viptasks" title='Перейти к заданию'>
        <?=substr($row['name'], 0, 40); ?></a><br />
        <span class='uptaskprice'>Цена: <?=moneyraund($row['price'] * 5 / 6, 2) ?> <?=$sitevalname ?></span>
        <span class='rating<?=intval($row['reyt']); ?>' style='float: right; margin-top: -2px;'></span></div>
        <?
	$flor_br_task ++;
    }
}
if($flor_br_task > 1 ) { ?><br /><?}
?>