﻿function popupemail(event, strID, intX, intY) {

    var form = document.getElementById(strID);

    if (form.className == 'emailformon') {
        form.className = 'emailformoff';
    }
    else {
        form.className = 'emailformon';

        if (event == null) {
            form.style.top = intY + 'px';
            form.style.left = intX + 'px';
        } else {

            if (event.pageX) {
                form.style.top = event.pageY + 20 + "px";
                form.style.left = event.pageX + "px";
            }
            else {
                if (document.documentElement) {
                    form.style.top = document.documentElement.scrollTop + event.clientY + 20 + "px";
                    form.style.left = document.documentElement.scrollLeft + event.clientX + "px";
                }
                else {
                    form.style.top = document.body.scrollTop + event.clientY + 20 + "px";
                    form.style.left = document.body.scrollLeft + event.clientX + "px";
                }
            }

        }
    }

    if (event != null) {
        event.returnValue = false;
    }
}

function closeEmailBox(id, blnSaveCookie, strRef) {

    var form = document.getElementById(id);

    if (form != undefined) {
        form.className = 'emailformoff';
    }

    if (blnSaveCookie) {
        document.cookie = id + strRef + 'closed=true';
    }

}

function showMobileSiteOption() {
    if (Get_Cookie("mobilepopupshown") != "true") {
        Set_Cookie("mobilepopupshown", "true", 1);
        if (top.location.pathname == "/" || top.location.pathname == "/default.aspx" || top.location.pathname == null) {
            window.location = "http://attb.allthetopbananas.com/";
        } else if (confirm("Would you like to go to the mobile version of AllTheTopBananas?")) {
            window.location = "http://attb.allthetopbananas.com/";
        }
    }
}
