//function displayRemainingCharacterCount(element, span) {
//    //alert(element.value.length);
//   


//}

function displayRemainingCharactersCount(event) {
    if (event.keyCode == '13') {
        event.preventDefault();
    }
    if (event.shiftKey)
        return;

    $("#remainingCharacters").text(160 - parseInt($(event.target).val().length, 10));
}

var dialog;

function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}

function getWindow() {
    // #Window is a jQuery selector based on the "id" attribute of the editor. The id is set using the Name() method.
    var window = $("#Window").data("tWindow");
    return window;
}
function openClickThroughDialog() {
    getWindow().show();

}
function Window_onError() {
    var window = $(this).data('tWindow'); // $(this) is equivalent of $('#Window')
    // Use the window client object
    alert("error " + window);
}

var dialog;

function confirmSubmit(message) {
    if (!dialog) {
        dialog = $.telerik.window.create({
            title: "Title",
            contentUrl: "http://www.google.com",
            modal: true,
            resizable: true,
            draggable: true,
            visible: false
        }).data('tWindow');
    }

    dialog.center().open();
}
