<?php include 'sets.php';?>
<html>
<head>
<title>Photo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body bgcolor="#<?php echo $color1 ?>" text="#000000" leftmargin="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center" height="100%">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="10" class="text" bgcolor="#FFFFFF" height="100%">
        <tr> 
          <td> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" class="text">
              <tr> 
                <td height="66" align="center"> 
                  <table width="60" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                            
                      <td bgcolor="#<?php echo $color5 ?>"><img src="images/gframe.gif" width="150" height="6"></td>
                          </tr>
                          <tr> 
                            <td> 
                              
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">
                          <tr> 
                                  <td bgcolor="#<?php echo $color5 ?>" width="1"></td>
                                  
                            <td align="center"><img src="images/logo2.gif"></td>
                                  <td bgcolor="#<?php echo $color5 ?>" width="1"></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
              </tr>
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="2" cellpadding="4" height="100%" bgcolor="#<?php echo $color5 ?>">
                    <tr>
                      <td bgcolor="#<?php echo $color2 ?>">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="text" height="100%">
                          <tr> 
                            <td height="1"> 
                              <?php 
			include 'connect.php';
			$sql1 = "SELECT * FROM photos WHERE main='yes' ORDER BY priority desc";
			$result1 = mysql_query($sql1);
				$num_rows = mysql_num_rows($result1);
			 while ($myrow=mysql_fetch_array($result1)) {
			$pid=$myrow['id'];
?>
                              <?php 
			include 'connect.php';
			$sql2 = "SELECT * FROM photos WHERE id='$id'";
			$result2 = mysql_query($sql2);
	        while ($myrow=mysql_fetch_array($result2)) {
			$photoid=$myrow['id'];
			$photo=$myrow['name_en'];
			$description=$myrow['description_en'];
			$priority=$myrow['priority'];
?>
                              <?php 
			include 'connect.php';
			$sql3 = "SELECT * FROM photos WHERE main='yes' AND priority>'$priority' ORDER BY priority LIMIT 0,1";
			$result3 = mysql_query($sql3);
	        while ($myrow=mysql_fetch_array($result3)) {
			$photoid2=$myrow['id'];
			$priority2=$myrow['priority'];
?>
                              <?php } ?>
                              <?php } ?>
                              <?php } ?>
                            </td>
                          </tr>
                          <tr> 
                            <td height="20"> 
                              <div align="center"><span class="titles"> 
                                <?php echo $photo ?>
                                </span></div>
                            </td>
                          </tr>
                          <tr> 
                            <td height="10"></td>
                          </tr>
                          <tr> 
                            <td height="20"> 
                              <div align="center"> 
                                <?php echo $description ?>
                              </div>
                            </td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                          </tr>
                          <tr> 
                            <td height="2" bgcolor="#<?php echo $color5 ?>"></td>
                          </tr>
                          <tr> 
                            <td height="20" bgcolor="#<?php echo $color3 ?>"> 
                              <?php if ($priority>=$priority2)    {?>
                              <table border="0" cellspacing="0" cellpadding="3" align="center" width="100%" height="40">
                                <tr> 
                                  <td width="40"> 
                                    <table border="0" cellspacing="1" cellpadding="2" bgcolor="#<?php echo $color5 ?>">
                                      <tr> 
                                        <td bgcolor="#FFFFFF" align="center"> 
                                          <a href="galleryphoto.php?id=<?php echo $pid ?>" class="photos"><img src="images/start.gif" border="0"></a></td>
                                      </tr>
                                    </table>
                                  </td>
                                  <td> 
                                    <?php if ( $start!=='1' )    {?>
                                    <table border="0" cellspacing="1" cellpadding="2" bgcolor="#<?php echo $color5 ?>">
                                      <tr> 
                                        <td bgcolor="#FFFFFF" align="center"> 
                                          <a href="javascript:history.go(-1);" class="photos"><img src="images/prev.gif" border="0"></a></td>
                                      </tr>
                                    </table>
                                    <?php } ?>
                                  </td>
                                </tr>
                              </table>
                              <?php }else{ ?>
                              <table border="0" cellspacing="0" cellpadding="3" align="center" width="100%" height="40">
                                <tr> 
                                  <td width="40"> 
                                    <table border="0" cellspacing="1" cellpadding="2" bgcolor="#<?php echo $color5 ?>">
                                      <tr> 
                                        <td bgcolor="#FFFFFF" align="center"> 
                                          <a href="galleryphoto.php?id=<?php echo $pid ?>" class="photos"><img src="images/start.gif" border="0"></a></td>
                                      </tr>
                                    </table>
                                  </td>
                                  <td> 
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td> 
                                          <?php if ( $start!=='1' )    {?>
                                          <table border="0" cellspacing="1" cellpadding="2" bgcolor="#<?php echo $color5 ?>">
                                            <tr> 
                                              <td bgcolor="#FFFFFF" align="center"> 
                                                <a href="javascript:history.go(-1);" class="photos"><img src="images/prev.gif" border="0"></a></td>
                                            </tr>
                                          </table>
                                          <?php } ?>
                                        </td>
                                        <td align="right"> 
                                          <table border="0" cellspacing="1" cellpadding="2" bgcolor="#<?php echo $color5 ?>">
                                            <tr> 
                                              <td bgcolor="#FFFFFF" align="center"> 
                                                <a href="galleryphoto.php?id=<?php echo $photoid2 ?>" class="photos"><img src="images/next.gif" border="0"></a></td>
                                            </tr>
                                          </table>
                                        </td>
                                      </tr>
                                    </table>
                                  </td>
                                </tr>
                              </table>
                              <?php } ?>
                            </td>
                          </tr>
                          <tr> 
                            <td height="20"> 
                              <div align="center"><a href="javascript:window.close();" class="link">close</a></div>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
          <td width="620"> 
            <table width="100%" border="0" cellspacing="2" cellpadding="6" class="text" bgcolor="#<?php echo $color5 ?>" height="100%">
                <tr> 
                  
                <td bgcolor="#FFFFFF" align="center"><img src="photos2/<?php echo $photoid ?>.jpg"></td>
                </tr>
              </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
