/*	
	leia --- COMENTÁRIOS SOBRE ALGUMAS FUNÇÕES DESTA PÁGINA !!!
	handleErr(msg,url,l)	- será chamado quando ouver erros na página
	onLoadImg()		        - será chamada quando a imagem for carregada
	mostraFoto(num)	        - esta é a função principal, quem vai exibir/trocar as fotos (obs. 'num' aqui é o 'foto.numAtual')
	numReal(num)		    - será chamada para retornar o número real da foto
	viewPage(e,grupo)	    - será chamada para trocar a galeria de fotos a ser exibida
*/	
    onerror = handleErr;        // se der algum erro no javascript da página, a funçao handleErr será executada
	var mudaFtInterv1    = "";   // nesta variável será iniciado o intervalo
	var mudaFtInterv2    = "";   // nesta variável será iniciado o intervalo
	var ftTempo         = 5000;// Tempo de mudança

	function handleErr(msg,url,l)
	{
		txt ="Foi encontrado um erro nesta pagina.\n\n"
		txt+="Erro: " + msg + "\n"
		txt+="Pagina: " + url + "\n"
		txt+="Linha: " + l + "\n\n"
		txt+="Pedimos que anote os dados acima e informe-nos pelo contato do site."
		alert(txt)
		return true
	}

	function onLoadImg1()
	{
		document.getElementById("carregandoExemplo1").style.display = "none";
		document.getElementById("fotoExemplo1").style.display = "";
		
		if (foto1.numAtual > 0 && foto1.numAtual < foto1.numMax) { }
		else foto1.numAtual = 0;

		mudaFtInterv1 = setTimeout("mostraFoto1(foto1.numAtual+1)", ftTempo);
	}
	
	function onLoadImg2()
	{
		document.getElementById("carregandoExemplo2").style.display = "none";
		document.getElementById("fotoExemplo2").style.display = "";
		
		if (foto2.numAtual > 0 && foto2.numAtual < foto2.numMax) { }
		else foto2.numAtual = 0;

		mudaFtInterv2 = setTimeout("mostraFoto2(foto2.numAtual+1)", ftTempo);
	}
	

	function mostraFoto1(num)
	{
		if (num <= 0 || num > foto1.numMax) {foto1.numAtual = 1}
		else{foto1.numAtual = num};

		var ft = document.getElementById("fotoExemplo1");
		if (ft != null)
		{
		    ft.title = " Exemplo " + num + " / " + foto1.numMax;
		    ft.alt = "Imagem " + num + " / " + foto1.numMax;
		    ft.src = foto1.endereco + numReal1(num) + foto1.extensao;
		}
	}
	
	function mostraFoto2(num)
	{
		if (num <= 0 || num > foto2.numMax) {foto2.numAtual = 1}
		else{foto2.numAtual = num};

		var ft = document.getElementById("fotoExemplo2");
		if (ft != null)
		{
		    ft.title = " Exemplo " + num + " / " + foto2.numMax;
		    ft.alt = "Imagem " + num + " / " + foto2.numMax;
		    ft.src = foto2.endereco + numReal2(num) + foto2.extensao;
		}
	}
	
	function numReal1(num)
	{
		if (foto1.numReais.length > 0)       // se array existe
			{return (foto1.numReais[num-1])} // elementro (num-1) pq o num comeCa em 1 e array em 0
		else
			{return (num)};
	}

	function numReal2(num)
	{
		if (foto2.numReais.length > 0)       // se array existe
			{return (foto2.numReais[num-1])} // elementro (num-1) pq o num comeCa em 1 e array em 0
		else
			{return (num)};
	}
	
	function viewPage1(array)
	{
		getDadosFoto1(array);
		mostraFoto1(1);
	}
	
	function viewPage2(array)
	{
		getDadosFoto2(array);
		mostraFoto2(1);
	}
	
	/*
		leia --- COMENTÁRIOS SOBRE AS VARIÁVEIS DESTA PÁGINA !!!
	    foto.numMax     - é o número de fotos na pasta
	    foto.numAtual   - a contagem das fotos começa em 1
	    foto.endereco   - aqui vc coloca o endereço da foto até o número real dela.
	    foto.numReais   - se as fotos não seguem uma ordem tipo 1, 2, 3, 4... então vc deverá expecificar qual é a ordem q elas seguem
				        -> o que são os 'números reais das fotos'?
				        -> resposta: se a foto se chama 'foto029.jpg', o número real dela é 29
    */

    foto1 = new Object()
    foto2 = new Object()

    function getDadosFoto1(array)
    {
	    foto1.numMax = 0;
	    foto1.numAtual = 1;
	    
	    foto1.numReais   = array;
	    foto1.numMax     = foto1.numReais.length;

        foto1.endereco = "fotos/lancamento/";
        foto1.extensao = ".jpg";

        return foto1;
    }
    
    function getDadosFoto2(array)
    {
	    foto2.numMax = 0;
	    foto2.numAtual = 1;
	    
	    foto2.numReais   = array;
	    foto2.numMax     = foto2.numReais.length;

        foto2.endereco = "fotos/lancamento/";
        foto2.extensao = ".jpg";

        return foto2;
    }
