<h1>YANZ UPLOAD ANJG</h1>
	<!-- Add jQuery library -->
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

	<!-- Add mousewheel plugin (this is optional) -->
	<script type="text/javascript" src="js/lib/jquery.mousewheel-3.0.6.pack.js"></script>

	<!-- Add fancyBox main JS and CSS files -->
	<script type="text/javascript" src="js/source/jquery.fancybox.js"></script>
	<link rel="stylesheet" type="text/css" href="/js/source/jquery.fancybox.css" media="screen" />

	<!-- Add Button helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="js/source/helpers/jquery.fancybox-buttons.css?v=2.0.3" />
	<script type="text/javascript" src="js/source/helpers/jquery.fancybox-buttons.js?v=2.0.3"></script>

	<!-- Add Thumbnail helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="js/source/helpers/jquery.fancybox-thumbs.css?v=2.0.3" />
	<script type="text/javascript" src="js/source/helpers/jquery.fancybox-thumbs.js?v=2.0.3"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			/*
				Simple image gallery. Use default settings
			*/

			$('.fancybox').fancybox();

			/*
				Different effects
			*/

			// Change title type, overlay opening speed and opacity
			$(".fancybox-effects-a").fancybox({
				helpers: {
					title : {
						type : 'outside'
					},
					overlay : {
						speedIn : 500,
						opacity : 0.95
					}
				}
			});

			// Disable opening and closing animations, change title type
			$(".fancybox-effects-b").fancybox({
				openEffect  : 'none',
				closeEffect	: 'none',

				helpers : {
					title : {
						type : 'over'
					}
				}
			});

			// Set custom style, close if clicked, change title type and overlay color
			$(".fancybox-effects-c").fancybox({
				wrapCSS    : 'fancybox-custom',
				closeClick : true,

				helpers : {
					title : {
						type : 'inside'
					},
					overlay : {
						css : {
							'background-color' : '#eee'	
						}
					}
				}
			});

			// Remove padding, set opening and closing animations, close if clicked and disable overlay
			$(".fancybox-effects-d").fancybox({
				padding: 0,

				openEffect : 'elastic',
				openSpeed  : 150,

				closeEffect : 'elastic',
				closeSpeed  : 150,

				closeClick : true,

				helpers : {
					overlay : null
				}
			});

			/*
				Button helper. Disable animations, hide close button, change title type and content
			*/

			$('.fancybox-buttons').fancybox({
				openEffect  : 'none',
				closeEffect : 'none',

				prevEffect : 'none',
				nextEffect : 'none',

				closeBtn  : false,

				helpers : {
					title : {
						type : 'inside'
					},
					buttons	: {}
				},

				afterLoad : function() {
					this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
				}
			});


			/*
				Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
			*/

			$('.fancybox-thumbs').fancybox({
				prevEffect : 'none',
				nextEffect : 'none',

				closeBtn  : false,
				arrows    : false,
				nextClick : true,

				helpers : { 
					thumbs : {
						width  : 50,
						height : 50
					}
				}
			});

		});
	</script>
	<style type="text/css">
		.fancybox-custom .fancybox-outer {
			box-shadow: 0 0 50px #222;
		}
	</style>


<?php require_once('Connections/banco1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

//######### INICIO Paginação
	$numreg = 12; // Quantos registros por página vai ser mostrado
	if (!isset($_GET['pg'])) {
		$_GET['pg'] = 0;
	}
	$inicial = $_GET['pg'] * $numreg;
//######### FIM dados Paginação

$tt = $_GET['codigo'];

mysql_select_db($database_banco1, $banco1);
$query_sql = "SELECT * FROM fotos WHERE id_eventos = '$tt' ORDER BY Id DESC LIMIT $inicial, $numreg";
$sql = mysql_query($query_sql, $banco1) or die(mysql_error());
$row_sql = mysql_fetch_assoc($sql);
$totalRows_sql = mysql_num_rows($sql);

mysql_select_db($database_banco1, $banco1);
$query_sql_conta = "SELECT * FROM fotos WHERE id_eventos = '$tt'  ORDER BY Id DESC";
$sql_conta = mysql_query($query_sql_conta, $banco1) or die(mysql_error());
$row_sql_conta = mysql_fetch_assoc($sql_conta);
$totalRows_sql_conta = mysql_num_rows($sql_conta);

mysql_select_db($database_banco1, $banco1);
$query_rsGal = "SELECT * FROM eventos WHERE eventos.Id = '$tt'";
$rsGal = mysql_query($query_rsGal, $banco1) or die(mysql_error());
$row_rsGal = mysql_fetch_assoc($rsGal);
$totalRows_rsGal = mysql_num_rows($rsGal);

$quantreg = mysql_num_rows($sql_conta); // Quantidade de registros pra paginação
        
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="css/pagina2.css" rel="stylesheet" type="text/css" />
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><p class="style1"><span class="titulo">
      <?php echo $row_rsGal['evento']; ?>
</span><br /> 
Data: 
<?php echo date("d/m/Y", strtotime($row_rsGal["data"])); ?><br />
    Local: <?php echo $row_rsGal['fotografo']; ?></p>
    </td>
  </tr>
</table>


<?          
do {

?>


              
              
              <table width="230" border="0" cellpadding="5" cellspacing="0">
                <?
// Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: 
$total = $totalRows_sql ;
// Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: 
$colunas = "4"; 
// Agora vamos ao "truque": 
if ($total>0) { 
for ($i = 0; $i < $total; $i++) { 
if (($i%$colunas)==0) { 
?>
                <tr>
                  <? }?>
                  <td align="left" valign="top" width="33%" onMouseOver="javascript:this.style.backgroundColor='#29211E'" onMouseOut="javascript:this.style.backgroundColor=''">
                  
                  
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>
                      <a class="fancybox" href="/up/<?php echo $row_sql['imagem']; ?>" data-fancybox-group="gallery" title="<?php echo $row_sql['comentario']; ?>" width="500">
                      <img src="up/<?php echo $row_sql['imagem']; ?>" width="230" border="0" />                      </a>                      </td>
                    </tr>
                    <tr>
                      <td><?php echo $row_sql['comentario']; ?></td>
                    </tr>
                    </table>
                  </td>
                  <? $row_sql = mysql_fetch_assoc($sql); ?>
                  <? }}?>
                </tr>
    </table>
              








<? } while ($row_sql = mysql_fetch_assoc($sql));

        
        echo "<br><br>"; // Vai servir só para dar uma linha de espaço entre a paginação e o conteúdo

        include("paginacao.php"); // Chama o arquivo que monta a paginação. ex: << anterior 1 2 3 4 5 próximo >>

mysql_free_result($sql);

mysql_free_result($sql_conta);
?>
<?php
mysql