﻿$(document).ready(function() {
    $(document).bind("keydown", function(event) {
        if (event.ctrlKey) {
            var link = null;
            var href = null;
            switch (event.keyCode ? event.keyCode : event.which ? event.which : null) {
                case 0xD:
                    $(".remarkText", "#remark").attr("value", getSelText());
                    $(".remarkComment", "#remark").attr("value", "");
                    $("#remark").show();
                    $(".remarkComment", "#remark")[0].focus();
                    break;
            }
        }
    });
    $("#remarkClose").bind("click", function() {
        $("#remark").hide()
    });
});
function getSelText() {
    var txt = '';
    if (window.getSelection) {
        txt = window.getSelection();
    }
    else if (document.getSelection) {
        txt = document.getSelection();
    }
    else if (document.selection) {
        txt = document.selection.createRange().text;
    }
    return txt;
}
