	$(document).ready(function(){
		 
	   aberto = "";
	   abertoBt = "";
	 $("#bt1").hover(function(){$(this).css({ color: "#e1007a"}); }, function(){ if (abertoBt != "#bt1") {$(this).css({ color: "#1a171b"}); }});
	   $("#bt1").click(function () {
		if ("#bt1" != abertoBt) { 
		  $("#bt1").css({ color: "#1a171b"}); $("#bt2").css({ color: "#1a171b"}); $("#bt3").css({ color: "#1a171b"});  $("#bt4").css({ color: "#1a171b"});  $("#bt5").css({ color: "#1a171b"});
		  $(this).css({ color: "#e1007a"});
		  
		  $("#Sub_identity").slideDown("slow");
		  $(aberto ).slideUp("slow");
		  aberto = "#Sub_identity";
		  abertoBt = "#bt1";
		  setTimeout ( "carregaweb('galerias.php?area=identity','main')", 1000 );
		}
		});
		
	   $("#bt2").hover(function(){$(this).css({ color: "#e1007a"}); }, function(){ if (abertoBt != "#bt2") {$(this).css({ color: "#1a171b"}); }});
	   $("#bt2").click(function () {
		if ("#bt2" != abertoBt) {
		  $("#bt1").css({ color: "#1a171b"}); $("#bt2").css({ color: "#1a171b"}); $("#bt3").css({ color: "#1a171b"});  $("#bt4").css({ color: "#1a171b"});  $("#bt5").css({ color: "#1a171b"});
		  $(this).css({ color: "#e1007a"});
		  $("#Sub_print").slideDown("slow");
		  $(aberto ).slideUp("slow");
		  aberto = "#Sub_print";
		  abertoBt = "#bt2";
		  setTimeout ( "carregaweb('galerias.php?area=print','main')", 1000 );
		}
		});
		
	  $("#bt3").hover(function(){$(this).css({ color: "#e1007a"}); }, function(){ if (abertoBt != "#bt3") {$(this).css({ color: "#1a171b"}); }});
	   $("#bt3").click(function () {
		if ("#bt3" != abertoBt) {
		  $("#bt1").css({ color: "#1a171b"}); $("#bt2").css({ color: "#1a171b"}); $("#bt3").css({ color: "#1a171b"});  $("#bt4").css({ color: "#1a171b"});  $("#bt5").css({ color: "#1a171b"});
		  $(this).css({ color: "#e1007a"});
		  $("#Sub_illustration").slideDown("slow");
		  $(aberto ).slideUp("slow");
		  aberto = "#Sub_illustration";
		  abertoBt = "#bt3";
		  setTimeout ( "carregaweb('galerias.php?area=illustration','main');", 1000 );
		}
		});
		
	   $("#bt4").hover(function(){$(this).css({ color: "#e1007a"}); }, function(){ if (abertoBt != "#bt4") {$(this).css({ color: "#1a171b"}); }});
	   $("#bt4").click(function () {
		if ("#bt4" != abertoBt) {
		  $("#bt1").css({ color: "#1a171b"}); $("#bt2").css({ color: "#1a171b"}); $("#bt3").css({ color: "#1a171b"});  $("#bt4").css({ color: "#1a171b"});  $("#bt5").css({ color: "#1a171b"});
		  $(this).css({ color: "#e1007a"});
		  $("#Sub_newmedia").slideDown("slow");
		  $(aberto ).slideUp("slow");
		  aberto = "#Sub_newmedia";
		  abertoBt = "#bt4";
		  setTimeout ( "carregaweb('galerias.php?area=news','main');", 1000 );
		}
		});
		
	  $("#bt5").hover(function(){$(this).css({ color: "#e1007a"}); }, function(){ if (abertoBt != "#bt5") {$(this).css({ color: "#1a171b"}); }});
	   $("#bt5").click(function () { 
		if ("#bt5" != abertoBt) {
		  $("#bt1").css({ color: "#1a171b"}); $("#bt2").css({ color: "#1a171b"}); $("#bt3").css({ color: "#1a171b"});  $("#bt4").css({ color: "#1a171b"});  $("#bt5").css({ color: "#1a171b"});
		  $(this).css({ color: "#e1007a"});
		  $(aberto ).slideUp("slow");
		  aberto = "#Sub_about";
		  abertoBt = "#bt5";
		   setTimeout ( "carregaweb('about.php','main');", 1000 );
		}
		});
		
		switch(location.hash)
		{
		case "#identity":
		  carregaweb("galerias.php?area=identity","main");
		  $("#bt1").css({ color: "#e1007a"});
		  $("#Sub_identity").show("slow");
		  aberto = "#Sub_identity";
		  abertoBt = "#bt1";
		  
		  break;    
		case "#print":
		  carregaweb("galerias.php?area=print","main");
		  $("#bt2").css({ color: "#e1007a"});
		  $("#Sub_print").show("slow");
		  aberto = "#Sub_print";
		  abertoBt = "#bt2";
		  
		  break;
		case "#illustration":
		   carregaweb("galerias.php?area=illustration","main");
		  $("#bt3").css({ color: "#e1007a"});
		  $("#Sub_illustration").show("slow");
		  aberto = "#Sub_illustration";
		  abertoBt = "#bt3";
		  
		  break;
		case "#news":
		  carregaweb("galerias.php?area=newmedia","main");
		  $("#bt4").css({ color: "#e1007a"});
		  $("#Sub_newmedia").show("slow");
		  aberto = "#Sub_newmedia";
		  abertoBt = "#bt4";
		  
		  break;
		case "#news":
		  carregaweb("galerias.php?area=news","main");
		  $("#bt5").css({ color: "#e1007a"});
		  $("#Sub_about").show("slow");
		  aberto = "#Sub_about";
		  abertoBt = "#bt5";
		  
		  break;
		default:
		   carregaweb("destaques.php","main");
		}

	});



 	document.write("<style type='text/css'>#thephoto1 {visibility:hidden;}</style>");
	document.write("<style type='text/css'>#thephoto2 {visibility:hidden;}</style>");

function initImage() {
	imageId = 'thephoto1';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
	
	imageId = 'thephoto2';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}


function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}



function openAjax() {

var ajax;

try{
    ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers decentes, como: Firefox, Safari, dentre outros.
}catch(ee){
    try{
        ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
    }catch(e){
        try{
            ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
        }catch(E){
            ajax = false;
        }
    }
}
return ajax;
}

// Função que realiza a busca instantânea
function carregaweb(quem,onde) {
	if(document.getElementById) { // Para os browsers complacentes com o DOM W3C.
		var exibeResultado = document.getElementById(onde); // div que exibirá o resultado da busca.
			var ajax = openAjax(); // Inicia o Ajax.
			ajax.open("GET", quem, true); // Envia o termo da busca como uma querystring, nos possibilitando o filtro na busca.
			ajax.onreadystatechange = function() {
				if(ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando...
					exibeResultado.innerHTML = '<div align="center" style = "width:500px;">  <p>&nbsp;</p>  <p>&nbsp;</p>  <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p><p>&nbsp;</p> <p>&nbsp;</p>  <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p>   <p>&nbsp;</p>  <p><img src="../../imag/global/loading2.gif" alt="Load" align="absmiddle"></p></div>';
				}
				if(ajax.readyState == 4) { // Quando estiver tudo pronto.
					if(ajax.status == 200) {
						var resultado = ajax.responseText; // Coloca o resultado (da busca) retornado pelo Ajax nessa variável (var resultado).
						resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
						resultado = unescape(resultado); // Resolve o problema dos acentos
						exibeResultado.innerHTML = resultado;
						
						window.setTimeout("initImage()", 1000);
						
					} else {
						exibeResultado.innerHTML = "Erro: ";
					}
				}
			}
			ajax.send(null); // submete
	}
}	



// TESTES *********************************************************************************************************
function linka(quem) {
			var ajax = openAjax(); // Inicia o Ajax.
			ajax.open("GET", quem, true); // Envia o termo da busca como uma querystring, nos possibilitando o filtro na busca.
			ajax.onreadystatechange = function() {
				if(ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando...
					exibeResultado.innerHTML = '<img src="../../imag/outros/load.gif" alt="Load"> a carregar... ';
				}
				if(ajax.readyState == 4) { // Quando estiver tudo pronto.
					if(ajax.status == 200) {
						
						eval("self.location='"+ quem + "'");
						
					} else {
						exibeResultado.innerHTML = "Erro: ";
					}
				}
			}
			ajax.send(null); // submete
}
function goTo(targ,selObj){ //v3.0
  eval(targ+".location='"+selObj+"'");
}

/* Abre e fecha menus...*/
function abre(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}

function abre_menu_ensino(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv2").getElementsByTagName("span"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function abre2(obj,obj2,obj3){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById(obj3).getElementsByTagName("span"); 
	
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="mostra") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "block";
		}
	}
	if(obj3 == "h_estu_p"){
		este = document.getElementById(obj2);
		bt1 = document.getElementById('publi_m2_1');
		bt2 = document.getElementById('publi_m2_2');
		bt3 = document.getElementById('publi_m2_3');
		bt4 = document.getElementById('publi_m2_4');
		
		bt1.className='h_out';
		bt2.className='h_out';
		bt3.className='h_out';
		bt4.className='h_out';
		
		este.className='h_over2';
	}
	if(obj3 == "h_estu_c"){
		este = document.getElementById(obj2);
		bt1 = document.getElementById('coloqui_m2_1');
		bt2 = document.getElementById('coloqui_m2_2');
		bt3 = document.getElementById('coloqui_m2_3');
		bt4 = document.getElementById('coloqui_m2_4');
		
		bt1.className='h_out';
		bt2.className='h_out';
		bt3.className='h_out';
		bt4.className='h_out';
		
		este.className='h_over2';
	}
	if(obj3 == "h_estu_d"){
		este = document.getElementById(obj2);
		bt1 = document.getElementById('descp_m2_1');
		bt2 = document.getElementById('descp_m2_2');
		bt3 = document.getElementById('descp_m2_3');
		bt4 = document.getElementById('descp_m2_4');
		
		bt1.className='h_out';
		bt2.className='h_out';
		bt3.className='h_out';
		bt4.className='h_out';
		
		este.className='h_over2';
	}
}

function abre3(obj,local, tipo){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById(local).getElementsByTagName(tipo); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="mostra") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function docs_mostra(obj,obj2){
	
	var el = document.getElementById(obj);
	if(obj2 == 1){ 
			el.style.display = "block";
	}
	if(obj2 == 0){ 
			el.style.display = "none";
	}
}

//***************************************** MENU HOME *************************************************

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

//***************************************** MENU NOTICIAS *************************************************
function p_menus(bt,bt2){
		el = document.getElementById(bt);	
		el2 = document.getElementById(bt2);	
		if(el.style.display == "block"){ 
			el.style.display = "none";
			el2.style.display = "block";
		}else{
			el.style.display = "block";
			el2.style.display = "none";
		}
		
}



/* ######## GERAL  */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/*
#################################################################################
#                            HOME VALIDA EMAIL                                  #
#################################################################################
*/

function submitform() {
    	if  (document.sub_form.email_addr.value=='')
  			alert("This email address is not valid");
		else {
  				if ( ((document.sub_form.email_addr.value.indexOf('@',1))==-1)||(document.sub_form.email_addr.value.indexOf('.',1))==-1 )
  					alert("O email não é valido...");

  				else {
  					document.sub_form.submit();
                                      }
  		}
  }
  


