	function capturaDados(formulario){
		var arrayFormulario = document.getElementsByTagName('form');
		var campos = '';
		var navegador = navigator.appName;
		if(navegador == 'Netscape'){
			inicioArray = arrayFormulario[formulario].length;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i <= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					chaves = arrayFormulario[formulario][chaves].name;
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		} else {
			nCampos = arrayFormulario[formulario].length;
			totalArray=1;
			for(chaves in arrayFormulario[formulario]){ totalArray++; }
			inicioArray = totalArray-nCampos;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i >= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		}
		return campos;
	}

	function ajaxInit(){
		var xmlhttp;
		try{ xmlhttp = new XMLHttpRequest(); }
		catch(ee) {
			try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e) {
				try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(E){ xmlhttp = false ;	}
			}
		}
		return xmlhttp;
	}

	function carrMenu(pagina, carregar){
		var title = document.getElementById(carregar).title;
		if(pagina != title){
			ajax = ajaxInit();
			if(ajax){
				ajax.open('POST', 'includes/'+pagina+'.php', true);
				ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				ajax.onreadystatechange = function(){
					if(ajax.readyState == 4){
						if(ajax.status == 200){
							var title = $('#'+carregar).attr('title');
							document.getElementById(carregar).title = pagina;
							$(function($){ $('#'+carregar).html(ajax.responseText); });
							$(function($){ $('#'+title).fadeOut(); });
							$(function($){ $('#'+pagina).fadeIn(); });
						}
					}
				}
				ajax.send(pagina);
			}
		}
	}

	function abrePrincipal(pagina){ $(function($){ $('#'+pagina).fadeIn(); }); }

	function carrImagens(pasta){
		ajax = ajaxInit();
		if(ajax){
			ajax.open('GET', 'carrImagens.php?pg='+pasta, true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function(){
				if(ajax.readyState == 4){
					if(ajax.status == 200){
						$(function($){ $('#imgPortfolio').html(ajax.responseText); });
					}
				}
			}
			ajax.send(pasta);
		}
	}

	function overImagensPortfolio(pasta, imagem){
		document.getElementById('imagemZoom').src = 'imagens/'+pasta+'/thumb3/'+imagem;
		if(document.all){} else document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove=mouse;
		function mouse(e){
			h = document.getElementById('imagemZoom').height;
			if(navigator.appName == 'Netscape'){
				xcurs = e.pageX;
				ycurs = e.pageY;
			} else {
				xcurs = event.clientX;
				ycurs = event.clientY;
			}
			x = screen.width;
			y = screen.height;
			xcurs = xcurs+20;
			ycurs = ycurs+20;
			if(xcurs >= (x-340)){ xcurs = xcurs-340; }
			//document.getElementById('valores1').innerHTML = (y-ycurs) +'<='+ (h+40);
			if((y-(ycurs+60)) <= (h+40)){ ycurs = ycurs-(h+40); }
			document.getElementById('imagemZoom').style.top = ycurs+'px';
			document.getElementById('imagemZoom').style.left = xcurs+'px';
		}
		document.getElementById('imagemZoom').style.display = 'block';
	}

	function fecharPortfolio(){
		document.getElementById('imagemZoom').style.display = 'none';
		document.onmousemove = '';
	}

	function mostracoordenadas(){
		var x = event.clientX;
		var y = event.clientY;
		var localizacao = (x + " X " + y)
		document.getElementById('posicao').innerHTML = localizacao;
	}

	function validacaoContato(){
		var d = document.formContato;
		var frase = ' deve ser preenchido!';
		if(d.nome.value == ''){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))){ alert('O campo "E-mail"' + frase); d.email.focus(); return false; }
		if(d.mensagem.value == ''){ alert('O campo "Mensagem"' + frase); d.mensagem.focus(); return false; }
		return true;
	}

	function showModal(id, pasta, imagem){
		document.getElementById('imagemAmpliada').src = 'imagens/'+pasta+'/zoom/'+imagem;
		id = "#"+id;
		showOverlay();
		var winH = $(window).height()/2;
		var winW = $(window).width();
		var modW = $(id).width() + parseInt($(id).css("paddingLeft"))  + parseInt($(id).css("paddingRight")) ;
		var modH = $(id).height() + parseInt($(id).css("paddingTop"))  + parseInt($(id).css("paddingBottom")) ;
		var topX = winH/2-modH/2;
		if(topX < 20) topX = 10+"px";
		$(id).css({top:  topX, left: winW/2-modW/2, zIndex: "11", display: "block"});
		$('html, body').animate({scrollTop: 0}, 300);
		$(id).fadeIn(1000); 
	}

	function showOverlay(){
		if(!document.getElementById("overlay")){ $('<div id="overlay"></div>').insertBefore(document.body.firstChild); }
		$("#overlay").css({ backgroundColor: "#000000", zIndex: "10", width: "100%", height: "100%", display: "none", top: "0", left: "0" });
		if(navigator.userAgent.toLowerCase().indexOf("msie 6") != -1){ $("#overlay").css({position: "absolute", height: $(document).height()}); }
		else {$("#overlay").css("position", "absolute"); }
		$("#overlay").fadeIn(600);	
		$("#overlay").fadeTo("slow",0.9);
		$('.closeOverlay').click(function(e){
			e.preventDefault();
			$("#overlay").fadeOut(500);
			$('.modal').hide();
		});
	}
	
	function hideModal(){
		$("#overlay").fadeOut(500);
		$('.modal').hide();
	}

	$(document).ready(function(){
		// choose your transition type, ex: fade, scrollUp, shuffle, etc...
    	$('#banner1').cycle({fx:'fade'});
		$('#banner2').cycle({fx:'fade'});
		$('#banner3').cycle({fx:'fade'});
	});
