function set(alvo,valor)
{
	document.getElementById(alvo).value=valor;
}
function setSelect(selectId,value){
	var i, si, v, args=setSelect.arguments;
	if ((obj=document.getElementById(args[0])) != null){
		v = args[1];
		for(i=0; i<obj.length; i++){
			if(obj.options[i].value == v){
				si = i;
			}
		}
		obj.selectedIndex = si;
	}
}
function isNull(x)
{
	if(document.getElementById(x).value=="")
		return true;
	else
		return false;
}
function setFoco(alvo)
{
	document.getElementById(alvo).focus();
}
function getValue(x)
{
	return document.getElementById(x).value;
}
function getInt(x)
{
	x=document.getElementById(x).value;
	if(x=='')
		x='0';
	x=parseInt(x);
	return x;
}
function getRS(x)
{
	x=document.getElementById(x).value;
	if(x=='')
		x='0';
	x=x.replace(',','.');
	x=parseFloat(x);
	x=x*100;
	x=Math.round(x)/100;
	return x;
}
function getRSbr(x)
{
	x=document.getElementById(x).value;
	if(x=='')
		x='0';
	x=x.replace(',','.');
	x=parseFloat(x);
	x=x*100;
	x=Math.round(x)/100;
	x=x.replace('.',',');
	return x;
}
function val_cpf(numero) {
  dig_1 = 0;
  dig_2 = 0;
  controle_1 = 10;
  controle_2 = 11;
  lsucesso = 1;
  numero = numero.replace(".","");
  numero = numero.replace(".","");
  numero = numero.replace(".","");
  numero = numero.replace("-","");
  if (numero.length != 11) {
     return false;
  }
  else {
     for ( i=0 ; i < 9 ; i++) {
        dig_1 = dig_1 + parseInt(numero.substring(i, i+1) * controle_1);
          controle_1 = controle_1 - 1;
     }

     resto = dig_1 % 11;
     dig_1 = 11 - resto;
     if ((resto == 0) || (resto == 1)) {
          dig_1 = 0;
     }
     for ( i=0 ; i < 9 ; i++) {
          dig_2 = dig_2 + parseInt(numero.substring(i, i + 1) * controle_2);
        controle_2 = controle_2 - 1;
     }
     dig_2 = dig_2 + 2 * dig_1;
     resto = dig_2 % 11;
     dig_2 = 11 - resto;
     if ((resto == 0) || (resto == 1)) {
        dig_2 = 0;
     }
     dig_ver = (dig_1 * 10) + dig_2;
     if (dig_ver != parseFloat(numero.substring(numero.length-2,numero.length))) {
          return false;
        }
  }
return true;
}
function val_email(field) {
	if (field=="") {
  		return false;
  	}
	if ((field.indexOf("@") == -1) || (field.indexOf(".") == -1) || (field.indexOf(" ") != -1) || (field.length < 6)) {
   		return false;
   	} else {
   		return true;
   }
}