function selectThis(e){
	window.getSelection().removeAllRanges();
	if (document.selection) {
	    var x = document.body.createTextRange();
	    x.moveToElementText(e);
	    x.select();
	} else if (window.getSelection) {
	    var x = document.createRange();
	    x.selectNode(e);
	    window.getSelection().addRange(x);
	}
}

function buildAppleScriptLink() {
	var txt = '';
	if (window.getSelection)
	 {
	    txt = window.getSelection();
	}
	 else if (document.getSelection)
	 {
	    txt = document.getSelection();
	}
	 else if (document.selection)
	 {
	    txt = document.selection.createRange().text;
	}
	 else return;
	window.open(("applescript://com.apple.scripteditor?action=new&script=" + escape(new String(txt)).replace(/\+/g,'%2B'))).close();

	window.getSelection().removeAllRanges();
}