var menucate = 0;
function mostramenucate(){
   if (menucate ==0){
         document.getElementById('menucategorias').style.visibility = 'visible';
         document.getElementById('menucategorias').style.left = (findPosX(document.getElementById('bcate')))+'px';
         document.getElementById('menucategorias').style.top = (findPosY(document.getElementById('bcate')))+7+'px';
         menucate =1;
   }
}
function apagamenucate(){
 if (menucate ==1){
         document.getElementById('menucategorias').style.visibility = 'hidden';
         menucate =0;
 }
}

function apagamenucate(){

         document.getElementById('menucategorias').style.visibility = 'hidden';
         menucate =0;

}

function txt(str){
alert();
     document.getElementById("texto").value+=str;
}

function insert(aTag) {
  var eTag = '';
  var input = document.forms['formular'].elements['texto'];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}

function busca(onde, busca){
if (onde == 1)
   top.location = 'http://www.dicasdejogos.net.br/busca/tudo/' + busca + '/';
if (onde == 2)
   top.location = 'http://www.dicasdejogos.net.br/busca/dicas/' + busca + '/';
if (onde == 3)
   top.location = 'http://www.dicasdejogos.net.br/busca/review/' + busca + '/';
if (onde == 4)
   top.location = 'http://www.dicasdejogos.net.br/busca/preview/' + busca + '/';
if (onde == 5)
   top.location = 'http://www.dicasdejogos.net.br/busca.php?pal=' + busca;
if (onde == 6)
   top.location = 'http://www.dicasdejogos.net.br/shopping/busca/' + busca;
}


function buscaxml(valor){
	top.location = 'http://www.dicasdejogos.net.br/shopping/busca/' + valor ;
}

function jogue(valor){
	top.location = valor;
}

function buscadicas(valor){
	top.location = 'http://www.dicasdejogos.net.br/busca/dicas/' + valor + '';
}

function buscadetonados(valor){
	top.location = 'http://www.dicasdejogos.net.br/busca/detonados/' + valor + '';
}


function buscadicas2(valor){
	top.location = 'http://www.dicasdejogos.net.br/busca/detonados/' + valor + '-pag-1.htm';
}

function buscablog(valor){
	top.location = 'http://www.dicasdejogos.net.br/busca/blog/' + valor + '';
}


function vaiml(id, mlid, x){
alert
	top.location = 'http://www.dicasdejogos.net.br/vaiml.php?&id=' + id + '&mlid=' + mlid + '&x=' + x;
}


function buscadicas1(valor, valor1){
    if (valor1 == true)
       top.location = 'http://www.dicasdejogos.net.br/dicas.php?op=busca&inic=' + valor + '&tudo=sim';
    else
        top.location = 'http://www.dicasdejogos.net.br/busca/dicas/' + valor + '-pag-1.htm';
}


function buscajogos(valor){
 top.location = 'http://www.dicasdejogos.net.br/busca/review/' + valor + '';
}

function buscalancamentos(valor){
  top.location = 'http://www.dicasdejogos.net.br/busca/preview/' + valor + '';
}

function mfiltros(){
    document.getElementById('filtros').style.height = '50px';
}

function imgPopup(url)
{
  var imageWindow = window.open('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');

  html =   "<html><head><title></title>"
         + "<style>\n"
         + "body { margin: 0px; }\n"
         + "</style>\n"
         + "</head><body onload='window.resizeTo(document.image.width,document.image.height)'>"
         + "<img src=\"" + url + "\" border=\"0\" name=\"image\" />"
         + "</body></html>";

  //imageWindow = window.open('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');

  imageWindow.document.open();
  imageWindow.document.write(html);
  imageWindow.document.close();

  imageWindow.focus();
}


function folderPopup(url)
{
  var win = window.open(url, 'folder');
  win.focus();
}

function bordaabre(){
         document.write('<div id="be"><div id="bd">');
}

function bordafecha(){
         document.write('<div class="cbt"></div></div></div>');
}

function rodaabre(){
         document.write('<div id="frodac"><div id="frodae"><div id="frodad"><div id="aroda">');
}

function rodafecha(){
         document.write('</div></div></div></div>');
}


