function copyToClipboard(text) {
	var flashId = 'clipboard-scratch';
 
	/* Replace this with your clipboard.swf location */
	var clipboardSWF = '/flash/clipboard.swf';
 
	if (!document.getElementById(flashId)) {
		var div = document.createElement('div');
		div.id = flashId;
		document.body.appendChild(div);
	}
 
	document.getElementById(flashId).innerHTML = '';
	var content = '<embed src="' +
	clipboardSWF +
	'" FlashVars="clipboard=' + encodeURIComponent(text) +
	'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
 
	document.getElementById(flashId).innerHTML = content;
}

function copyLinkClicked(link, input_id, newLinkText) {
  copyToClipboard($(input_id).value); 
  $(input_id).select();
  oldLinkText = link.innerText;
  link.innerText = newLinkText;
  setTimeout(function() { link.innerText = oldLinkText }, 5000)
}