divaberta = "";
<!--//proteção contra cópia
function selectnone() {    
document.body.ondrag = function () { return false; };    
document.body.onselectstart = function () { return false; };		
if(window.ie || window.opera){document.body.setProperty("unselectable","on");}    
if(window.gecko){document.body.setStyle("MozUserSelect","none");}    
if(window.webkit){document.body.setStyle("KhtmlUserSelect","none");} 
trap();
}  
function right(e) {
var msg = "Este conteúdo é protegido e não pode ser reproduzido sem prévia autorização da editora.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap() 
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }
// --> 

function initScrollLayer() {        
	var wndo = new dw_scrollObj('wn', 'lyr');
	wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
    dw_scrollObj.GeckoTableBugFix('wn'); 
}
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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
tempo = "";
tempo2 = "";
MidiaAtiva = "";
$(document).ready(function(){
	qtdFotos = $('.fotoSite').length;
	qtdProdutos = $('.produtoLoja').length;
	qdtTempo = 0;
	qtdMovimentos = 1;
	qtdMovimentos2 = 1;
	podeFechar = 0;
	MidiaAtiva = 'fotos';
	if(MidiaAtiva = 'fotos'){
		tempo = setInterval('tempoLimite()',1000);
	}
	tempo2 = setInterval('tempoLimite2()',1500);
	$('body').click(function () {
		if(podeFechar == 1){ 
			$('#'+divaberta).fadeOut('normal');
			podeFechar = 0;
		}
	});
});


function tempoLimite(){
	if(MidiaAtiva = 'fotos'){
		if(qdtTempo > 4){
			if((qtdMovimentos + 1) <= qtdFotos){
				NextFoto();
				qdtTempo = 0;
			}else{
				voltaTudo()
				qdtTempo = 0;
			}
		}else{
			qdtTempo++;
		}
	}
}

function tempoLimite2(){
		if(qdtTempo > 4){
			if((qtdMovimentos2 + 1) <= qtdProdutos){
				NextLoja();
				qdtTempo = 0;
			}else{
				voltaTudo2()
				qdtTempo = 0;
			}
		}else{
			qdtTempo++;
		}
	}



function voltaTudo(){
	valor = ((qtdFotos-1) * 500);
	$('#fotos_hotsite').animate({"marginLeft": "+="+valor+"px"}, 1, function(){
		qtdMovimentos = 1;
	});
}

function voltaTudo2(){
	valor = ((qtdProdutos-1) * 372);
	$('#areaLoja').animate({"marginLeft": "+="+valor+"px"}, 1, function(){
		qtdMovimentos2 = 1;
	});
}

function getQueryString(query){
	var url = new String(document.location);
	comeco = url.indexOf("?"+query);
	
	if(comeco == -1){
		comeco = url.indexOf("&"+query);
	}
	linha = url.substring(comeco);
	
	fim = linha.indexOf("&");
	if(fim == -1){
		fim = linha.length;
	}
	retorno = linha.substring(query.length+2,fim);
	return retorno;
}



function CarregaConteudo(modulo, id, idioma){
	if(modulo == 'numeros'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Number of Students');
		}else{
			$('#area_conteudo_icones div h1').html('Número de Alunos');
		}
	}else if(modulo == 'valor'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Monthly Fee');
		}else{
			$('#area_conteudo_icones div h1').html('Valor da Mensalidade');
		}
		
	}else if(modulo == 'infra'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Infrastructure');
		}else{
			$('#area_conteudo_icones div h1').html('Infraestrutura');
		}
		
	}else if(modulo == 'filosofia'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Educational Philosophy');
		}else{
			$('#area_conteudo_icones div h1').html('Filosofia Educacional');
		}
		
	}else if(modulo == 'atividades'){
		
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Extracurricular Activities');
		}else{
			$('#area_conteudo_icones div h1').html('Atividades Extracurriculares');
		}
	}else if(modulo == 'cursos'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Courses Offered');
		}else{
			$('#area_conteudo_icones div h1').html('Cursos Oferecidos');
		}
		
	}else if(modulo == 'endereco'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Address');
		}else{
			$('#area_conteudo_icones div h1').html('Endereço');
		}
		
	}else if(modulo == 'fale'){
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('Contact the school');
		}else{
			$('#area_conteudo_icones div h1').html('Fale com a escola');
		}
		
	}else if(modulo == 'info'){
		
		if(idioma != 'pt-br'){
			$('#area_conteudo_icones div h1').html('The school');
		}else{
			$('#area_conteudo_icones div h1').html('Informações sobre a Escola');
		}
	}
		$('#area_conteudo_icones div #lyr').html('Carregando...');	
			$.ajax({
				type: "POST",
				url: "carregaConteudo.php",
				data: "m="+modulo+"&escolas_id="+id+"&idioma="+idioma,
				success: function(msg){
					$('#area_conteudo_icones #lyr').html(msg);
					initScrollLayer();
				}
			});
}

function PrevFoto(){
	if(qtdMovimentos > 1){
		$('#fotos_hotsite').animate({"marginLeft": "+=500px"}, 800);
		qtdMovimentos--;
		qdtTempo = 0;
	}
}

function NextFoto(){
	if((qtdMovimentos + 1) <= qtdFotos){
		qtdMovimentos++;
		qdtTempo = 0;
		$('#fotos_hotsite').animate({"marginLeft": "-=500px"}, 800);
	}
}

function PrevLoja(){
	if(qtdMovimentos2 > 1){
		$('#areaLoja').animate({"marginLeft": "+=372px"}, 800);
		qtdMovimentos2--;
		qdtTempo = 0;
	}
}

function NextLoja(){
	if(((qtdMovimentos2) + 1) <= qtdProdutos){
		qtdMovimentos2++;
		qdtTempo = 0;
		$('#areaLoja').animate({"marginLeft": "-=372px"}, 800);
	}
	else {
		voltaTudo2()
		qdtTempo = 0;
	}
}

function TrocaFotoVideo(escolas_id, path){
	qdtTempo = 0;
	qtdMovimentos = 1;
	clearInterval(tempo);
	if(MidiaAtiva == 'fotos'){
		MidiaAtiva = 'videos';
		$('.bto_ver_video a img.trocar').attr('src',path+'/layout/bto_ver_foto.jpg');
		$('.botao_voltar a').attr('href','javascript:void(0)');
		$('.botao_avancar a').attr('href','javascript:void(0)');
		$('#btPrev').attr('src',path+'/layout/bto_voltar_video.jpg');
		$('#btNext').attr('src',path+'/layout/bto_avancar_video.jpg');
		$('.recheio_foto div').fadeOut("slow", function(){
			$('.recheio_foto').html("<div>Carregando...</div>");
			$.ajax({
				type: "POST",
				url: "getVideos.php",
				data: "escolas_id="+escolas_id,
				success: function(msg){
					$('.recheio_foto div').fadeOut("slow", function(){
						$('.recheio_foto').html(msg);
						clearInterval(tempo);
					});
				}
			});
		});
	}else{
		MidiaAtiva = 'fotos';
		$('.bto_ver_video a img.trocar').attr('src',path+'/layout/bto_ver_video.jpg');
		$('.botao_voltar a').attr('href','javascript:PrevFoto()');
		$('.botao_avancar a').attr('href','javascript:NextFoto()');
		$('#btPrev').attr('src',path+'/layout/bto_voltar_galera.jpg');
		$('#btNext').attr('src',path+'/layout/bto_avancar_galera.jpg');
		$('.recheio_foto div').fadeOut("slow", function(){
			$('.recheio_foto').html("<div>Carregando...</div>");
			$.ajax({
				type: "POST",
				url: "getFotos.php",
				data: "escolas_id="+escolas_id,
				success: function(msg){
					$('.recheio_foto div').fadeOut("slow", function(){
						$('.recheio_foto').html(msg);
						clearInterval(tempo);
						tempo = setInterval('tempoLimite()',1000);
					});
				}
			});
		});
	}
}







function Abrediv(ref, div){

		$('#'+divaberta).fadeOut('normal');

		podeFechar = 0;

		var offset = $('#'+ref).offset();

		$('#'+div).css({

			top:offset.top + document.getElementById(ref).offsetHeight,

			left:offset.left,

			width:$('#'+ref).width()+5

		});



		$('#'+div).fadeIn('normal',function(){

			podeFechar = 1;

		});

		divaberta = div;

}



function criaDepoimento(){
	$('#modal').css("opacity",'0.75');
	$('#modal').css('height',$(document).height());
	$('#modal').fadeIn('normal',function(){
		valor = (document.documentElement.scrollTop) - ($('#criaDepoimento').height()/2);
		$('#criaDepoimento').css({
			top:'50%',
			left:		'50%',
			marginLeft:	'-175px',
			marginTop:	valor+'px'
		})
		$('#criaDepoimento').fadeIn('normal',function(){
		});
	});
}



function FecharModal(id){
	$('#'+id).fadeOut('normal',function(){
		$('#modal').fadeOut('normal',function(){
			$('#depoimentoNome').attr('value','');
			$('#depoimentoRelacao').attr('value','');
			$('#depoimentoTexto').attr('value','');
			$('#depoimentoNota').attr('value','');						 
		});									 
	});
}







function EnviarDepoimento(escolas_id){
	erro = "";
	nome 	= $('#depoimentoNome').attr('value');
	relacao = $('#depoimentoRelacao').attr('value');
	email = $('#depoimentoEmail').attr('value');
	texto 	= $('#depoimentoTexto').attr('value');
	nota	= $('#depoimentoNota').attr('value');
	if(nome == ''){
		erro += "Preencha o campo Nome\n";
	}
	if(relacao == ''){
		erro += "Preencha o campo Relação\n";
	}
	if(texto == ''){
		erro += "Preencha o campo Depoimento\n";
	}
	if(erro != ""){
		alert(erro);
	}else{
		$('#depoimentoEnviar').attr('value','Gravando depoimento...');
		$('#depoimentoEnviar').attr('disabled','disabled');
		$.ajax({
			type: "POST",
			url: "gravaDepoimento.php",
			data: "escolas_id="+escolas_id+"&nome="+nome+"&relacao="+relacao+"&nota="+nota+"&texto="+texto+"&email="+email,
			success: function(msg){
				alert('Depoimento criado com sucesso')
				$('#depoimentoEnviar').attr('value','Enviar');
				$('#depoimentoEnviar').attr('disabled','');
				$('#depoimentoNome').attr('value','');
				$('#depoimentoRelacao').attr('value','');
				$('#depoimentoTexto').attr('value','');
				$('#depoimentoNota').attr('value','');
				FecharModal('criaDepoimento');
			}
		});
	}
}

function ProcessaBusca(){
	if($('#palavra').attr('value') == ''){
		alert('Preencha o campo para buscar escolas.');
	}else{
		if($('#palavra').attr('value').length < 3){
			alert('Digite pelo menos 3 letras no campo de busca.');
		}else{
			$('#formBuscaEscola').submit();
		}
	}
}

function CarregaCidades(uf, perguntou){
	$('#campoCidades').slideUp('slow', function(){
		$('#campoCidades').html('Carregando cidades');
		$('#campoCidades').slideDown('slow');
		$.ajax({
			type: "POST",
			url: "carregaCidades.php",
			data: "uf="+uf,
			success: function(msg){
				$('#campoCidades').slideUp('slow', function(){
					$('#campoCidades').html(msg);
					if(perguntou == '0'){
						$('#campoCidades').slideDown('slow', function(){
							
						});
					}else{
						$('#campoCidades').slideDown('slow');
					}
				});
			}
		});
	});	
}

function CarregaCidades2(perguntou){
	$.ajax({
		type: "POST",
		url: "carregaCidades2.php",
		data: "uf=1",
		success: function(msg){
			$('#campoCidades').html(msg);
		}
	});
}

function camposRastro(){
	$('#modal').css("opacity",'0.75');
	$('#modal').css('height',$(document).height());
	$('#modal').fadeIn('normal',function(){
		valor = (document.documentElement.scrollTop) - ($('#camposRastro').height()/2);
		$('#camposRastro').css({
			top:'50%',
			left:		'50%',
			marginLeft:	'-175px',
			marginTop:	valor+'px'
		})
		$('#camposRastro').fadeIn('normal',function(){
		});
	});
}

function EnviarDadosRastro(rastros_id){

	erro = "";
	nome 	= $('#rastrosNome').attr('value');
	email   = $('#rastrosEmail').attr('value');
	if(nome == ''){
		erro += "Preencha o campo Nome\n";
	}
	if(email == ''){
		erro += "Preencha o campo E-mail\n";
	}
	if(erro != ""){
		alert(erro);
	}else{
		$('#rastrosEnviar').attr('value','Gravando dados...');
		$('#rastrosEnviar').attr('disabled','disabled');
		$.ajax({
			type: "POST",
			url: "atualizaRastros.php",
			data: "rastros_id="+rastros_id+"&nome="+nome+"&email="+email,
			success: function(msg){
				alert('Dados gravados com sucesso')
				$('#rastrosEnviar').attr('value','Enviar');
				$('#rastrosEnviar').attr('disabled','');
				$('#rastrosNome').attr('value','');
				$('#rastrosEmail').attr('value','');
				FecharModal('camposRastro');
			}
		});
	}
}

function CarregaBusca(cidade){
	$('#cidadesUF').html(cidade);
	document.location.href='busca.php?tipo=estados&uf='+$('#ufBusca').attr('value')+'&cidade='+cidade;	
}

function CarregaBairros(cidade, perguntou){
	var cidade = $('#cidade').attr('value');
	perguntou = '1';
	$('#campoBairros').slideUp('slow', function(){
		$('#campoBairros').html('Carregando...');
		$('#campoBairros').slideDown('slow');
		$.ajax({
			type: "POST",
			url: "carregaBairros.php",
			data: "cidade="+cidade,
			success: function(msg){
				$('#campoBairros').slideUp('slow', function(){
					$('#campoBairros').html(msg);
					if(perguntou == '0'){
						$('#campoBairros').slideDown('slow', function(){
							
						});
					}else{
						$('#campoBairros').slideDown('slow');
					}
				});
			}
		});
	});	
}

function CarregaBairros2(cidade, zona, perguntou){
	var cidade = $('#cidade').attr('value');
	var zona = $('#zona').attr('value');
	perguntou = '1';
	$('#campoBairros2').slideUp('slow', function(){
		$('#campoBairros2').html('Carregando...');
		$('#campoBairros2').slideDown('slow');
		$.ajax({
			type: "POST",
			url: "carregaBairros2.php",
			data: "cidade="+cidade+"&zona="+zona,
			success: function(msg){
				$('#campoBairros2').slideUp('slow', function(){
					$('#campoBairros2').html(msg);
					if(perguntou == '0'){
						$('#campoBairros2').slideDown('slow', function(){
							
						});
					}else{
						$('#campoBairros2').slideDown('slow');
					}
				});
			}
		});
	});	
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function validate_boletim()

	{

		frm = document.cadastroBoletim

		if (frm.boletim_nome.value=="" || frm.boletim_nome.value=="Nome:")

		{

			alert("Por favor, informe seu nome.");

			frm.boletim_nome.focus();
			frm.boletim_nome.value = '';

			return false;

		}

		if (frm.boletim_email.value=="" || frm.boletim_email.value=="E-mail:")

		{

			alert("Por favor, preencha o seu e-mail.");

			frm.boletim_email.focus();
			frm.boletim_email.value = '';

			return false;

		}

		var str=frm.boletim_email.value

		var filter=/^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name|jobs|travel))(\.[A-z]{2}|)$/i

		if (!filter.test(str))

		{

		alert('Por favor, verifique se o seu e-mail está preenchido corretamente.');

		frm.boletim_email.focus();

		return false; 

		}		

		return true;

	}

var min=9;
var max=20;
function increaseFontSize(w) {
   var p = document.getElementById(w);
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }
      if(s!=max) {
         s += 1;
      }
      p.style.fontSize = s+"px"
}
function decreaseFontSize(w) {
   var p = document.getElementById(w);
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }
      if(s!=min) {
         s -= 1;
      }
      p.style.fontSize = s+"px"
}
function exibirResposta(id)
	{
		//var numericID = this.id.replace(/[^\d]/g,'');
		var numericID = id;
		var obj = document.getElementById('r' + numericID);
		if(obj.style.display=='block') {
			obj.style.display='none';
		} else {
			obj.style.display='block';
		}
	}
function expandir()
	{
		var divs = document.getElementsByTagName('DIV');
		for(var n=0;n<divs.length;n++){
			if(divs[n].className=='faqR' || divs[n].className=='resposta2') {
				divs[n].style.display = 'block';
			}	
		}	
	}
function recolher()
	{
		var divs = document.getElementsByTagName('DIV');
		for(var n=0;n<divs.length;n++){
			if(divs[n].className=='faqR' || divs[n].className=='resposta2') {
				divs[n].style.display = 'none';
			}	
		}	
	}	
