function open_character_palette() {
  charWin = window.open('/characters','charWin', 'width=600,height=600,toolbar=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1');
}


function search_show_type_form(val) {
  $('.search_advanced.form').hide();
  $('.search_advanced.form.' + val).show();
}


function deobfuscate(str) {
  var letter_shifter = "2v~dsuAN<fqSOB-YIe71Qp:0 +a|&/kyo@}hVmEj!lgJM'64XZ#UF{Pb`z_5xc%>H.KTGD9^*ir?8CLWwtn=3R";
  str_out = ""
  for(i = 0; i < str.length; i++){
    c = letter_shifter.indexOf(str.charAt(i)) - i - 4
    while (c < 0) c += letter_shifter.length;
    //cc = letter_shifter.charCodeAt(c);
    str_out += letter_shifter.charAt(c);
  }
  return str_out;
}


/*----------------------------------------------------------------
  Handy thingie by Ariel Tapia, downloaded from
  http://www.codeproject.com/KB/miscctrl/JS_Inspect_Object.aspx
----------------------------------------------------------------*/

function inspect(obj, maxLevels, level)
{
  var str = '', type, msg;

    // Start Input Validations
    // Don't touch, we start iterating at level zero
    if(level == null)  level = 0;

    // At least you want to show the first level
    if(maxLevels == null) maxLevels = 1;
    if(maxLevels < 1)     
        return '<font color="red">Error: Levels number must be > 0</font>';

    // We start with a non null object
    if(obj == null)
    return '<font color="red">Error: Object <b>NULL</b></font>';
    // End Input Validations

    // Each Iteration must be indented
    str += '<ul>';

    // Start iterations for all objects in obj
    for(property in obj)
    {
      try
      {
          // Show "property" and "type property"
          type =  typeof(obj[property]);
          str += '<li>(' + type + ') ' + property + 
                 ( (obj[property]==null)?(': <b>null</b>'):('')) + '</li>';

          // We keep iterating if this property is an Object, non null
          // and we are inside the required number of levels
          if((type == 'object') && (obj[property] != null) && (level+1 < maxLevels))
          str += inspect(obj[property], maxLevels, level+1);
      }
      catch(err)
      {
        // Is there some properties in obj we can't access? Print it red.
        if(typeof(err) == 'string') msg = err;
        else if(err.message)        msg = err.message;
        else if(err.description)    msg = err.description;
        else                        msg = 'Unknown';

        str += '<li><font color="red">(Error) ' + property + ': ' + msg +'</font></li>';
      }
    }

      // Close indent
      str += '</ul>';

    return str;
}

