function dumpObj (obj, str) {
  msg = "";
  for (var i in obj) {
    if (typeof obj[i] == 'object') {
      msg += (str + i + " = object" + "\n");
      if (str.length < 20) { msg += dumpObj(obj[i], str + "  "); }
    } else {
      msg += (str + i + " = " + obj[i] + "\n");
    }
  }

  return msg;
}

function wurlIt (urlField) {
  var field = document.getElementById("urlField");

  if (field.value != "Enter URL") {
    try {
      $.getJSON(
	"/index.php",
	{ "format":"json", "url":escape(urlField) },
	function (data) {
	  $("#response").html(data).select();
          /*jQuery(document).keydown(function(e){
            if (e.charCode == 99 && e.ctrlKey) {
              // Try to inject contents into clipboard
              $("#response").select();
            }
          });*/
	}
      );
      
      document.getElementById("response").style.display = "block";
      document.getElementById("arrow").style.display = "block";
    } catch (err) {
      return true;
    }
  }  
  
  return false;
}

function gotTextFocus () {
  var field = document.getElementById("urlField");

  if (field.value == "Enter URL") {
    field.value = "";
    field.style.color = '#000000';
  }
}

function lostTextFocus () {
  var field = document.getElementById("urlField");

  if (field.value == "") {
    field.style.color = '#959595';
    field.value = "Enter URL";
  } 
}

