/*!
 *Surgiu.com JavaScript
 * http://surgiu.com/
 * http://surgiu.com.br;
 * Copyright 2011
 */
 /*                     MENU                         */
$(document).ready(function(){

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	
	$("ul.topnav li span").hover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('medium'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});


<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->


/*            DESTAQUES           */
//Função p/ n Aparecer erro de JS no navegador do Tiozinho
function semerro(){
return true;
}
window.onerror=semerro;

//POP UP

function AbreJanelaGaleria(URL) {
  var width = 881;
  var height = 510;
  var left = 50;
  var top = 10
  window.open(URL, 'ema3', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}
/* TABS  */
// When the document loads do everything inside here ...
	  $(document).ready(function(){
		
		// When a link is clicked
		$("a.tab").click(function () {
			
			
			// switch all tabs off
			$(".active").removeClass("active");
			
			// switch this tab on
			$(this).addClass("active");
			
			// slide all content up
			$(".content").slideUp();
			
			// slide this content up
			var content_show = $(this).attr("title");
			$("#"+content_show).slideDown();
		  
		});
	
	  });
/*LIGHTBOX*/

	/*LIGHTBOX*/

	jQuery(document).ready(function() {
    jQuery('.jcarousel-skin-tango').jcarousel();

});


//Forms --
/********************Newsletter******************/

function enviar_news(){

if(document.News.nome_news.value=="Nome")
{
alert( "Preencha campo nome corretamente!" );
document.News.nome_news.focus();
return false;
}
if( document.News.email_news.value=="E-mail" || document.News.email_news.value.indexOf('@')==-1 || document.News.email_news.value.indexOf('.')==-1 )
{
alert( "Preencha campo E-MAIL corretamente!" );
document.News.email_news.focus();
return false;
}
enviarForm('/midia/newsletter.php', 'newsletter'); 
	}
	
function enviar_promo(){

if(document.promo.p_nome.value=="Digite aqui seu nome!")
{
alert( "Preencha campo nome corretamente!" );
document.promo.p_nome.focus();
return false;
}
if(document.promo.p_fone.value=="Digite aqui seu telefone!")
{
alert( "Preencha campo nome corretamente!" );
document.promo.p_fone.focus();
return false;
}
if( document.promo.p_email.value=="Digite aqui seu e-mail!" || document.promo.p_email.value.indexOf('@')==-1 || document.promo.p_email.value.indexOf('.')==-1 )
{
alert( "Preencha campo E-MAIL corretamente!" );
document.promo.p_email.focus();
return false;
}
enviarPromo('/midia/promo.php', 'promo_participe'); 
	}
/********************Noticias******************/
function enviardados(){

if(document.dados.de.value=="Digite aqui seu nome!")
{
alert( "Preencha campo De corretamente!" );
document.dados.de.focus();
return false;
}
if( document.dados.email.value=="Digite aqui o destinatário!" || document.dados.email.value.indexOf('@')==-1 || document.dados.email.value.indexOf('.')==-1 )
{
alert( "Preencha campo E-MAIL corretamente!" );
document.dados.email.focus();
return false;
}
if (document.dados.mensagem.value=="Digite aqui sua mensagem!")
{
alert( "Preencha o campo MENSAGEM!" );
document.dados.mensagem.focus();
return false;
}
if (document.dados.mensagem.value.length > 500 )
{
alert( "É necessario preencher o campo MENSAGEM com menos de 500 caracteres!" );
document.dados.mensagem.focus();
return false;
}
return true;
}
/********************Contato******************/
function validate() {
if (document.contact.nome.value == "Digite aqui seu nome!")
{
   alert("Digite seu Nome!");
   document.contact.nome.focus();
   return false;
}
if (document.contact.email.value == "Digite aqui seu e-mail!" || document.contact.email.value.indexOf('@')==-1 || document.contact.email.value.indexOf('.')==-1)
{
   alert("Digite um E-mail valido!");
   document.contact.email.focus();
   return false;
}
if (document.contact.cidade.value == "Digite aqui sua cidade!")
{
   alert("Digite a Cidade onde você Mora!");
   document.contact.cidade.focus();
   return false;
}
if (document.contact.estado.value == "Estado")
{
   alert("Selecione o estado onde você Mora!");
   document.contact.estado.focus();
   return false;
}
if (document.contact.ddd.value == "DDD")
{
   alert("Digite seu DDD!");
   document.contact.ddd.focus();
   return false;
}
if (document.contact.telefone.value == "Digite aqui seu telefone!")
{
   alert("Digite seu Telefone!");
   document.contact.telefone.focus();
   return false;
}
if (document.contact.mensagem.value == "Digite aqui sua mensagem!")
{
   alert("Digite sua mensagem!");
   document.contact.mensagem.focus();
   return false;
}
return true;
}


function enviar_recado() {
if (document.recado_mural.de.value == "Digite aqui seu nome!")
{
   alert("Digite seu Nome!");
   document.recado_mural.de.focus();
   return false;
}
if (document.recado_mural.para.value == "Digite aqui o destinatário!")
{
   alert("Digite aqui o destinatário!");
   document.recado_mural.para.focus();
   return false;
}
if (document.recado_mural.email.value == "Digite aqui seu e-mail!" || document.recado_mural.email.value.indexOf('@')==-1 || document.recado_mural.email.value.indexOf('.')==-1)
{
   alert("Digite um E-mail valido!");
   document.recado_mural.email.focus();
   return false;
}
if (document.recado_mural.mensagem.value == "Digite aqui sua mensagem!")
{
   alert("Digite sua mensagem!");
   document.recado_mural.mensagem.focus();
   return false;
}
return true;
}

//forms
function close_pop_up(){
$(function(){
$("#popup")
.show()
.hide("slow");
    });
}
