﻿// JScript File
$('document').ready(function() {
    $('#xg_head').each(function() {
        $this = $(this);
        this.style.width = "963px";
        this.style.margin = "0px 0px 0px -10px";
    });

    $('#xg').each(function() {
        $this = $(this);

        //Insert banner image on home page
        if (window.location == "http://barcelonabound.ning.com/" || window.location == "http://www.werefedup.com/" ||
            window.location == "http://werefedup.com/" || window.location == "http://www.werefedup.org/" || window.location == "http://werefeup.org/" ||
            window.location == "http://werefedup.ning.com/") {

            var bodydiv = document.getElementById("xg_navigation");
            var newdiv = document.createElement("div");
            newdiv.id = "NewRowSon";
            newdiv.style.width = "963px";
            //newdiv.style.border = "1px solid #000000";
            newdiv.style.height = "441px";
            newdiv.style.margin = "0px 0px 0px 0px";
            newdiv.style.padding = "0px 0px 0px 0px";
            newdiv.style.backgroundColor = "#000000";
            newdiv.innerHTML = "<img alt=\"\" width=\"963px\" margin-left=\"-10px\" height=\"441px\" src=\"http://www.sensisagency.com/yaao/yaao_ning_banner.jpg\" />";
            bodydiv.parentNode.insertBefore(newdiv, bodydiv);
        }

        var footerdiv = document.getElementById("xg_foot");
        if (footerdiv != null) {
            var belowtextdiv = document.createElement("div");
            belowtextdiv.id = "BelowFooter";
            belowtextdiv.style.backgroundColor = "transparent";
            belowtextdiv.style.margin = "0px -5px";
            belowtextdiv.style.width = "955px";
            belowtextdiv.style.fontSize = "8px";
            belowtextdiv.style.textAlign = "center";
            belowtextdiv.innerHTML = "<p style=\"padding-bottom:10px;font-size:8px;\"><br />\"This project was made possible by a grant from the Vitamin Cases Consumer Settlement Fund.  Created a a result of an antitrust class action, one of the purposes of the Fund is to imporve the health and nutrition of California Consumers\"</p>";
            footerdiv.parentNode.insertBefore(belowtextdiv, footerdiv.nextSibling);
        }

        //switch 
    });

    $('.xg_3col .xg_1col .xg_reset img').css("max-width", "304px");

    $('.xg_headline').each(function() {

        if (window.location.pathname != null) {

            if (window.location.pathname == "/page/chew-on-it" || window.location.pathname == "/page/chew-on-this") {
                $(this).css("display", "none");
            }
        }
    });

    $('.xg_module_body').each(function() {

        if (window.location.pathname != null) {

            if (window.location.pathname == "/") {
                $(this).css("padding", "0px");
            }
        }
    });

    //adjusts navigation links for non logged in users
    $('#xg_navigation').each(function() {
        $this = $(this);

        //looks for manage tab to identify an administrator
        var isadministrator = document.getElementById("xg_tab_manage");
        var isloggedin = document.getElementById("xg_tab_invite");
        var lis = this.getElementsByTagName("li");
        var i = 0;

        if (isloggedin != null) {
            //tab spacing is different for non administrators
            if (isadministrator == null) {
                while (i < lis.length) {
                    lis[i].style.padding = "0px 30px 0px 0px";
                    i++;
                }
            }
        }
        else {
            //increase tab spacing for unauthenicated users
            while (i < lis.length) {
                lis[i].style.padding = "0px 40px 0px 0px";
                i++;
            }
        }
    });

    $('.module_blog').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"101px\" margin-left=\"-10px\" height=\"24px\" src=\"http://www.sensisagency.com/yaao/title_blog_posts.gif\" />";

                }
            }
            i++;
        }
    });

    $('.module_members').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"81px\" margin-left=\"-10px\" height=\"22px\" src=\"http://www.sensisagency.com/yaao/title_members.gif\" />";

                }
            }
            i++;
        }
    });

    $('.xg_module_activity').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"143px\" margin-left=\"-10px\" height=\"22px\" src=\"http://www.sensisagency.com/yaao/title_latest_activity.gif\" />";

                }
            }
            i++;
        }
    });

    $('.module_forum').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"59px\" margin-left=\"-10px\" height=\"21px\" src=\"http://www.sensisagency.com/yaao/title_forum.gif\" />";

                }
            }
            i++;
        }
    });

    $('.module_groups').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"66px\" margin-left=\"-10px\" height=\"21px\" src=\"http://www.sensisagency.com/yaao/title_groups.gif\" />";

                }
            }
            i++;
        }
    });

    $('.module_photo').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"67px\" margin-left=\"-10px\" height=\"20px\" src=\"http://www.sensisagency.com/yaao/title_photos.gif\" />";

                }
            }
            i++;
        }
    });

    $('.module_video').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"58px\" margin-left=\"-10px\" height=\"23px\" src=\"http://www.sensisagency.com/yaao/title_videos.gif\" />";

                }
            }
            i++;
        }
    });

    $('.can_edit').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"55px\" margin-left=\"-10px\" height=\"20px\" src=\"http://www.sensisagency.com/yaao/title_badge.gif\" />";

                }
            }
            i++;
        }
    });
    $('.module_badge').each(function() {
        $this = $(this);
        var divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == 'xg_module_head') {
                var h2 = divs[i].getElementsByTagName("h2");
                if (h2.length > 0) {
                    h2[0].innerHTML = "<img alt=\"\" width=\"55px\" margin-left=\"-10px\" height=\"20px\" src=\"http://www.sensisagency.com/yaao/title_badge.gif\" />";

                }
            }
            i++;
        }
    });

    $('.xg_signup').each(function() {
        $this = $(this);
        var parray = this.getElementsByTagName("p");
        this.style.padding = "0px";
        this.style.border = "0px solid #000000";
        var img = "http://www.sensisagency.com/yaao/welcome_to.gif";
        if (parray.length > 0) {
            //parray[0].innerHTML = "<img alt=\"\" width=\"184px\" height=\"52px\" src=\""+img+" \">";
            parray[0].innerHTML = "<img alt=\"\" style=\"margin:0px 0px 0px 0px\" width=\"184px\" height=\"52px\" src=\"" + img + " \">";
        }
    });

    $('#xg_module_account').each(function() {
        $this = $(this);
        divs = this.getElementsByTagName("div");
        var i = 0;
        while (i < divs.length) {
            if (divs[i].className == "xg_module_head") {
                //divs[i].style.padding = "0px";
                divs[i].style.backgroundColor = "#000000";
                divs[i].className = "account_head";
            }
            i++;
        }
    });

    $('#xg_foot').each(function() {
        $this = $(this);
        ps = this.getElementsByTagName("p");
        var i = 0;
        while (i < ps.length) {
            if (ps[i].className == "left") {
                ps[i].innerHTML = "";
            }
            i++;
        }
        this.style.margin = "0px -10px 10px -10px";
        this.style.width = "955px";
    });

    $('#xn_bar_menu_branding').each(function() {
        $this = $(this);
        ps = this.getElementsByTagName("p");
        var i = 0;
        while (i < ps.length) {
            if (ps[i].id == "xn_brand" || ps[i].id == "xn_gyo_link") {
                ps[i].innerHTML = "";
            }
            i++;
        }
    });

    $('.module_about').each(function() {
        $this = $(this);
        this.style.display = "none";
    });

    $('.xg_ads').each(function() {
        $this = $(this);
        this.style.display = "none";
    });
});
   
