// 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


function func_mudaDiv(strFundo, strH1, strP, nomeDiv){
	
	document.getElementById("div_"+nomeDiv).style.backgroundColor = strFundo;
	document.getElementById("h1_"+nomeDiv).style.color = strH1;
	document.getElementById("p_"+nomeDiv).style.color = strP;
	 
}

function func_mudaInput(strValue, strTexto, nomeInput){
	if (strValue==1) {
		if (document.getElementById(nomeInput).value == "") {
			document.getElementById(nomeInput).value = strTexto;
		}
		if (document.getElementById(nomeInput).value == "") {
			document.getElementById(nomeInput).value = strTexto;
		}
	}
	else {
		if (document.getElementById(nomeInput).value=="Login") {
			document.getElementById(nomeInput).value = "";
		}
		if (document.getElementById(nomeInput).value=="Password") {
			document.getElementById(nomeInput).value = "";
		}
	}
}


//[INICIO] funcao para utilizar no ajax
function func_ajax(url, divID){
	

	ajax = getBrowser();
	if(ajax){
		ajax.open("GET",url, true);
		ajax.onreadystatechange = function(){
			if(ajax.readyState != 4){

				document.getElementById(divID).innerHTML = "Carregando...";

			}
			if(ajax.readyState == 4){
				if(ajax.status == 200) {

					 document.getElementById(divID).innerHTML =  ajax.responseText;

       			} else {

					document.getElementById(divID).innerHTML = ajax.responseText;

      			}
			}
		}
		ajax.send(null);
	}
}
//[FIM] funcao para utilizar no ajax


//[INICIO] mudar a cor do portfolio
function func_mudaCor(strDiv, strCor, strSpan, strCorSpan){
	
	//alert(strDiv+"\n"+strCor)
	document.getElementById(strDiv).style.backgroundColor = "#"+strCor
	document.getElementById(strSpan).style.color = "#"+strCorSpan
	
	
		
}
//[FIM] mudar a cor do portfolio

//[INICIO] mudar a cor do home
function func_mudaCorHome(strDivFoto, strDivFotoDisplay, strDiv, strDiv2, strDiv3, strCor, strSpan, strCorSpan){
	
	if(strDivFotoDisplay == "table"){
		document.getElementById(strDivFoto).style.display = ""
	}else{
		document.getElementById(strDivFoto).style.display = "none"	
	}
	document.getElementById(strDivFoto).style.borderColor = "#"+strCor
	document.getElementById(strDiv).style.backgroundColor = "#"+strCor
	document.getElementById(strDiv2).style.backgroundColor = "#"+strCor
	document.getElementById(strDiv3).style.backgroundColor = "#"+strCor
	document.getElementById(strSpan).style.color = "#"+strCorSpan
	document.getElementById("_"+strSpan).style.color = "#"+strCorSpan
	
	//alert(document.getElementById(strDivFoto).style.display)
	
	
		
}
//[FIM] mudar a cor do home

//[INICIO] funcao para se logar na area do cliente
function func_formLogin(){
	
	var login = document.getElementById("STRLogin").value;
	var senha = document.getElementById("STRSenha").value;
	
	if(login == ""){
		alert("Informe seu Login")
		return false
	}
	
	if(senha == ""){
		alert("Informe sua Senha")	
		return false
	}
	
	document.form1.action = "/areacliente/area.asp?acao=LoginSenha"
	document.form1.target = "_blank"
	document.form1.submit();
	
}
//[FIM] funcao para se logar na area do cliente

//[INICIO] funcao para abrir um pagina nova
function func_url(strUrl){
	window.open(strUrl)	
}
//[FIM] funcao para abrir um pagina nova

//[INICIO] funcao para abrir uma objeto em oculto
function func_hidden(strIdTable, strTipo){
	
	if(strTipo == "1"){ strHidden = ""; }
	
	if(strTipo == "0"){ strHidden = "none"; }
	
	document.getElementById(strIdTable).style.display = strHidden
	
}
//[FIM] funcao para abrir uma objeto em oculto

//[INICIO] usando a tecla enter
function tecla_enter()
{
	
	
if (window.event.keyCode == 13)
{
  func_formLogin()
  return true; // Tab e Enter
}
}
//[FIM] usando a tecla enter

//[INICIO] funcao para mudar fundo dos numeros pagina

function mudaFundo(id, fundo){
	document.getElementById(id).style.backgroundColor = fundo;
}

//[FIM] funcao para mudar fundo dos numeros pagina

