<?php require_once('Connections/conn_sustentabilidade.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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;
}
}

mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_lista_evento_destaque = "SELECT * FROM vw_tbeventos WHERE destaque_evento='Sim' ORDER BY nome_evento ASC";
$lista_evento_destaque = mysql_query($query_lista_evento_destaque, $conn_sustentabilidade) or die(mysql_error());
$row_lista_evento_destaque = mysql_fetch_assoc($lista_evento_destaque);

if (isset($_GET['totalRows_lista_evento_destaque'])) {
  $totalRows_lista_evento_destaque = $_GET['totalRows_lista_evento_destaque'];
} else {
  $all_lista_evento_destaque = mysql_query($query_lista_evento_destaque);
  $totalRows_lista_evento_destaque = mysql_num_rows($all_lista_evento_destaque);
}
?>
		<section class="main">
			
			<section class="container-fluid">
			  <section class="row">
			    <div id="carousel1" class="carousel slide" data-ride="carousel">
				    <ol class="carousel-indicators">
				      <li data-target="#carousel1" data-slide-to="0" class="active"></li>
					  <?php $i = 0; do {?>
				      <li data-target="#carousel1" data-slide-to="<?php echo $i+1;?>"></li>
					  <?php $i++; } while ($i < mysql_num_rows($lista_evento_destaque));?>
			      </ol>
				    <div class="carousel-inner" role="listbox">
				      <div class="item active"><img src="images/Carousel_Placeholder.png" alt="First slide image" class="center-block">
				        <div class="carousel-caption">
				          <h4>Os melhores eventos, multirões e outros!</h4>
			            </div>
			          </div>
					  <?php do {?>
				      <div class="item"><img src="imagens/<?php echo $row_lista_evento_destaque['imagem_evento'];?>" alt="Second slide image" class="center-block img-responsive">
				        <div class="carousel-caption">
				          <h2 class="hidden-xs"><?php echo $row_lista_evento_destaque['nome_evento'];?></h2>
				          <h4><a href="eventos_detalhe.php?id_evento=<?php echo $row_lista_evento_destaque['id_evento'];?>" class="link-branco">Veja mais!</a></h4>
			            </div>
			          </div>
					  <?php } while ($row_lista_evento_destaque = mysql_fetch_assoc($lista_evento_destaque));?>
			      </div>
				    <a class="left carousel-control" href="#carousel1" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span><span class="sr-only">Previous</span></a><a class="right carousel-control" href="#carousel1" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span><span class="sr-only">Next</span></a>
				  </div>
              </section>
			</section>
		</section>
<?php
mysql_free_result($lista_evento_destaque);
?>
