﻿function itwPopwinFix(strURL, width, height) {
    var iWidth = 640;
    var iHeight = 480;

    if (width != null) {
        iWidth = width;
    }

    if (height != null) {
        iHeight = height;
    }

    window.open(strURL, "", "width=" + iWidth + ",height=" + iHeight + ",resizable=no,scrollbars=no,menubar=no,location=no,toolbar=no,status=no")
}


function hacms_preloadImages() {
    var d = document;
    if (d.images) {
        if (!d.hacms_p) d.hacms_p = new Array();
        var i, j = d.hacms_p.length, a = hacms_preloadImages.arguments;
        for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) {
            d.hacms_p[j] = new Image; d.hacms_p[j++].src = a[i];
        }
    }
}


function hacms_findObj(n, d) {
    var p, i, x;
    if (!d) d = document;
    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document;
        n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n];
    for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = hacms_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n);
    return x;
}


function itwKeyDown(oEvent, oElement, strTextBox, strEventTarget, btype) {
    if ((itwKeyCode(oEvent) == 13)) {
        var isNotEmpty = (oElement.value) ? true : false;

        if (!isNotEmpty) {
            alert('Geben Sie bitte einen Suchbegriff ein!');
        }
        else {
            
            if (btype == 'S') {
                ctl00_lcbSearch.click();
            }
            else if (btype == 'R') {
                ctl00_masterPlace_lcbSearch2.click();
            }
        }
    }
}


function itwKeyCode(oEvent) {
    var isIe4 = (document.all) ? true : false;
    var isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > 0;
    var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > 0;

    var oCode;

    if (!oEvent) {
        oEvent = window.event;
    }

    if (oEvent.keyCode) {
        oCode = oEvent.keyCode;
    }
    else if (oEvent.which) {
        oCode = oEvent.which;
    }

    if (oCode) {
        if (isSafari && oCode == 3) {
            oCode = 13;
        }

        if (isIe4 && oCode == 0) {
            oCode = 13;
        }
    }
    return oCode;
}


