var galeria_grupo = new Array();
var galeria_historia = new Array();
var galeria_produto = new Array();	
var menu_seleccionado = '';
var menu_grupo_seleccionado = 's_grupo';
var congelados_seleccionado = 0;
var marca_seleccionada = 1;

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function abre_home(){	
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	menu_seleccionado = '';
	
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/home.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function abre_separador_marcas(){
	$('#separador_marcas').stop().animate({marginLeft: '0px'}, function(){
		$('#img_sep_marcas').attr('src', 'img/marcas_roll.jpg');
		$('#img_sep_marcas').click(function(){
			fecha_separador_marcas();
		});	
	});
}

function fecha_separador_marcas(){	
	$('#sep_marcas_1').attr('src', 'img/logo_boutique.jpg');
	$('#sep_marcas_1').mouseover(function(){
		$(this).attr('src', 'img/logo_boutique_roll.jpg');
	});
	$('#sep_marcas_1').mouseout(function(){
		$(this).attr('src', 'img/logo_boutique.jpg');
	});
	
	$('#sep_marcas_2').attr('src', 'img/logo_marisco.jpg');
	$('#sep_marcas_2').mouseover(function(){
		$(this).attr('src', 'img/logo_marisco_roll.jpg');
	});
	$('#sep_marcas_2').mouseout(function(){
		$(this).attr('src', 'img/logo_marisco.jpg');
	});
	
	$('#sep_marcas_3').attr('src', 'img/logo_baleal.jpg');
	$('#sep_marcas_3').mouseover(function(){
		$(this).attr('src', 'img/logo_baleal_roll.jpg');
	});
	$('#sep_marcas_3').mouseout(function(){
		$(this).attr('src', 'img/logo_baleal.jpg');
	});				
	
	$('#separador_marcas').stop().animate({marginLeft: '-200px'}, function(){
		$('#img_sep_marcas').attr('src', 'img/marcas.jpg');
		$('#img_sep_marcas').click(function(){
			abre_separador_marcas();
		});	
	});
}

function selecciona_destaque(index){
	for(var i=1; i<=5; i++){
		if($('#span_destaque'+i).length)
			$('#span_destaque'+i).html('<img src="img/'+i+'.jpg" alt="" onmouseover="this.src=\'img/'+i+'_roll.jpg\';" onclick="this.blur();selecciona_destaque('+i+');" onmouseout="this.src=\'img/'+i+'.jpg\';" />');
	}
	$('#link_destaque'+index).click();
	$('#span_destaque'+index).html('<img src="img/'+index+'_roll.jpg" alt="" />');
	
}

function abre_destaque(tipo, id){
	fecha_separador_marcas();
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	
	switch(tipo){
		case 'loja': $('#menu_loja').html('<img src="img/loja_roll.png" alt="" />');	
					 menu_seleccionado = 'loja';						    	
				 	 $('#conteudo_box_c').fadeOut(function(){			
						$('#conteudo_box_c').text('');
						if (window.XMLHttpRequest) {
							xmlhttp = new XMLHttpRequest();
						}
						else {
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlhttp.onreadystatechange = function(){
							if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
								$('#conteudo_box_c').html(xmlhttp.responseText);	
							}
						}
						xmlhttp.open("GET", "includes/loja.php", true);
						xmlhttp.send();	
						$('#conteudo_box_c').fadeIn();
					 });
					 break;
					
		case 'social':  $('#menu_social').html('<img src="img/social_roll.png" alt="" />');
					    menu_seleccionado = 'social';		
						$('#conteudo_box_c').fadeOut(function(){			
							$('#conteudo_box_c').text('');
							if (window.XMLHttpRequest) {
								xmlhttp = new XMLHttpRequest();
							}
							else {
								xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
							}
							xmlhttp.onreadystatechange = function(){
								if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
									$('#conteudo_box_c').html(xmlhttp.responseText);
									var elemento = $('#soc'+id);
									abre_elemento_social(elemento);
								}
							}
							xmlhttp.open("GET", "includes/social_vazio.php", true);
							xmlhttp.send();	
							$('#conteudo_box_c').fadeIn();
						});
					break;
					
		case 'noticias': $('#menu_noticias').html('<img src="img/noticias_roll.png" alt="" />');
						menu_seleccionado = 'noticias';
							
						$('#conteudo_box_c').fadeOut(function(){			
							$('#conteudo_box_c').text('');
							if (window.XMLHttpRequest) {
								xmlhttp = new XMLHttpRequest();
							}
							else {
								xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
							}
							xmlhttp.onreadystatechange = function(){
								if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
									$('#conteudo_box_c').html(xmlhttp.responseText);	
									var elemento = $('#not'+id);
									abre_noticia(elemento);	
								}
							}
							xmlhttp.open("GET", "includes/noticias_vazio.php", true);
							xmlhttp.send();	
							$('#conteudo_box_c').fadeIn();
						});
						break;
					
		case 'idt': $('#menu_idt').html('<img src="img/idt_roll.png" alt="" />');
					menu_seleccionado = 'idt';
					$('#conteudo_box_c').fadeOut(function(){			
						$('#conteudo_box_c').text('');
						if (window.XMLHttpRequest) {
							xmlhttp = new XMLHttpRequest();
						}
						else {
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlhttp.onreadystatechange = function(){
							if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
								$('#conteudo_box_c').html(xmlhttp.responseText);
								var elemento = $('#idt'+id);
								abre_elemento_idt(elemento);	
							}
						}
						xmlhttp.open("GET", "includes/idt_vazio.php", true);
						xmlhttp.send();	
						$('#conteudo_box_c').fadeIn();
					});
					break;
	}
}

function abre_grupo_profresco(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/grupo_roll.png" alt="" />');
	menu_seleccionado = 'grupo';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
				$('#grupo_profresco_content .texto').jScrollPane();
				resizeScroll('#grupo_profresco_content .texto');
			}
		}
		xmlhttp.open("GET", "includes/grupo_profresco.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function resizeScroll(div){
    var h_full= $(div).outerHeight(/*true*/);  // Returns the width + padding + borders **** true - com as margins
    var h_wind= $(div).parent().height();
    var h_perc= h_wind*100;
    h_perc= h_perc/h_full;
    var h_scroll = h_perc*h_wind;
    h_scroll= h_scroll/100;  
    $(div).next().next().children(":first").height(parseInt(h_scroll));                                                                                          
}


function change_gal_grupo(index){
	$('#bigpic_galeria_grupo').attr('src', galeria_grupo[index]);
}

function abre_grupo(elemento){	
	fecha_separador_marcas();
	
	if(menu_grupo_seleccionado!='')
		$('#menu_grupo_'+menu_grupo_seleccionado).html('<img src="img/'+menu_grupo_seleccionado+'.jpg" alt="" onmouseover="this.src=\'img/'+menu_grupo_seleccionado+'_roll.jpg\';" onmouseout="this.src=\'img/'+menu_grupo_seleccionado+'.jpg\';" />');
	elemento.html('<img src="img/s_grupo_roll.jpg" alt="" />');
	menu_grupo_seleccionado = 's_grupo';
	
	$('#grupo_profresco_content').fadeOut(function(){	
		$('#grupo_profresco_content').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#grupo_profresco_content').html(xmlhttp.responseText);	
				$('#texto_grupo').jScrollPane();
				resizeScroll('#texto_grupo');
			}
		}
		xmlhttp.open("GET", "includes/grupo.php", true);
		xmlhttp.send();	
		$('#grupo_profresco_content').fadeIn();
	});
}

function abre_historia(elemento){	
	fecha_separador_marcas();
	
	if(menu_grupo_seleccionado!='')
		$('#menu_grupo_'+menu_grupo_seleccionado).html('<img src="img/'+menu_grupo_seleccionado+'.jpg" alt="" onmouseover="this.src=\'img/'+menu_grupo_seleccionado+'_roll.jpg\';" onmouseout="this.src=\'img/'+menu_grupo_seleccionado+'.jpg\';" />');
	elemento.html('<img src="img/s_historia_roll.jpg" alt="" />');
	menu_grupo_seleccionado = 's_historia';
	
	$('#grupo_profresco_content').fadeOut(function(){			
		$('#grupo_profresco_content').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#grupo_profresco_content').html(xmlhttp.responseText);	
				$('#texto_historia').jScrollPane();
				resizeScroll('#texto_historia');
			}
		}
		xmlhttp.open("GET", "includes/historia.php", true);
		xmlhttp.send();	
		$('#grupo_profresco_content').fadeIn();
	});
}

function change_gal_historia(index){
	$('#bigpic_galeria_historia').attr('src', galeria_historia[index]);
}

function abre_marcas(elemento){	
	fecha_separador_marcas();
	
	if(menu_grupo_seleccionado!='')
		$('#menu_grupo_'+menu_grupo_seleccionado).html('<img src="img/'+menu_grupo_seleccionado+'.jpg" alt="" onmouseover="this.src=\'img/'+menu_grupo_seleccionado+'_roll.jpg\';" onmouseout="this.src=\'img/'+menu_grupo_seleccionado+'.jpg\';" />');
	elemento.html('<img src="img/s_marcas_roll.jpg" alt="" />');
	menu_grupo_seleccionado = 's_marcas';
	
	
	$('#grupo_profresco_content').fadeOut(function(){	
		$('#grupo_profresco_content').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#grupo_profresco_content').html(xmlhttp.responseText);	
				//$('#grupo_profresco_content .texto').jScrollPane();
			}
		}
		xmlhttp.open("GET", "includes/marcas.php", true);
		xmlhttp.send();
		$('#grupo_profresco_content').fadeIn();
	});
}

function abre_marca(num){
	fecha_separador_marcas();
	marca_seleccionada = num;
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	$('#menu_grupo').html('<img src="img/grupo_roll.png" alt="" />');
	menu_seleccionado = 'grupo';
	menu_grupo_seleccionado = 's_marcas';
	
	$('#sep_marcas_1').attr('src', 'img/logo_boutique.jpg');
	$('#sep_marcas_1').mouseover(function(){
		$(this).attr('src', 'img/logo_boutique_roll.jpg');
	});
	$('#sep_marcas_1').mouseout(function(){
		$(this).attr('src', 'img/logo_boutique.jpg');
	});
	
	$('#sep_marcas_2').attr('src', 'img/logo_marisco.jpg');
	$('#sep_marcas_2').mouseover(function(){
		$(this).attr('src', 'img/logo_marisco_roll.jpg');
	});
	$('#sep_marcas_2').mouseout(function(){
		$(this).attr('src', 'img/logo_marisco.jpg');
	});
	
	$('#sep_marcas_3').attr('src', 'img/logo_baleal.jpg');
	$('#sep_marcas_3').mouseover(function(){
		$(this).attr('src', 'img/logo_baleal_roll.jpg');
	});
	$('#sep_marcas_3').mouseout(function(){
		$(this).attr('src', 'img/logo_baleal.jpg');
	});					
	
	switch(num){
		case 1: $('#sep_marcas_1').attr('src', 'img/logo_boutique_roll.jpg');
				$('#sep_marcas_1').unbind('mouseover');
				$('#sep_marcas_1').unbind('mouseout');
				break;
		case 2: $('#sep_marcas_2').attr('src', 'img/logo_marisco_roll.jpg');
				$('#sep_marcas_2').unbind('mouseover');
				$('#sep_marcas_2').unbind('mouseout');
				break;
		case 3: $('#sep_marcas_3').attr('src', 'img/logo_baleal_roll.jpg');
				$('#sep_marcas_3').unbind('mouseover');
				$('#sep_marcas_3').unbind('mouseout');
				break;
	}	
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp1 = new XMLHttpRequest();
		}
		else {
			xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp1.onreadystatechange = function(){
			if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200) {
				$('#conteudo_box_c').html(xmlhttp1.responseText);	
			}
		}
		xmlhttp1.open("GET", "includes/marca.php?num="+num, true);
		xmlhttp1.send();
		$('#conteudo_box_c').fadeIn();
	});	
}

function over_marcas(tipo, elemento){		
	switch(tipo){
		case 1: elemento.attr('src', 'img/boutique_roll.jpg');
				break;
				
		case 2: elemento.attr('src', 'img/marisco_roll.jpg');
				break;
				
		case 3: elemento.attr('src', 'img/baleal_roll.jpg');
				break;
	}	
}

function muda_marca(tipo){		
	$('#separador_boutique').bind({
			mouseover: function() {
	   			over_marcas(1, $(this));
	  	},
	 		mouseout: function() {
	 			$(this).attr('src', 'img/boutique.jpg');
		}
	});
	
	$('#separador_marisco').bind({
			mouseover: function() {
	   			over_marcas(2, $(this));
	  	},
	 		mouseout: function() {
	 			$(this).attr('src', 'img/marisco.jpg');
		}
	});
	
	$('#separador_baleal').bind({
			mouseover: function() {
	   			over_marcas(3, $(this));
	  	},
	 		mouseout: function() {
	 			$(this).attr('src', 'img/baleal.jpg');
		}
	});
				
	switch(marca_seleccionada){
		case 1: $('#separador_boutique').attr('src', 'img/boutique.jpg');	
				break;
		case 2: $('#separador_marisco').attr('src', 'img/marisco.jpg');	
				break;
		case 3: $('#separador_baleal').attr('src', 'img/baleal.jpg');	
				break;
	}
	
	marca_seleccionada = tipo;
		
	switch(tipo){
		case 1: $('#boutique_box').css('display', 'block');
				$('#marisco_box').css('display', 'none');
				$('#baleal_box').css('display', 'none');
				$('#imagem_marcas').attr('src', 'img/boutique_topo.jpg');
				
				$('#separador_boutique').attr('src', 'img/boutique_roll.jpg');				
				$('#separador_boutique').unbind('mouseover');
				$('#separador_boutique').unbind('mouseout');
				break;
				
		case 2: $('#boutique_box').css('display', 'none');
				$('#marisco_box').css('display', 'block');
				$('#baleal_box').css('display', 'none');				
				$('#imagem_marcas').attr('src', 'img/marisco_topo.jpg');
				
				$('#separador_marisco').attr('src', 'img/marisco_roll.jpg');				
				$('#separador_marisco').unbind('mouseover');
				$('#separador_marisco').unbind('mouseout');
				break;
				
		case 3: $('#boutique_box').css('display', 'none');
				$('#marisco_box').css('display', 'none');
				$('#baleal_box').css('display', 'block');
				$('#imagem_marcas').attr('src', 'img/baleal_topo.jpg');
				
				$('#separador_baleal').attr('src', 'img/baleal_roll.jpg');				
				$('#separador_baleal').unbind('mouseover');
				$('#separador_baleal').unbind('mouseout');
				break;
	}
}

function abre_certificacao(elemento){	
	fecha_separador_marcas();
	
	if(menu_grupo_seleccionado!='')
		$('#menu_grupo_'+menu_grupo_seleccionado).html('<img src="img/'+menu_grupo_seleccionado+'.jpg" alt="" onmouseover="this.src=\'img/'+menu_grupo_seleccionado+'_roll.jpg\';" onmouseout="this.src=\'img/'+menu_grupo_seleccionado+'.jpg\';" />');
	elemento.html('<img src="img/s_certificacao_roll.jpg" alt="" />');
	menu_grupo_seleccionado = 's_certificacao';
	
	$('#grupo_profresco_content').fadeOut(function(){			
		$('#grupo_profresco_content').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#grupo_profresco_content').html(xmlhttp.responseText);	
				$('#grupo_profresco_content .texto').jScrollPane();
			}
		}
		xmlhttp.open("GET", "includes/certificacao.php", true);
		xmlhttp.send();	
		$('#grupo_profresco_content').fadeIn();
	});
}

function over_certificacao(elemento){
	elemento.removeClass().addClass('certificacao_selected');
	elemento.find('.img_mais').attr('src', 'img/mais_certificado_roll.jpg');
}
function out_certificacao(elemento){
	elemento.removeClass().addClass('certificacao');
	elemento.find('.img_mais').attr('src', 'img/mais_certificado.jpg');
}

function abre_elemento_certificacao(elemento){
	$('.certificacao_selected').mouseout(function() {
		out_certificacao($(this));
	});
	
	$('.certificacao_selected').mouseover(function() {
		over_certificacao($(this));
	});
	
	$('.certificacao_selected').click(function() {
		abre_elemento_certificacao($(this));
	});
	$('.certificacao_selected').find('.img_mais').attr('src', 'img/mais_certificado.jpg');
	$('.certificacao_selected').removeClass().addClass('certificacao');
	
	elemento.removeClass().addClass('certificacao_selected');
	elemento.find('.img_mais').attr('src', 'img/mais_certificado_roll.jpg');
	elemento.unbind();
	
	var id = elemento.attr('id');
	id = id.replace('cert', '');
	$('#certificacao_box').fadeOut(function(){			
		$('#certificacao_box').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#certificacao_box').html(xmlhttp.responseText);
				$('#certificacao_box').fadeIn(function(){					
					$('#texto_certificacao').jScrollPane();	
					$('.jqzoom').jqzoom({
			            zoomType: 'innerzoom',
			            preloadImages: false,
			            alwaysOn:false
			        });   
				});
			}
		}
		xmlhttp.open("GET", "includes/elemento_certificacao.php?id="+id, true);
		xmlhttp.send();	
	});
}

function muda_pdf(pdf, pdf_m){
	$('#cert_zoom .clearfix').html('<a href="'+pdf+'" class="jqzoom">'+
	            '<img src="'+pdf_m+'" alt="" />'+
	        '</a>');
	        
	$('.jqzoom').jqzoom({
        zoomType: 'innerzoom',
        preloadImages: false,
        alwaysOn:false
    });   
}

function abre_futuro(elemento){	
	fecha_separador_marcas();
	
	if(menu_grupo_seleccionado!='')
		$('#menu_grupo_'+menu_grupo_seleccionado).html('<img src="img/'+menu_grupo_seleccionado+'.jpg" alt="" onmouseover="this.src=\'img/'+menu_grupo_seleccionado+'_roll.jpg\';" onmouseout="this.src=\'img/'+menu_grupo_seleccionado+'.jpg\';" />');
	elemento.html('<img src="img/s_futuro_roll.jpg" alt="" />');
	menu_grupo_seleccionado = 's_futuro';
	
	$('#grupo_profresco_content').fadeOut(function(){			
		$('#grupo_profresco_content').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#grupo_profresco_content').html(xmlhttp.responseText);	
				$('#grupo_profresco_content .texto').jScrollPane();
			}
		}
		xmlhttp.open("GET", "includes/futuro.php", true);
		xmlhttp.send();	
		$('#grupo_profresco_content').fadeIn();
	});
}

function abre_produtos(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/produtos_roll.png" alt="" />');
	menu_seleccionado = 'produtos';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/produtos.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function over_produto(elemento){
	elemento.find('.sombra_prod').css('display', 'block');
	elemento.find('.nome').css('color', '#00adef');
	elemento.find('.preco').css('color', '#8c8986');
	elemento.find('.seta').attr('src', 'img/seta_produtos_roll.jpg');
}

function out_produto(elemento){
	elemento.find('.sombra_prod').css('display', 'none');
	elemento.find('.nome').css('color', '#9f9d9a');
	elemento.find('.preco').css('color', '#c5c4c2');
	elemento.find('.seta').attr('src', 'img/seta_produtos.jpg');
}

function muda_produto(elemento, tipo){	
	$('.produto_selected .sombra_prod').css('display', 'none');
	$('.produto_selected .nome').css('color', '#9f9d9a');
	$('.produto_selected .preco').css('color', '#c5c4c2');
	$('.produto_selected .seta').attr('src', 'img/seta_produtos.jpg');
	$('.produto_selected').addClass('produto').removeClass('produto_selected');
				
	$('.produto').mouseout(function() {
		out_produto($(this));
	});
	$('.produto').mouseover(function() {
		over_produto($(this));
	});
	$('.produto').click(function() {
		muda_produto($(this), tipo);
	});
	
	over_produto(elemento);
	elemento.unbind('mouseover');
	elemento.unbind('mouseout');
	elemento.addClass('produto_selected').removeClass('produto');
	
	var id = elemento.attr('id');
	id = id.replace('prod', '');
	$('#produto_box').fadeOut(function(){			
		$('#produto_box').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#produto_box').html(xmlhttp.responseText);	
				$('#produto_box').fadeIn();
			}
		}
		xmlhttp.open("GET", "includes/produto.php?id="+id+"&tipo="+tipo, true);
		xmlhttp.send();	
	});
}

function mostra_congelados(){
	$('#menus_congelados').css('visibility', 'visible');
	$('#img_congelados').attr('src', 'img/congelados_roll.jpg');	
}
function esconde_congelados(){
	if(congelados_seleccionado==0){
		$('#menus_congelados').css('visibility', 'hidden');
		$('#img_congelados').attr('src', 'img/congelados.jpg');
	}
}

function abre_frescos(){	
	fecha_separador_marcas();
	
	$('#link_frescos').html('<img src="img/frescos_roll.jpg" alt="" />');	
	
	$('#menus_congelados').html('<a onclick="abre_peixes();" class="submenu_produtos"><img src="img/peixes_mariscos.jpg" alt="" onmouseover="this.src=\'img/peixes_mariscos_roll.jpg\';" onmouseout="this.src=\'img/peixes_mariscos.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_cozinhados();" class="submenu_produtos"><img src="img/pre_cozinhados.jpg" alt="" onmouseover="this.src=\'img/pre_cozinhados_roll.jpg\';" onmouseout="this.src=\'img/pre_cozinhados.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_legumes();" class="submenu_produtos"><img src="img/legumes.jpg" alt="" onmouseover="this.src=\'img/legumes_roll.jpg\';" onmouseout="this.src=\'img/legumes.jpg\';" /></a>');
	congelados_seleccionado=0;
	esconde_congelados();
	
	$('#conteudo_produtos').fadeOut(function(){			
		$('#conteudo_produtos').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_produtos').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/frescos.php", true);
		xmlhttp.send();	
		$('#conteudo_produtos').fadeIn();
	});
}

function abre_peixes(){	
	fecha_separador_marcas();
	
	$('#link_frescos').html('<img src="img/frescos.jpg" alt="" onmouseover="this.src=\'img/frescos_roll.jpg\';" onmouseout="this.src=\'img/frescos.jpg\';" />');
	$('#link_congelados').html('<img src="img/congelados_roll.jpg" alt="" />');
	congelados_seleccionado = 1;
	
	$('#menus_congelados').html('<a onclick="abre_peixes();" class="submenu_produtos"><img src="img/peixes_mariscos_roll.jpg" alt="" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_cozinhados();" class="submenu_produtos"><img src="img/pre_cozinhados.jpg" alt="" onmouseover="this.src=\'img/pre_cozinhados_roll.jpg\';" onmouseout="this.src=\'img/pre_cozinhados.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_legumes();" class="submenu_produtos"><img src="img/legumes.jpg" alt="" onmouseover="this.src=\'img/legumes_roll.jpg\';" onmouseout="this.src=\'img/legumes.jpg\';" /></a>');
	
	$('#conteudo_produtos').fadeOut(function(){			
		$('#conteudo_produtos').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_produtos').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/peixes.php", true);
		xmlhttp.send();	
		$('#conteudo_produtos').fadeIn();
	});
}

function abre_cozinhados(){	
	fecha_separador_marcas();
	
	$('#link_frescos').html('<img src="img/frescos.jpg" alt="" onmouseover="this.src=\'img/frescos_roll.jpg\';" onmouseout="this.src=\'img/frescos.jpg\';" />');
	$('#link_congelados').html('<img src="img/congelados_roll.jpg" alt="" />');
	congelados_seleccionado = 1;
	
	$('#menus_congelados').html('<a onclick="abre_peixes();" class="submenu_produtos"><img src="img/peixes_mariscos.jpg" alt="" onmouseover="this.src=\'img/peixes_mariscos_roll.jpg\';" onmouseout="this.src=\'img/peixes_mariscos.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_cozinhados();" class="submenu_produtos"><img src="img/pre_cozinhados_roll.jpg" alt="" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_legumes();" class="submenu_produtos"><img src="img/legumes.jpg" alt="" onmouseover="this.src=\'img/legumes_roll.jpg\';" onmouseout="this.src=\'img/legumes.jpg\';" /></a>');
	
	$('#conteudo_produtos').fadeOut(function(){			
		$('#conteudo_produtos').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_produtos').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/cozinhados.php", true);
		xmlhttp.send();	
		$('#conteudo_produtos').fadeIn();
	});
}

function abre_legumes(){	
	fecha_separador_marcas();
	
	$('#link_frescos').html('<img src="img/frescos.jpg" alt="" onmouseover="this.src=\'img/frescos_roll.jpg\';" onmouseout="this.src=\'img/frescos.jpg\';" />');
	$('#link_congelados').html('<img src="img/congelados_roll.jpg" alt="" />');
	congelados_seleccionado = 1;
	
	$('#menus_congelados').html('<a onclick="abre_peixes();" class="submenu_produtos"><img src="img/peixes_mariscos.jpg" alt="" onmouseover="this.src=\'img/peixes_mariscos_roll.jpg\';" onmouseout="this.src=\'img/peixes_mariscos.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_cozinhados();" class="submenu_produtos"><img src="img/pre_cozinhados.jpg" alt="" onmouseover="this.src=\'img/pre_cozinhados_roll.jpg\';" onmouseout="this.src=\'img/pre_cozinhados.jpg\';" /></a>&nbsp;&nbsp;'+
				'<a onclick="abre_legumes();" class="submenu_produtos"><img src="img/legumes_roll.jpg" alt="" /></a>');
	
	$('#conteudo_produtos').fadeOut(function(){			
		$('#conteudo_produtos').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_produtos').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/legumes.php", true);
		xmlhttp.send();	
		$('#conteudo_produtos').fadeIn();
	});
}


function abre_cartao(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/cartao_roll.png" alt="" />');
	menu_seleccionado = 'cartao';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/cartao.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function abre_contactos(sent){	
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	
	$('#menu_contactos').html('<img src="img/contactos_roll.png" alt="" />');
		
	menu_seleccionado = 'contactos';
	
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/contactos.php?sent="+sent, true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function abre_noticias(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/noticias_roll.png" alt="" />');
	menu_seleccionado = 'noticias';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/noticias.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function mostra_imagem_noticia(index){
	$('.img_not').css('display', 'none');
	$('#img_not'+index).css('display', 'block');
	
	$('.seta_not').each(function(){
		var indice = $(this).attr('id');
		indice = indice.replace('seta_not', '');
		
		$(this).html('<a onclick="mostra_imagem_noticia('+indice+');"><img src="img/seta_galeria_noticias.jpg" alt="" onmouseover="this.src=\'img/seta_galeria_noticias_roll.jpg\';" onmouseout="this.src=\'img/seta_galeria_noticias.jpg\';" /></a>');
	});
	
	$('#seta_not'+index).html('<img src="img/seta_galeria_noticias_roll.jpg" alt="" />');
}

function over_noticia(elemento){
	elemento.removeClass().addClass('noticia_selected');
	elemento.find('.sombra_img_not').css('display', 'none');
}
function out_noticia(elemento){
	elemento.removeClass().addClass('noticia');
	elemento.find('.sombra_img_not').css('display', 'block');
}

function abre_noticia(elemento){
	fecha_separador_marcas();
	
	$('.noticia_selected').mouseout(function() {
		out_noticia($(this));
	});
	
	$('.noticia_selected').mouseover(function() {
		over_noticia($(this));
	});
	
	$('.noticia_selected').click(function() {
		abre_noticia($(this));
	});
	$('.noticia_selected').removeClass().addClass('noticia');
	
	$('.sombra_img_not').css('display', 'block');
	elemento.find('.sombra_img_not').css('display', 'none');
	
	elemento.removeClass().addClass('noticia_selected');
	elemento.unbind();
	
	var id = elemento.attr('id');
	id = id.replace('not', '');
	$('#noticia_box').fadeOut(function(){			
		$('#noticia_box').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#noticia_box').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/noticia.php?id="+id, true);
		xmlhttp.send();	
		$('#noticia_box').fadeIn();
	});
}

function abre_social(elemento){	
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/social_roll.png" alt="" />');
	menu_seleccionado = 'social';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/social.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function muda_imagem_social(index){
	$('.img_soc').css('display', 'none');
	$('#img_soc'+index).css('display', 'block');	
}

function over_social(elemento){
	elemento.removeClass().addClass('social_selected');
	//elemento.find('.data img').attr('src', 'img/flor_social_roll.jpg');
}
function out_social(elemento){
	elemento.removeClass().addClass('social');
	//elemento.find('.data img').attr('src', 'img/flor_social.jpg');
}

function abre_elemento_social(elemento){
	fecha_separador_marcas();
	
	$('.social_selected').mouseout(function() {
		out_social($(this));
	});
	
	$('.social_selected').mouseover(function() {
		over_social($(this));
	});
	
	$('.social_selected').click(function() {
		abre_elemento_social($(this));
	});
	$('.social_selected').removeClass().addClass('social');
	
	elemento.removeClass().addClass('social_selected');
	
	elemento.unbind();
	
	var id = elemento.attr('id');
	id = id.replace('soc', '');
	$('#social_box').fadeOut(function(){			
		$('#social_box').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#social_box').html(xmlhttp.responseText);	
				$('#social_box').fadeIn();
			}
		}
		xmlhttp.open("GET", "includes/elemento_social.php?id="+id, true);
		xmlhttp.send();	
	});
}

function abre_idt(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/idt_roll.png" alt="" />');
	menu_seleccionado = 'idt';
		
	$('.idt_selected').mouseout(function() {
		out_idt($(this));
	});
	
	$('.idt_selected').mouseover(function() {
		over_idt($(this));
	});
	
	$('.idt_selected').click(function() {
		abre_elemento_idt($(this));
	});
	
	elemento.unbind();
	
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/idt.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function over_idt(elemento){
	elemento.removeClass().addClass('idt_selected');
}
function out_idt(elemento){
	elemento.removeClass().addClass('idt');
}

function abre_elemento_idt(elemento){
	fecha_separador_marcas();
	
	$('.idt_selected').mouseout(function() {
		out_idt($(this));
	});
	
	$('.idt_selected').mouseover(function() {
		over_idt($(this));
	});
	
	$('.idt_selected').click(function() {
		abre_elemento_idt($(this));
	});
	$('.idt_selected').removeClass().addClass('idt');
	
	elemento.removeClass().addClass('idt_selected');
	elemento.unbind();
	
	var id = elemento.attr('id');
	id = id.replace('idt', '');
	$('#idt_box').fadeOut(function(){			
		$('#idt_box').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#idt_box').html(xmlhttp.responseText);	
				$('#idt_box').fadeIn();
			}
		}
		xmlhttp.open("GET", "includes/elemento_idt.php?id="+id, true);
		xmlhttp.send();	
	});
}

function abre_loja(elemento){
	fecha_separador_marcas();
	
	if(menu_seleccionado!='')
		$('#menu_'+menu_seleccionado).html('<img src="img/'+menu_seleccionado+'.png" alt="" onmouseover="this.src=\'img/'+menu_seleccionado+'_roll.png\';" onmouseout="this.src=\'img/'+menu_seleccionado+'.png\';" />');
	elemento.html('<img src="img/loja_roll.png" alt="" />');
	menu_seleccionado = 'loja';
		
	$('#conteudo_box_c').fadeOut(function(){			
		$('#conteudo_box_c').text('');
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
		else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				$('#conteudo_box_c').html(xmlhttp.responseText);	
			}
		}
		xmlhttp.open("GET", "includes/loja.php", true);
		xmlhttp.send();	
		$('#conteudo_box_c').fadeIn();
	});
}

function change_img_loja(index){
	$('[id^=img_loja]').css('display', 'none');
	$('#img_loja'+index).css('display', 'block');
	
	$('[id^=legenda_loja]').css('display', 'none');
	$('#legenda_loja'+index).css('display', 'block');
}

function valida_cont(){
	var erros = 0;
	
	$('#aviso').css('color', '#b7b7b7');
    $('#nome').css('border', '1px solid #b7b7b7');
    $('#email').css('border', '1px solid #b7b7b7');
    $('#assunto').css('border', '1px solid #b7b7b7');
    $('#msg').css('border', '1px solid #b7b7b7');

    if ($('#nome').val() == '') {
        $('#nome').css('border', '1px solid #00adef');
        erros++;
    }
    if ($('#assunto').val() == '') {
        $('#assunto').css('border', '1px solid #00adef');
        erros++;
    }
    if ($('#email').val() == '' || !echeck($('#email').val())) {
        $('#email').css('border', '1px solid #00adef');
        erros++;
    }
    if ($('#msg').val() == '') {
        $('#msg').css('border', '1px solid #00adef');
        erros++;
    }
	
    if (erros > 0) {
    	$('#aviso').css('color', '#00adef');
        $('#aviso').html('* Por favor, preencha os campos assinalados corretamente.');
    }
    else {
        $('#form_cont').submit();
    }	
}

function validar_remover(){
	var erros = 0;
	
	$('#email').css('background', '#bbbdbf');
	
	if($('#email').val()=='' || !echeck($('#email').val())){
		$('#email').css('background', '#3FC8F4');
		erros++;
	}	
	
	if(erros > 0){
		$('#aviso_remover').html('* Por favor preencha o campo com um e-mail válido.');	
	}
	else
		$('#send_remover').submit();
}

function echeck(str){
    var at = "@"
    var dot = "."
    var lat = str.indexOf(at)
    var lstr = str.length
    var ldot = str.indexOf(dot)
    if (str.indexOf(at) == -1) {
        return false
    }
    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
        return false
    }
    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
        return false
    }
    if (str.indexOf(at, (lat + 1)) != -1) {
        return false
    }
    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
        return false
    }
    if (str.indexOf(dot, (lat + 2)) == -1) {
        return false
    }
    if (str.indexOf(" ") != -1) {
        return false
    }
    return true
}
