function tog(thiz) {
  var mais_info = thiz.up().down('.mais_info');

  if (mais_info) {
    thiz.up().down('.mais_info').className = 'show';
  } else {
    thiz.up().down('.show').className = 'mais_info';
  }
}

function dados_do_cliente(id) {
  if ( $(id).childNodes.length > 0 ) {
    $(id).toggle();
    return true;
  }

  return false;
}

function pesquisar_pdas(cidade, ramo) {
  cidade = cidade.value.split(' - ');
  href = '/' + cidade[1] + '/' + cidade[0] + '/ramos/' + ramo;
  window.location.href = urlize(href);
  return false;
}
function removeAccents(strAccents){
  strAccents = strAccents.split('');
  strAccentsOut = new Array();
  strAccentsLen = strAccents.length;
  var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
  var accentsOut = ['A','A','A','A','A','A','a','a','a','a','a','a','O','O','O','O','O','O','O','o','o','o','o','o','o','E','E','E','E','e','e','e','e','e','C','c','D','I','I','I','I','i','i','i','i','U','U','U','U','u','u','u','u','N','n','S','s','Y','y','y','Z','z'];
  for (var y = 0; y < strAccentsLen; y++) {
    if (accents.indexOf(strAccents[y]) != -1) {
      strAccentsOut[y] = accentsOut[accents.indexOf(strAccents[y])];
    }
    else
      strAccentsOut[y] = strAccents[y];
  }
  strAccentsOut = strAccentsOut.join('');
  return strAccentsOut;
}

function urlize(str) {
  return removeAccents(str.toLowerCase()).gsub(" ", "_");
};

function remover_acentos(texto){
    texto = texto.replace(new RegExp('[á|à|ã|â|ä|ª]'), 'a');
    texto = texto.replace(new RegExp('(é|è|ê|ë)'), 'e');
    texto = texto.replace(new RegExp('(í|ì|î|ï)'), 'i');
    texto = texto.replace(new RegExp('(ó|ò|õ|ô|ö|º)'), 'o');
    texto = texto.replace(new RegExp('(ú|ù|û|ü)'), 'u');
    texto = texto.replace(new RegExp('(Á|À|Ã|Â|Ä)'), 'A');
    texto = texto.replace(new RegExp('(É|È|Ê|Ë)'), 'E');
    texto = texto.replace(new RegExp('(Í|Ì|Î|Ï)'), 'I');
    texto = texto.replace(new RegExp('(Ó|Ò|Õ|Ô|Ö)'), 'O');
    texto = texto.replace(new RegExp('(Ú|Ù|Û|Ü)'), 'U');
    texto = texto.replace(new RegExp('ñ'), 'n').replace(new RegExp('Ñ'), 'N');
    texto = texto.replace(new RegExp('ç'), 'c').replace(new RegExp('Ç'), 'C');
    texto = texto.replace(new RegExp("(\\.|\\-|\\+|')"), ' ');
    texto = texto.replace(new RegExp('[´¨°]'), '').replace(new RegExp('\/'),"-");
    texto = texto.replace(new RegExp(';'),'');
    return texto;
};