<?
session_start();
include_once "functions.inc.php";

$cek_gallery = read_db('files/gallery.txt',1,99);
if (count($cek_gallery) < 1 ) {redirect('gallery_admin.php',0.1); $_SESSION['note'] = "Anda belum memiliki gallery. Silahkan diisi dahulu"; die();}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style_gallery.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<script>

<!--

active1 = new Image(26,26);
 active1.src = "but1b.jpg";
 inactive1 = new Image(26,26);
 inactive1.src = "but1a.jpg";

active2 = new Image(26,26);
 active2.src = "but2b.jpg";
 inactive2 = new Image(26,26);
 inactive2.src = "but2a.jpg";

active3 = new Image(26,26);
 active3.src = "but3b.jpg";
 inactive3 = new Image(26,26);
 inactive3.src = "but3a.jpg";
 
active4 = new Image(26,26);
 active4.src = "but4b.jpg";
 inactive4 = new Image(26,26);
 inactive4.src = "but4a.jpg";

active5 = new Image(26,26);
 active5.src = "but5b.jpg";
 inactive5 = new Image(26,26);
 inactive5.src = "but5a.jpg";
 
active6 = new Image(26,26);
 active6.src = "but6b.jpg";
 inactive6 = new Image(26,26);
 inactive6.src = "but6a.jpg";


//-->

</script>
</head>
<body>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0"  bordercolor="#111111" width="780" id="AutoNumber1" height="100%">
    <tr>
        <td width="100%" height="243" valign="top"><img src="top.jpg" width="900" height="234"></td>
    </tr>
    <tr>
        <td width="100%" bgcolor="#000000" valign="top">
<table border="0" cellpadding="0" cellspacing="0"  bordercolor="#111111" width="100%" height="100%">
        <tr>
              <td align="center" valign="top" bgcolor="#000000"> 
                <table width="98%" border="0">
                  <tr>
                    <td>
                      <table width="100%" border="0">
                        <tr> 
                          <td width="59%" height="21"> 
                            <div align="left"><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><a href="Index.htm"><font color="#FFFFFF" size="2"><b><font size="3">Home</font></b></font></a></span></font><font color="#FF0000" size="4"><b> 
                              | </b></font><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><a href="clinic.htm"><font color="#FFFFFF" size="2"><b><font size="3">Photography 
                              Clinic</font></b></font></a></span></font><font color="#FF0000" size="4"><b> 
                              | </b></font><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><a href="gallery.php"><font color="#FFFFFF" size="2"><b><font size="3">Gallery 
                              Photo</font></b></font></a></span></font><font color="#FF0000" size="4"><b><font face="Arial" size="2" color="#FFFFFF"> 
                              </font>| </b></font><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><font color="#FFFFFF" size="2"><b><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><a href="Biography.htm"><font color="#FFFFFF" size="2"><b><font size="3">Biography</font></b></font></a></span></font></b></font> 
                              </span></font><font color="#FF0000" size="4"><b><font face="Arial" size="2" color="#FFFFFF"> 
                              </font>| </b></font><font face="Arial" size="1" color="#FFFFFF"><span lang="sk"><a href="ContactMe.htm"><font color="#FFFFFF" size="2"><b><font size="3">Contact 
                              Me</font></b></font></a></span></font></div>
                          </td>
                          <td width="40%" background="ac568.gif" height="21"> 
                            <div align="right"> </div>
                          </td>
                          <td width="1%" height="21">&nbsp;</td>
                        </tr>
                      </table>
                    </td>
                  </tr>
                </table>
                <table width="98%" border="0">
                  <tr>
                    <td>
                      <div align="right"> 
                        <? if ($_SESSION['username'] != '') {?>
                        [<a href="logout.php">x</a>] logout 
                        <? }?>
                      </div>
                    </td>
                  </tr>
                </table>
                <table width="98%" border="0">
                  <tr>
                    <td bgcolor="#CC3300"><font color="#FF0000"><b><font size="4" color="#FFFFFF">Gallery Photo</font></b></font></td>
                  </tr>
                  <tr>
                    <td align="left" valign="top">
<?
$row_kategori = read_db('files/kategori.txt',1,99);
foreach ($row_kategori as $column_kategori) {
?>
 <table width="100%"  border="0" cellspacing="0" cellpadding="6">
   <tr>
     <td align="right" valign="top"><span class="besar"><?=$column_kategori[1]?><? if ($_SESSION['username'] != '') {?>[<a href="gallery_kategori.php?q=edit&id=<?=$column_kategori[0]?>">+</a>]<? }?></span></td>
   </tr>
   <tr>
     <td align="left" valign="top">
[<a href="gallery_admin.php?q=add&kategori=<?=$column_kategori[1]?>">+</a>]Tambah gallery
<ul id="style_gallery">
<?
$row_gallery = read_db('files/gallery.txt',1,99999999);

$i = 0;
foreach ($row_gallery as $column_gallery) {
	if ($column_gallery[2] == trim($column_kategori[1])) {
$i++;
?>
   <li><a href='gallery_detil.php?id=<?=$column_gallery[0]?>','winpopup','scrollbars=yes,resizable=yes,width=999,height=999')"><img src="files/thumb/<?=$column_gallery[4]?>" width="200" border="0"></a><br>
     <?=$column_gallery[3]?><? if ($_SESSION['username'] != '') {?>[<a href="gallery_admin.php?q=edit&id=<?=$column_gallery[0]?>">+</a>]<? }?></li>
<? 
	if ($i >= 4) {break;}
	}
}
?>
 </ul>	 </td>
   </tr>
   <tr>
     <td align="right" valign="top"><a href="gallery_list.php?kategori=<?=trim($column_kategori[1])?>">NEXT</a></td>
   </tr>
</table>
<br />
<div style="border-color:#CC3300; border-bottom-style:dotted; border-width:medium; "></div>
<br />
<? }?>
					</td>
                  </tr>
                </table>
                <p>&nbsp;</p></td>
            </tr>
      </table>
        </td>
    </tr>
    <tr>
        <td width="100%" bgcolor="#CC3300" height="20" style="border-left-width: 1; border-right-width: 1; border-top: 1px solid #606060; border-bottom-width: 1"> 
          <p align="center"><font size="1" face="Arial" color="#FFFFFF">Copyright 
            © 2012 </font> 
        </td>
    </tr>
  </table>
  </center>
</div>

<!-- script by www.tetuku.com -->
</body>
</html>
<?
$note = $_SESSION['note'] ; 
if ($note != '') {
?>
<script type="text/javascript"> 
<!-----hide from old browsers 
alert('<?php echo $note ;?>'); 
//---------> 
</script> 
<? 
} 
$_SESSION['note'] = ''; $note = '';
?>