function textboxControlFocus(obj, val) {
    if (obj.value == val)
        obj.value = "";
    
}
function textboxControlBlur(obj, val) {
    if (obj.value == "")
        obj.value = val;    
}

function disableSubmitForStationLocator(e)
{
     var key;

     if(window.event)
        key = window.event.keyCode;
     else
        key = e.which;

     if(key == 13) {
        stationLocator(document.getElementById('location').value);
        return false;
     }
     else
        return true;
}
function stationLocator(location) {
    openPopup('/site/StationLocator/station_locator.aspx?location=' + location, 'sl', 'no', 'no', 'no', 'yes', 'no', 'no', 100, 100, 450, 500);
}

function cmsSearch(e)
{
     var key;

     if(window.event)
        key = window.event.keyCode;
     else
        key = e.which;

     if(key == 13) {
        beginSearch();
        return false;
     }
     else
        return true;
}
function beginSearch() {
    window.location = '/site/google.aspx?q=' + document.getElementById('ecmsearchtext').value;
    //window.location = '/site/search.aspx?ecmsearchtext=' + document.getElementById('ecmsearchtext').value;
    //window.location = '/site/search_v2.aspx?search=' + document.getElementById('ecmsearchtext').value;
}
function disableSubmitForDevoSignUp(e, email)
{
     var key;

     if(window.event)
        key = window.event.keyCode;
     else
        key = e.which;

     if(key == 13) {
        dailyDevoSignup(email);
        return false;
     }
     else
        return true;
}
function dailyDevoSignup(email) {
    window.location = "/shop/email_devotional_signup.aspx?email=" + email;
}
function openPopup(url, windowName, tool, menu, loc, scroll, resize, status, left, top, width, height) {
    var winHeight = height;
    if (winHeight < 150)
        winHeight = 150;
    OpenWin = this.open(url, windowName, "toolbar=" + tool + ",menubar=" + menu + ",location=" + loc + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=" + status + ",left=" + left + ",top=" + top + ",width=" + width + ",height=" + winHeight);
}
function videoPopup(video, width, height) {
    openPopup("/site/video2.aspx?file=" + video + "&width=" + width + "&height=" + height, "videoplayer", "no", "no", "no", "no", "no", "no", 100, 100, width, height);
}
function videoPopup2(i, tbid) {
    openPopup("/site/video3.aspx?i=" + i + "&tbid=" + tbid, "videoplayer2", "no", "no", "no", "no", "no", "no", 100, 100, 436, 348);
}
function lookinsidePopup(page) {
    openPopup("/site/lookinside/" + page, "leestrobel", "no", "no", "no", "yes", "yes", "no", 0, 0, 1040, 772)
}
function kytePlayer(width, height, i, tbid) {
    openPopup("/site/kyte.aspx?width=" + width + "&height=" + height + "&i=" + i + "&tbid=" + tbid, "kyte_player", "no", "no", "no", "no", "no", "no", 0, 0, width, height)
}
function openRadioPlayer(id) {
    openPopup("/site/radio_player.aspx?id=" + id, "radio_player", "no", "no", "no", "no", "no", "no", 100, 100, 851, 395)
}
function openTVPlayer(id) {
    openPopup("/site/television_player.aspx?id=" + id, "television_player", "no", "no", "no", "no", "no", "no", 100, 100, 878, 410)
}
function hideAdminMenu() {
    $("#admin_menu").hide(300, function() { $("#admin_menu_hidden").show(); });
    sendAdminMenuStatusToServer("hide");
}
function showAdminMenu() {
    $("#admin_menu_hidden").hide();
    $("#admin_menu").show(300);
    sendAdminMenuStatusToServer("show");
}
function sendAdminMenuStatusToServer(status) {
    var xmlHttp;
    try { xmlHttp = new XMLHttpRequest(); }
    catch (e) {  // Internet Explorer 
        try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");   }
        catch (e) {try {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch (e) {alert("Your browser does not support AJAX!");return false;}} 
    }
    
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            //xmlHttp.responseText;
        }
    }
    
    xmlHttp.open("post", "/site/admin_utilities/AdminMenuAjaxApi.aspx?action=" + status, true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    xmlHttp.send(""); 
} 
function downloadFile(filePath, contentType) {
    document.getElementById("download_frame").src = "/site/download.aspx?file=" + filePath + "&content_type=" + contentType;
}
function preloadImage(imageName) {
    var image = new Image();
    image.src = imageName;
}
function foxVideo() {
    openPopup("/site/fox_video.aspx", "fox_video", "no", "no", "no", "no", "no", "no", 100, 100, 400, 249) 
}
function glennBeckVideo() {
    openPopup("/site/video_glenn_beck.aspx", "video_glenn_beck", "no", "no", "no", "no", "no", "no", 100, 100, 320, 384) 
}
function videoCustom(videoCustom) {
    if (videoCustom == 'marcus')
            openPopup("/site/video_custom.aspx", "video_custom", "no", "no", "no", "no", "no", "no", 100, 100, 416, 360) 
}
function kytePlayer2(width, height, video) {
    openPopup("/site/kyte3.aspx?video=" + video, "kyte_player", "no", "no", "no", "no", "no", "no", 0, 0, width, height)
}
function kytePlayer3(width, height, vars) {
    openPopup("/site/kyte.aspx?" + vars, "kyte_player", "no", "no", "no", "no", "no", "no", 50, 50, width, height)
}
function kenDavisVideo(s, tbid) {
    openPopup("/site/kyte3.aspx?video=ken&s=" + s + "&tbid=" + tbid, "kyte_player", "no", "no", "no", "no", "no", "no", 0, 0, 500, 313)
}
function applyRolloverImageEventHandlers() {
    try {
        $("img.rollover_image").mouseover(function () {
            $(this).attr("src", $(this).attr("src").replace(".", "_ro."));
        });
        $("img.rollover_image").mouseout(function () {
            $(this).attr("src", $(this).attr("src").replace("_ro.", "."));
        });
    }
    catch (ex) {

    }
}
function site_init() {
    applyRolloverImageEventHandlers();
}
var widgetFormCallbackFunction = "";

function openVeriSignPopup() {
    openPopup("https://trustsealinfo.verisign.com/splash?form_file=fdf/splash.fdf&dn=www.davidjeremiah.org&lang=en", "verisign", "no", "no", "no", "no", "no", "no", 100, 100, 515, 475)
}

function mediaPlayer(mediaURL, width, height) {
    var audioStr = "";
    var isAudio = false;
    if (mediaURL.indexOf("mp3") > -1) isAudio = true;
    if (isAudio === true)
        audioStr = "isAudio=true&";
    openPopup("/site/media_player.aspx?" + audioStr + "width=" + width + "&height=" + height + "&url=" + escape(mediaURL), "media_player", "no", "no", "no", "no", "no", "no", 50, 50, width, height)
}
