<!--//
function SwapImg(org, over){
	var tmp = over.split(".");
	eval("document." + org + ".src = 'imagens/layout/" + tmp[0] + "_over." + tmp[1] + "'");
}
function desSwap(org, over){
	eval("document." + org + ".src = 'imagens/layout/" + over + "'");
}

function AbrePopUp(sPagina,sNome,sParametros){
	window.open(sPagina,sNome,sParametros);
}

function Confirma(sMsg){
	var tmp = confirm(sMsg);
	if (!tmp) return false;
}

function AbrePopUpFotoTexto(foto){
	window.open('popupimg.php?caminho=' + foto.src.replace("_peq","") + '&','Visualizador','toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=1, width=10, height=10, top=10, left=10');
}

function AbrePopUpGaleria(varPathFotos,raiz){
	window.open(raiz + 'g_popupimg.php?img=' + varPathFotos + '&','Visualizador','toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=1, width=10, height=10, top=10, left=10');
}

function AbrePopUpFoto(caminho, download, raiz){
	window.open(raiz + 'popupimg.php?caminho=' + caminho + '&download=' + download + '&','Visualizador','toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=1, width=10, height=10, top=10, left=10');
}

function Obrigatorios(sForm){
	var obrigatorios = eval("sForm._obrigatorios.value");
	if (obrigatorios != ""){
		obrigatorios = obrigatorios.split(",");
		for (var i = 0; i < obrigatorios.length; i++){
			if (eval("sForm." + obrigatorios[i] + ".value") == ""){
				alert("Campo obrigatorio nao preenchido!");
				eval("sForm." + obrigatorios[i] + ".focus();");
				return false;
				break;
			}
		}
	}
}

function ValidaEmail(Wparam){
	if (Wparam.value != ""){
		if (Wparam.value.indexOf('@', 0) == -1 || Wparam.value.indexOf('.', 0) == -1) { 
			alert("E-mail invalido!");
			Wparam.focus()
			return false;
		}
	}
}

function SoNumeros(){
		if (document.all)
			var Tecla = event.keyCode;
		else 
			if (document.layers)
				var Tecla = e.which;
		if ((Tecla > 47 && Tecla < 58) || (Tecla > 95 && Tecla < 106)){
			return true;
		}else{
			if (Tecla != 8 && Tecla != 46 && Tecla != 37 && Tecla != 39 && Tecla != 36 && Tecla != 35 && Tecla != 9)
				return false;
			else
				return true;
		}
	}
	
function retornaCampo(valorPadrao,valorReal){
	if (valorReal.value == ""){
		valorReal.value = valorPadrao;
	}
}

function limpaCampo(valorPadrao,valorReal){
	if (valorReal.value == valorPadrao){
		valorReal.value = "";
	}
}

function mascaraTelefone(fone){
	var retorno = fone.value;
	if (fone.value.length == 1) retorno = "(" + fone.value;
	if (fone.value.length == 3) retorno = fone.value + ") ";
	if (fone.value.length == 9) retorno = fone.value + "-";
	
	fone.value = retorno;
}

function mascaraData(data){
	var retorno = data.value;
	if (data.value.length == 2) retorno = data.value + "/";
	if (data.value.length == 5) retorno = data.value + "/";
	
	data.value = retorno;
}

function mascaraCep(cep){
	var retorno = cep.value;
	if (cep.value.length == 2) retorno = cep.value + ".";
	if (cep.value.length == 6) retorno = cep.value + "-";
	
	cep.value = retorno;
}

//acessibilidade A+ e A-
var atual = 0;
var objetos = 2;

function mudaFonte(acao){
	moz = !(document.all);  // Testar o navegador mozilla
	nav = navigator.appName;  // Armazena o nome do navegador

	atual = ((acao == "+")?(atual + 1):(atual - 1));
	
	if (moz || nav == 'Opera'){
		for (i = 0; i < objetos; i++){
			var obj = document.styleSheets[0].cssRules[i].style.fontSize;
			obj = (obj.replace("px","") * 1);
			
			if (acao == "+"){
				if (atual <= 4){
					document.styleSheets[0].cssRules[i].style.fontSize = (obj + 1);
				}
			}else{
				if (atual >= 0){
					document.styleSheets[0].cssRules[i].style.fontSize = (obj - 1);
				}
			}
		}
	}else{
		for (i = 0; i < objetos; i++){
			var obj = document.styleSheets[0].rules[i].style.fontSize;
			obj = (obj.replace("px","") * 1);
			
			if (acao == "+"){
				if (atual <= 4){
					document.styleSheets[0].rules[i].style.fontSize = (obj + 1);
				}
			}else{
				if (atual >= 0){
					document.styleSheets[0].rules[i].style.fontSize = (obj - 1);
				}
			}
		}
	}
	
	atual = ((atual > 4)?(4):(((atual < 0)?(0):(atual))));
	//GerarCookie("fonte", atual, "");
}

function GerarCookie(strCookie, strValor, lngDias){
    var dtmData = new Date();

    if(lngDias)    {
        dtmData.setTime(dtmData.getTime() + (lngDias * 24 * 60 * 60 * 1000));
        var strExpires = "; expires=" + dtmData.toGMTString();
		
    }else{
        var strExpires = "";
    }
    document.cookie = strCookie + "=" + strValor + strExpires + "; path=/";
}

function LerCookie(strCookie){
    var strNomeIgual = strCookie + "=";
    var arrCookies = document.cookie.split(';');

    for(var i = 0; i < arrCookies.length; i++){
        var strValorCookie = arrCookies[i];
        while(strValorCookie.charAt(0) == ' '){
            strValorCookie = strValorCookie.substring(1, strValorCookie.length);
        }
		
        if(strValorCookie.indexOf(strNomeIgual) == 0){
            return strValorCookie.substring(strNomeIgual.length, strValorCookie.length);
        }
    }
    return null;
}

/*if (LerCookie("fonte") != null){
	var conta = LerCookie("fonte") * 1;
	
	if (conta > 0){
		for (i = 0; i < conta; i++){
			mudaFonte("+");
		}
	}
}*/
//-->