$(function(){
      //      Testando location

	$('#twitter').click(function(evt) {
		evt.preventDefault();
		window.open(this.href);
	});
      var local = $(location).attr('href').split("/").reverse()[0];
        
      if(local == ''){
	    $(location).attr('href','index.php');
      }else if(local == "index.php"){
	    $('#divMenu').fadeOut(0);
	    //$('#divSlideShow').fadeOut(0).fadeIn(1300);
	    $(window).load(function(){
		  $('#divMenu').fadeIn(1300);
	    })
            /*
	    $('#divMenu a').click(function(e){
		  e.preventDefault();
		  var href = $(this).attr('href');
		  if(href != 'index.php'){
			$('#divSlideShow').fadeOut(600)
			$('#divMenu').css({
			      position:'absolute',
			      top:593
			}).animate({
			      top:0
			},1200,'easeOutExpo',function(){
			      $(location).attr('href', href);
			});
		  }
	    })
            */
      }else{
	    $('#divContainer').fadeOut(0).fadeIn(800);
	    $('#divMenu a').not('#divMenu a:last').click(function(e){
		  e.preventDefault();
		  var href = $(this).attr('href');
		  if(href == 'index.php'){
			$('#divContainer,#desenvolvido,#presente').fadeOut(800);
			$('#divMenu').fadeOut(800,function(){
			      $(location).attr('href', href);
			});
		  }else if(href != local && href != 'index.php'){
			$('#divContainer,#desenvolvido,#presente').fadeOut(800,function(){
			      $(location).attr('href', href);
			});
		  }
	    })
      }

      var posicao_inicial = $('#divMenu a[href="' + local + '"]').position().left - 40;
      var largura_inicial = $('#divMenu a[href="' + local + '"]').width() + 76;
      if(local == 'index.php'){
	    posicao_inicial = 154;
	    largura_inicial = 111;
      }
      
      $('#segue').css({width:largura_inicial,left:posicao_inicial});

      $('#divMenu a').mouseover(function(){
	    var posicao = $(this).position().left - 40;
	    var largura = $(this).width() + 76;
	    /*var posicao = $(this).position().left - 32;
	    var largura = $(this).width() + 60;*/
	    //alert(largura)
	    $('#segue').stop(false,false).animate({width:largura,left:posicao},900,'easeOutExpo');
	    $(this).bind('click',function(){
		  $('#segue').effect('highlight',300);
	    })
      });

	
      $('#submit').click(function(e){
	    e.preventDefault();
	    if(document.forms[0].txtNome.value.length == 0 || document.forms[0].txtEmail.value.length == 0 || document.forms[0].txtMensagem.value.length == 0)
		  alert('Algum campo obrigatorio nao foi preenchido!');
	    else
		  document.forms[0].submit();
      })
});

// <![CDATA[

function CheckMultiple5(frm, name) {
	for (var i=0; i < frm.length; i++)
	{
		fldObj = frm.elements[i];
		fldId = fldObj.id;
		if (fldId) {
			var fieldnamecheck=fldObj.id.indexOf(name);
			if (fieldnamecheck != -1) {
				if (fldObj.checked) {
					return true;
				}
			}
		}
	}
	return false;
}
function CheckForm5(f) {
	var email_re = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
	if (!email_re.test(f.email.value)) {
		alert("Digite seu e-mail.");
		f.email.focus();
		return false;
	}
	
	return true;
}

// ]]>

