// JavaScript Document

//Script Função ajax que detecta o navegador
function getBrowser() {
	if (window.XMLHttpRequest) { 
		a=new XMLHttpRequest(); //Objeto nativo (FF/Safari/Opera7.6+)
	} else {
		try { 
			a=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)
		}   
		catch(e) {
			try { 
				a=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)
			}   
			catch(e) { /* O navegador nÃ£o tem suporte */ 
				a=false; 
			}
		}
	} 
	return a;
}
//Fim do Scrip Função ajax que detecta o navegador

//[INICIO] função para mostrar a foto grande
function func_mostraFoto(imgFoto, strTitulo){
	valor = imgFoto
	ajax = getBrowser();
	if(ajax){
		ajax.open("GET","/v2/us/_ajax/ajax.asp?acao=portfolioMostraFoto&foto="+valor+"&titulo="+strTitulo, true);
		ajax.onreadystatechange = function(){
			if(ajax.readyState != 4){
				document.getElementById("divFoto").innerHTML = "Carregando...";
			}
			if(ajax.readyState == 4){
				if(ajax.status == 200) {
					 document.getElementById("divFoto").innerHTML =  ajax.responseText;
       			} else {
					document.getElementById("divFoto").innerHTML = ajax.responseText;
      			}
			}
		}
		ajax.send(null);
	}

}
//[FIM] função para mostrar a foto grande

//[INICIO] função para mostrar a grade de foto pequenas
function func_mostraSubFotos(idCat, divID){
	
	
	valor = idCat
	urlLink = "/v2/us/_ajax/ajax.asp?acao=portfolioMostraGrade&categoria="+idCat
	func_menuSusp(divID)
	ajax = getBrowser();
	if(ajax){
		ajax.open("GET",urlLink, true);
		ajax.onreadystatechange = function(){
			
			if(ajax.readyState != 4){
				document.getElementById("div_"+divID).style.display = ''
				document.getElementById("div_"+divID).innerHTML = "Carregando...";
			}
			
			if(ajax.readyState == 4){
				
				if(ajax.status == 200) {
					 
					 document.getElementById("div_"+divID).innerHTML =  ajax.responseText;
       			} else {
					document.getElementById("div_"+divID).innerHTML = ajax.responseText;
      			}
			}
			
		}
		ajax.send(null);
	}
}
//[FIM] função para mostrar a grade de foto pequenas

//[INICIO] função de menu suspenso
function func_menuSusp(strDiv){


	for(i=1 ; i < 6 ; i++){
		if(i == strDiv){
			document.getElementById("div_"+strDiv).style.display = ''
		}

		if(i != strDiv){
			
			document.getElementById("div_"+i).style.display = 'none'
		}

			
	}
}
//[FIM] função de menu suspenso
