function addFlash(URL, WIDTH, HEIGHT, TRANSPARENT){
	document.write (' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
	document.write (' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
	document.write (' <param name="movie" value="'+ URL +'" />');
	document.write (' <param name="quality" value="high" />');

	if ( TRANSPARENT ) {
	  document.write (' <param name="Wmode" value="Transparent" />');
	}

	document.write (' <embed src="'+ URL +'" quality="high" ');

	if ( TRANSPARENT ) {
	document.write (' Wmode = "transparent" ');
	}

	document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
	document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
	document.write (' </object>');
}

function onFocus(aFrm, aCampo){
	stringClassName = document.forms[aFrm].elements[aCampo.name].className;
	pos = stringClassName.indexOf(' ');
	if(pos != -1){
		document.forms[aFrm].elements[aCampo.name].className = stringClassName.substring(0,pos) + " fieldOnFocus";
	}else{
		document.forms[aFrm].elements[aCampo.name].className += " fieldOnFocus";
	}
}

function onBlur(aFrm, aCampo){
	stringClassName = document.forms[aFrm].elements[aCampo.name].className;
	pos = stringClassName.indexOf(' ');
	document.forms[aFrm].elements[aCampo.name].className = stringClassName.substring(0,pos) + " fieldOnBlur";
}

function selectCheckbox(anOidElement){
	checkToSelect = document.getElementById(anOidElement);
	if(checkToSelect.checked == true){
		checkToSelect.checked = false;
	}else{
		checkToSelect.checked = true;
	}
}

/*------------------------------------------------------
	Data:			26/03/2005
	Funcionalidade:	Verifica se um e-mail é válido
------------------------------------------------------*/
function validaEmail(aFrm, aValue, aMsg){
	var strElement	= aValue;
	var strInvalid	= /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
	var strValid	= /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
	if(!strInvalid.test(strElement) && strValid.test(strElement)){
		return true;
	}else{
		alert(aMsg);
		return false;
	}
}

/*------------------------------------------------------
	Data:			26/03/2005
	Funcionalidade:	Verifica se um campo está vazio trabalhando
------------------------------------------------------*/
function isVazio(aFrm, anElement, aMsg){
	if(document.forms[aFrm].elements[anElement].value == ""){
		if((aMsg != "") && (aMsg != null)){
			alert(aMsg);
			document.forms[aFrm].elements[anElement].focus();
		}		
		return true;
	}
	return false;
}

/*------------------------------------------------------
	Data:			20/09/2005
	Funcionalidade:	Dá o focus no próximo elemento do formulário
------------------------------------------------------*/
function goNextField(aFrm, aCampoAtual, aCampoAtualMaxLenght, aProximoCampo){
	if(document.forms[aFrm].elements[aCampoAtual.name].value.length == aCampoAtualMaxLenght){
		document.forms[aFrm].elements[aProximoCampo].focus();
		document.forms[aFrm].elements[aProximoCampo].select();
	}
}

/*------------------------------------------------------
	Data:			02/05/2005
	Funcionalidade:	Não permite digitar caracters diferentes de 0123456789
------------------------------------------------------*/
function onlyNumber(anEvent){
	var charExp = /[0-9]/;
	var teclaCodigo;
	var teclaChar;
	if(anEvent.keyCode){
		teclaCodigo = anEvent.keyCode;
	}else{
		if(anEvent.which){
			teclaCodigo = anEvent.which;
		}
	}

	teclaChar = String.fromCharCode(teclaCodigo);
	if(teclaCodigo == 37 || teclaCodigo == 39 || teclaCodigo == 44 || teclaCodigo == 46 || teclaCodigo == 8 || teclaCodigo == 9 || (teclaCodigo == 35 && anEvent.shiftKey) || (teclaCodigo == 36 && anEvent.shiftKey) || (teclaCodigo == 37 && (anEvent.shiftKey || teclaChar != '%')) || (teclaCodigo == 39 && teclaChar != "'") || (teclaCodigo == 46 && teclaChar != '.')){
		return true;
	}else{
		if(!charExp.test(teclaChar)){
			return false;
		}else{
			return true;
		}
	}
}

/*------------------------------------------------------
	Data:			14/06/2007
	Funcionalidade:	Coloca máscara em um campo
------------------------------------------------------*/
function mascaraCampo(aField, aMask){
	var i = aField.value.length;
	var saida = aMask.substring(0,1);
	var texto = aMask.substring(i);

	if(texto.substring(0,1) != saida){
		aField.value += texto.substring(0,1);
	}
}