<!--
function allLeft2Right() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listOri.length; i++) {
    var opcao = listOri.options[i];
    var novaOpcao = new Option(opcao.text, listDest.length);
    novaOpcao.value = opcao.value;
    listOri.remove(i);
    try {
      listDest.add(novaOpcao,null);
    } catch (e) {
      listDest.add(novaOpcao);
    }
    i--;
  }
}

function allRight2Left() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listDest.length; i++) {
    var opcao = listDest.options[i];
    var novaOpcao = new Option(opcao.text, listOri.length);
    novaOpcao.value = opcao.value;
    listDest.remove(i);
    try {
      listOri.add(novaOpcao,null);
    } catch (e) {
      listOri.add(novaOpcao);
    }
    i--;
  }
}

function left2Right() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listOri.length; i++) {
    var opcao = listOri.options[i];
    if(opcao.selected) {
      var novaOpcao = new Option(opcao.text, listDest.length);
      novaOpcao.value = opcao.value;
      listOri.remove(i);
      try {
        listDest.add(novaOpcao,null); //Firefox
      } catch(e) {
        listDest.add(novaOpcao); //IE
      }
      i--;
    }
  }
}

function right2Left() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listDest.length; i++) {
    var opcao = listDest.options[i];
    if(opcao.selected) {
      var novaOpcao = new Option(opcao.text, listOri.length);
      novaOpcao.value = opcao.value;
      listDest.remove(i);
      try {
        listOri.add(novaOpcao,null);
      } catch (e) {
        listOri.add(novaOpcao);
      }
      i--;
    }
  }
}


/** 
 * formata um campo do formulrio de 
 * acordo com a mscara informada... 
 *
 * Parmetros: 
 *  => 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 nmeros e o smbolo "!" para 
 *            qualquer caracter... 
 *  => evtKeyPress (evento);
 *
 * Uso..: <input type="textbox" name="xxx" 
 * onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);"> 
 * 
 * Observao: As mscaras podem ser representadas como os exemplos abaixo: 
 * CEP -> 99.999-999  
 * CPF -> 999.999.999-99 
 * RG -> 99.999.999-9
 * 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 
 * Inscrio Estadual -> 999.999.999-9999
 * C/C -> 999999-! 
 * E por a vai... 
 **/
function format(field, sMask, evtKeyPress) {

   var i;
   var nCount;
   var sValue;
   var fldLen;
   var mskLen;
   var bolMask;
   var sCod;
   var nTecla;

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

   sValue = field.value;

   // Limpa todos os caracteres de formatao 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( " ", "" );
   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) == "/") || (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++;
   }

   field.value = sCod;
   if (nTecla != 9 && nTecla != 8 && nTecla != 46)  {
       if (sMask.charAt(i-1) == "9")  // apenas nmeros...
	   {   return ((nTecla > 47) && (nTecla < 58)); // nmeros de 0 a 9
	   } 
       else { // qualquer caracter...
         return true;
       } 
   }
   else {
       return true;
   }
}

/**
 * 
 */
function number(event){
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	var caract = new RegExp(/^[0-9]+$/i);
	var caract = caract.test(String.fromCharCode(keyCode));

    if (keyCode != 9 && keyCode != 8 && keyCode != 46) // backspace
	if(!caract){
		keyCode=0;
		return false;
	}
}

/**
 * 
 */
function money(cur,len) {
	n='__0123456789';
	d=cur.value;
	l=d.length;
	r='';

	if (l > 0)
	{   z = d.substr(0,l-1);
		s = '';
		a = 2;

		for (i=0; i < l; i++)
		{
			c = d.charAt(i);
			if (n.indexOf(c) > a)
			{   a=1;
				s+=c;
			}
		}

		l = s.length;
		t = len-1;

		if (l > t)
		{   l = t;
			s = s.substr(0,t);
		}

		if (l > 2)
		{   r = s.substr(0,l-2)+','+s.substr(l-2,2);
		}
		else	
		{   if (l == 2)
			{	 r='0, '+s;
			}
			else
			{  if (l == 1)
				{   r = '0,0'+s;
				}
			}
		}

		if (r == '')
		{   r = '0,00';
		}
		else
		{   l = r.length;
			if (l > 6)
			{   j  = l%3;
				w  = r.substr(0,j);
				wa = r.substr(j,l-j-6);
				wb = r.substr(l-6,6);
				if (j > 0)
				{   w += '.';
				}
				k = (l-j)/3-2;

				for (i=0; i < k; i++)
				{	w += wa.substr(i*3,3)+'.';
				}

				r = w+wb;
			}
		}
	}

	if (r.length <= len)
	{   cur.value=r;
	}
	else
	{   cur.value=z;
	}

	return 'ok';
}

function confirmaExclusao() {
    if (!confirm('Caro(a) usuario, todos os dados deste registro serao excluidas.\n\n\ Confirma a exclusao deste registro?')) {
	     return false;
   	}
     return true;
}

function popup(url, w, h) {
    var lado = (screen.width - w) / 2;
    var topo = (screen.height - h) / 2;
    janela = window.open(url, 'Window', 'height='+h+', width='+w+', top='+topo+', left='+lado+', scrollbars=yes');		
	janela.focus();
}
-->