var aLabelList = new Array()
var aErrorList = new Array()
var regEx = /^.+@.+\..{2,3}$/

function mOvr(src) { src.style.backgroundColor = "#FBE4E4"; if (mOvr.arguments.length == 2) src.style.cursor = mOvr.arguments[1] }
function mOut(src) { src.style.backgroundColor = "" }

function fgClearSpaces(sValue) {
    var sTemp = ""; sTemp = sValue.replace(/ /g, ""); return sTemp
}
function fgIsEmpty(sValue) {
    if (fgClearSpaces(sValue) == "") return true; return false
}
function fgFormValidate(oForm) {
    var iLabelCount = 0
    var sError = ""

    aLabelList.splice(0, aLabelList.length)
    aErrorList.splice(0, aErrorList.length)
        	
    feFormValidate(oForm)
        	
    if (aLabelList.length == 1)
        sError += "* O campo '" + aLabelList[0] + "' é obrigatório.\n"
    if (aLabelList.length > 1) {
        iLabelCount = 0
        sError += "* Os campos "
        for (i = 0; i < aLabelList.length; i++) {
            iLabelCount++
            sError += "'" + aLabelList[i] + "'"
            if (iLabelCount != aLabelList.length) 
                if (iLabelCount == (aLabelList.length - 1)) sError += " e "; else sError += ", " 
        }
        sError += " são obrigatórios.\n"
    }
    if (aErrorList.length > 0) {
        sError += "\n"
        for (i = 0; i < aErrorList.length; i++) sError += "* " + aErrorList[i] + "\n"
        sError = sError.substr(0, (sError.length - 1))
    }
    if (sError == "") { return true } else { alert(sError); return false }
}

function fgFocusInput(sInput,bSelect) {
    oInput = eval("document.forms[0]." + sInput)
    oInput.focus()
    if (bSelect) oInput.select()
}
function aparece(elemento,acao){
  if (acao == 'hidden') acao = 'none';
  if (acao == 'visible') acao = 'inline';  
  var elem = document.getElementById(elemento);
  elem.style.display = acao; 
}