function getWindowHeight() {
    var windowHeight = 0;
    if (typeof (window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}

function setFooter() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        var windowWidth = getWindowWidth();
        if (windowHeight > 0) {
            var headerHeight = document.getElementById('TopHeader').offsetHeight;
            var contentHeight = document.getElementById('outerWrapper').offsetHeight;
            var footerElement = document.getElementById('JB_Footer').offsetHeight;
            var footerWidth = document.getElementById('JB_Footer').width;
            var myLeft = ((windowWidth/2) - (footerWidth/2) + 3);
            if (windowHeight - (footerHeight + headerHeight) >= 0) {
                footerElement.style.position = 'relative';
                footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
            }
            else {
                footerElement.style.position = 'static';
                footerElement.style.bottom = '0px';
                footerElement.style.left = myLeft + 'px';

            }
        }
    }

}

function ConfirmDelete() {
    return confirm("Are you sure you wish to permanently erase the selected item?");
}

function deleteIFrame() {

    //while ((el = document.getElementsByTagName('iframe')).length) {el[0].parentNode.removeChild(el[0]);}   

    var coll_iFrames = document.getElementsByTagName('iframe');
    var qty_iFrames = coll_iFrames.length;
    var i = 0;
    var strSrc = ' ';

    for (i = 0; i < qty_iFrames; i++) {
        strSrc = coll_iFrames[i].src
        //alert(strSrc.indexOf('alphagodaddy.com') + '  ' + strSrc);
        if (strSrc.indexOf('alphagodaddy.com') > -1) {
            //alert(strSrc.indexOf('alphagodaddy.com') + '  ' + strSrc);
            coll_iFrames[i].parentNode.removeChild(coll_iFrames[i])
            return;
        };
    }
}

function SelectFirstInput() {
    var bFound = false;
    for (f = 0; f < document.forms.length; f++) {
        // for each element in each form
        for (i = 0; i < document.forms[f].length; i++) {
            // if it's not a hidden element
            if (document.forms[f][i].type != "hidden") {
                // and it's not disabled
                if (document.forms[f][i].disabled != true) {
                    // set the focus to it
                    if (document.forms[f][i] != document.getElementById('q')) {
                        document.forms[f][i].focus();
                        var bFound = true;
                    }
                }
            }
            // if found in this element, stop looking
            if (bFound == true)
                break;
        }
        // if found in this form, stop looking
        if (bFound == true)
            break;
    }
}

