/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


 function chamaImg(elm){
        switch(elm){
            case 'b':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb.gif)";
                break;
           case 'b0':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb0.gif)";
                break;
            case 'b1':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb1.gif)";
                break;
            case 'b2':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb2.gif)";
                break;
            case 'b3':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb3.gif)";
                break;
            case 'b4':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb4.gif)";
                break;
            case 'b5':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb5.gif)";
                break;
            case 'b6':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/bb6.gif)";
                break;
        }
    }

    function voltaImg(elm){
        switch(elm){
            case 'b':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b.gif)";
                break;
            case 'b0':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b0.gif)";
                break;
            case 'b1':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b1.gif)";
                break;
            case 'b2':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b2.gif)";
                break;
            case 'b3':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b3.gif)";
                break;
            case 'b4':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b4.gif)";
                break;
            case 'b5':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b5.gif)";
                break;
            case 'b6':
                var elm = document.getElementById(elm);
                return elm.style.backgroundImage="url(images/b6.gif)";
                break;
        }
    }

    function data(){
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
myyear = mydate.getYear();
weekday= myweekday;

if(myday == 0)
day = " Domingo, "

else if(myday == 1)
day = " Segunda - Feira, "

else if(myday == 2)
day = " Terça - Feira, "

else if(myday == 3)
day = " Quarta - Feira, "

else if(myday == 4)
day = " Quinta - Feira, "

else if(myday == 5)
day = " Sexta - Feira, "

else if(myday == 6)
day = " Sábado, "

if(mymonth == 0)
month = "Janeiro "

else if(mymonth ==1)
month = "Fevereiro "

else if(mymonth ==2)
month = "Março "

else if(mymonth ==3)
month = "Abril "

else if(mymonth ==4)
month = "Maio "

else if(mymonth ==5)
month = "Junho "

else if(mymonth ==6)
month = "Julho "

else if(mymonth ==7)
month = "Agosto "

else if(mymonth ==8)
month = "Setembro "

else if(mymonth ==9)
month = "Outubro "

else if(mymonth ==10)
month = "Novembro "

else if(mymonth ==11)
month = "Dezembro "

document.write("<font face=arial, size=2>"+ day);
document.write(myweekday+" de "+month+ " de " +myyear+"</font>");
}

/* MSGi Tecnologia & Servicos
 * http://www.msgi.com.br
 *
 * Autor: Matheus Finotti
 *
 * Obs: Os créditos não pertencentes à MSGi estão declarados no cabeçalho de seu escopo
*/

/***
* Descrição.: formata um campo do formulário de
* acordo com a máscara informada...
* Parâmetros: - objForm (o Objeto Form)
* - strField (string contendo o nome
* do textbox)
* - sMask (mascara que define o
* formato que o dado será apresentado,
* usando o algarismo "9" para
* definir números e o símbolo "!" para
* qualquer caracter...
* - evtKeyPress (evento)
* Uso.......: <input type="textbox"
* name="xxx".....
* onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);">
* Observação: As máscaras podem ser representadas como os exemplos abaixo:
* CEP -> 99.999-999
* CPF -> 999.999.999-99
* CNPJ -> 99.999.999/9999-99
* Data -> 99/99/9999
* Tel Resid -> (99) 999-9999
* Tel Cel -> (99) 9999-9999
* Processo -> 99.999999999/999-99
* C/C -> 999999-!
* Exemplo1: onkeypress="return txtBoxFormat(document.Form, 'str_cep', '99.999-999', event)
* Exemplo2: onkeypress="return txtBoxFormat(document.Form, 'str_cpf', '999.999.999/99', event)
* Exemplo3: onkeypress="return txtBoxFormat(document.Form, 'str_data', '99/99/9999', event)
***/

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
      var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

      if(document.all) { // Internet Explorer
        nTecla = evtKeyPress.keyCode; }
      else if(document.getElementById) { // Nestcape
        nTecla = evtKeyPress.which;
      }

      sValue = objForm[strField].value;

      // Limpa todos os caracteres de formatação que
      // já estiverem no campo.
      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( " ", "" );
      sValue = sValue.toString().replace( " ", "" );
      fldLen = sValue.length;
      mskLen = sMask.length;

      i = 0;
      nCount = 0;
      sCod = "";
      mskLen = fldLen;

      while (i <= mskLen) {
        bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
        bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

        if (bolMask) {
          sCod += sMask.charAt(i);
          mskLen++; }
        else {
          sCod += sValue.charAt(nCount);
          nCount++;
        }

        i++;
      }

      objForm[strField].value = sCod;

      if (nTecla != 8) { // backspace
        if (sMask.charAt(i-1) == "9") { // apenas números...
          return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
        else { // qualquer caracter...
          return true;
        } }
      else {
        return true;
      }
    }
////////////////////////////////////////////////////////////////
//#################################Ver. E-Mail##############################################

function ver_email(nform) {
	if (nform.f_email.value == "") {
		alert("Informe seu e-mail.");
		nform.f_email.focus();
		nform.f_email.select();
		return false;
	} else {
		prim = nform.f_email.value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
		if(nform.f_email.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.f_email.value = "Digite Novamente";
			nform.f_email.focus();
			nform.f_email.select();
			return false;
		}
	}
		return true;
}

