function WindowOpen(url, nome, width, height) {
  if (width == null)
    width = 400;
  if (height == null)
    heigth = 550;
    
  var w = window.open(url, nome, "resizable=no,copyhistory=no,toolbar=no,status=no,menubar=no,location=no,scrollbars=no,width=" + width + ",height=" + height + ",top=20,left=20");
  if (!w.opener)
    w.opener = self;
  
  w.focus();
}

function WindowOpenScroll(url, nome, width, height) {
  if (width == null)
    width = 400;
  if (height == null)
    heigth = 550;
    
  var w = window.open(url, nome, "resizable=no,copyhistory=no,toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,width=" + width + ",height=" + height + ",top=20,left=20");
  if (!w.opener)
    w.opener = self;
  
  w.focus();
}

function WindowOpenScrollMax(url, nome, width, height) {
  if (width == null)
    width = 400;
  if (height == null)
    heigth = 550;
    
  var w = window.open(url, nome, "resizable=yes,copyhistory=no,toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,width=" + width + ",height=" + height + ",top=10,left=5");
  if (!w.opener)
    w.opener = self;
  
  w.focus();
}

function WindowOpenFull(url, nome) {
  var w = window.open(url, nome, "");
  if (!w.opener)
    w.opener = self;
  
  w.focus();
}

function convert(s) {
	while (s.indexOf("&aacute;") >= 0)
		s = s.replace("&aacute;", "á");
	
	while (s.indexOf("&agrave;") >= 0)
		s = s.replace("&agrave;", "à");
	
	while (s.indexOf("&atilde;") >= 0)
	s = s.replace("&atilde;", "ã");
	                               
	
	while (s.indexOf("&eacute;") >= 0)
		s = s.replace("&eacute;", "é");
	
	while (s.indexOf("&ecirc;") >= 0)
		s = s.replace("&ecirc;", "ê"); 
			                           
	
	while (s.indexOf("&iacute;") >= 0)
		s = s.replace("&iacute;", "í");
	                               
	
	while (s.indexOf("&oacute;") >= 0)
		s = s.replace("&oacute;", "ó");
	
	while (s.indexOf("&ocirc;") >= 0)
		s = s.replace("&ocirc;", "ó"); 
	
	while (s.indexOf("&otilde;") >= 0)
		s = s.replace("&otilde;", "õ");
	                               
	
	while (s.indexOf("&uacute;") >= 0)
		s = s.replace("&uacute;", "ú");
	
	while (s.indexOf("&ccedil;") >= 0)
		s = s.replace("&ccedil;", "ç");
	                               
	
	while (s.indexOf("&Aacute;") >= 0)
		s = s.replace("&Aacute;", "Á");
	
	while (s.indexOf("&Agrave;") >= 0)
		s = s.replace("&Agrave;", "À");
	                               
	
	while (s.indexOf("&Eacute;") >= 0)
		s = s.replace("&Eacute;", "É");
	
	while (s.indexOf("&Oacute;") >= 0)
		s = s.replace("&Oacute;", "Ó");
	
	while (s.indexOf("&Uacute;") >= 0)
		s = s.replace("&Uacute;", "Ú");
	return s;
}

function loadScript(src, f) {
   var domscript = document.createElement('script');
   domscript.src = src;
   domscript.done = false;
   domscript.onload = function() {
      if (!domscript.done) {
         domscript.done = true;
         if (f) f();
      }
   };
   domscript.onreadystatechange = function() {
      if (!domscript.done && ('loaded' === domscript.readyState || 'complete' === domscript.readyState)) {
         domscript.done = true;
         if (f) f();
      }
   };
   var head = document.getElementsByTagName('head')[0];
   head.appendChild(domscript);
}

