function popPage(url, id, w, h) {
   window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h).focus();
}

function showTerms() {
   popPage('/blog/static/termos_uso.html', 't_uso', 350, 400);
}


function ge(id) {
   return document.getElementById(id);
}

function geraCodigo() {
   var sty=ge('divPreview').style;
   sty.fontFamily = ge('nFonte').value;
   sty.fontSize = ge('nTamanho').value;
   sty.fontWeight = ge('nNegrito').checked ? 'bold' : 'normal';
   sty.fontStyle = ge('nItalico').checked ? 'italic' : '';
   sty.textDecoration = ge('nTD').checked ? 'underline' : 'none';
   sty.color = ge('nCor').value;

   if (ge('nEndereco').value=='') return;

   var estilo = "style='";

   estilo += ge('nFonte').value != '' ? 'font-family:' + ge('nFonte').value + ';' : '';
   estilo += ge('nTamanho').value != '' ? 'font-size:' + ge('nTamanho').value + ';' : '';
   estilo += ge('nNegrito').checked != '' ? 'font-weight:bold;' : '';
   estilo += ge('nItalico').checked != '' ? 'font-style:italic;' : '';
   estilo += ge('nTD').checked ? 'text-decoration: underline;' : 'text-decoration:none;';
   estilo += ge('nCor').value != '' ? 'color:' + ge('nCor').value : '';

   estilo += "'";
   ge('taCodigo').value =
   "<!-- INICIO CONTADOR -->\n" +
   "<" + "a href='http://www.blogutils.net/olct/' id='lnolt_' target='_blank' " + estilo + ">\n" +
   "<s" + "cript language='JavaScript' src='http://blogutils.net/olct/online.php?site=" + ge('nEndereco').value + "&interval=600'><" + "/script><" + "/a>" +
   "<" + "a href='http://www.blogutils.net/' target='_blank' " + estilo + "> online</" + "a>\n" +
   "<!-- FIM CONTADOR -->\n";
}

function checaCampos() {
   if (ge('nEndereco').value=='') {
      alert('Preencha o campo endere&ccedil;o do seu site.\nSem ele o contador n&atilde;o funcionar&aacute; corretamente');
      ge('nEndereco').focus();
      return false;
   }

   return true;
}

function doTextarea() {
   document.write("<textarea cols=70 rows=8 style='font-size: 10px;' id='taCodigo' onclick='if (checaCampos()) { geraCodigo(); this.select(); }'></textarea>");
}

