var replaceText = "http://facebook.com/YourLink";

function inputBox() {
	var facebookID = document.getElementById('facebookID');
	if(facebookID.value=="Your ID"){ 
		facebookID.value = "";
	}
}

function updatefacebookCode(){
	var theForm = document.forms[0];
	var facebookID = "http://facebook.com/"+document.getElementById('facebookID').value;
	for(i=0; i<theForm.elements.length; i++){
		if(theForm.elements[i].type=="textarea"){
			theForm.elements[i].value = theForm.elements[i].value.replace(replaceText,facebookID);
		}
	}
	replaceText = facebookID;
}

function noenter() {
	if(window.event.keyCode==13){
		updatefacebookCode();
		window.event.keyCode =0;
	}
	return !(window.event && window.event.keyCode == 13); 
}

function copyText(theId) {
   var obj=document.getElementById(theId);
   obj.focus();
   obj.select();
   copyIntoClipboard(obj.value);
}

function copyIntoClipboard(text) {

        var flashId = 'flashId-HKxmj5';

        var clipboardSWF = '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;
    }
