﻿function ShowRadToolTipImage(rttClientId, targetId, imgClientId, newSrc) {
    var img = document.getElementById(imgClientId);
    img.src = newSrc;
    ShowRadToolTip(rttClientId, targetId);
}


function ShowRadToolTipWithPostBack(rttClientId, targetId, postBackElement) {
    document.getElementById(postBackElement).click();
    //ShowRadToolTip(rttClientId, targetId);
}

var activeToolTip = null;
function ShowRadToolTip(rttClientId, targetId) {
    var radToolTip = $find(rttClientId);
    radToolTip.set_targetControlID(targetId);

    activeToolTip = rttClientId;
    radToolTip.show();
}

var currentWindow = null;
var showRadWindowCounter = 0;
function showRadWindow(clientID, url, title) {
    try {
        var radWindow = $find(clientID);
        hideRadWindow();
        if (url && url != '') {
            radWindow.setUrl(url);
        }

        if (title && title != '') {
            radWindow.set_title(title);
        }
        radWindow.show();
        currentWindow = radWindow;
        showRadWindowCounter = 0;
    }
    catch (e) {
        // $find noch nicht verfuegbar
        showRadWindowCounter++;
        if (showRadWindowCounter < 10) {
            currentTimeout = window.setTimeout('showRadWindow(\'' + clientID + '\', \'' + url + '\')', 100);
        }
    }
}

function DetectNEnter(e, btn) {
    var characterCode;
    if (e && e.which) {
        // NN4 specific code
        e = e;
        characterCode = e.which;
    }
    else {
        // IE specific code
        e = event
        characterCode = e.keyCode;
    }

    if (characterCode == 13) //// Enter key is 13
    {
        e.returnValue = false;
        e.cancelBubble = true;
        document.getElementById(btn).click();
    }
}
