function WinPopUpOpen(targetUrl, windowName, x, y, escala, scroll, tool, localiz, barramenu, barstatus)
  {
  var windowFeatures = "width=" + x + ", height=" + y + ", top=30, left=30, resizable=" + escala + ", scrollbars=" + scroll + ", toolbar=" + tool + ", location=" + localiz + ", menubar=" + barramenu + ", status=no";
  windowPesquisa = window.open(targetUrl, windowName, windowFeatures);
  windowPesquisa.focus();
  }

function VerificaCNPJ(num)
  {
  var numbers, multiplos, result, j, d, resto;
  for (com = 12; com <= 13; com++)
    {
    numbers = num.slice(0,com);
    multiplos = new Array(2,3,4,5,6,7,8,9);
    result = 0;
    j = 0;
    d = 0;
 
    for (i=numbers.length-1; i >= 0; i--)
      {
      if (j > 7)
        j = 0;
      result += eval(multiplos[j]+"*"+num.charAt(i));
      j++;
      }

    resto = result % 11;
    if (resto == 0 || resto == 1)
      d = 0;
    else
      d = 11 - resto;

    if (d != num.charAt(com) || num == '00000000000000')
      return false;
	}

  return true;
  }
