var clip = null;
function init() {
  clip = new ZeroClipboard.Client();
  clip.addEventListener('mouseOver', mo);
  clip.glue( 'copy' );
}
function mo(client) {
  clip.setText( document.getElementById('shortened').innerHTML );
}
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function valid() {
  var m = new RegExp();
  m.compile("^((ht|f)tps?://)?[^\f\n\r\t\v\u00A0\u2028\u2029]{4,}$");
  var u=document.minify.u.value;
  u = trim(u);
  if (m.test(u)) {
    return true;
  } else {
    window.alert("Invalid URL. Please try again.");
    return false;
  }
}
