Javascript 为什么我的头衔比应该的长3倍?

Javascript 为什么我的头衔比应该的长3倍?,javascript,jquery,ruby-on-rails,title,Javascript,Jquery,Ruby On Rails,Title,这是我的 这些标题适用于 注意:我正在为此使用 var seg2 = ''; if (url.segment(2) == 'college-life') seg2 = "College Life"; else if (url.segment(2) == 'academics') seg2 = "Academics"; else if (url.segment(2) == 'living-environment') seg2 = "Living Environment";

这是我的

这些标题适用于

注意:我正在为此使用

var seg2 = '';
if (url.segment(2) == 'college-life')
    seg2 = "College Life";
else if (url.segment(2) == 'academics')
    seg2 = "Academics";
else if (url.segment(2) == 'living-environment')
    seg2 = "Living Environment";
else if (url.segment(2) == 'social-life')
    seg2 = "Social Life";
var title = "About College";
if (seg2 != '')
    title += " | " + seg2;
if ($("#question_sub").text() != '')
    title += " | " + $("#question_sub").text();
document.title = title;
但不是普通的

此外,由于弄乱了标题,主页的jquery不知何故停止了工作。
此外,我试图将seg3资本化的尝试似乎不起作用

这里是
college_pages.js
(减去一些重复):

$(文档).ready(函数(){
url=$.url();
$(“#学术#环境#导航,#社会#生活#导航,#问题,#部分,#专业#列表,#分层”).hide();
如果(url.segment(1)=‘关于学院’){
$(“#建议导航”).show();
$(“#建议”).css(“字体重量”、“粗体”);
$(“建议”).css(“颜色”、“蓝色”);
if(url.segment(3)=‘做所有你想做的事情都难吗’)
$(“#问题"sub”).text(‘你想做的事情都难吗?(例如,学业、研究、志愿活动、俱乐部、锻炼、运动、爱好、朋友、私人时间、睡眠)处理这些事情的提示/建议?);
如果(url.segment(3)=“在大学里生育更容易吗”)
$(“#问题_sub”).text(‘在大学里拖延是否更容易,因为你经常和朋友住在一起,并且有更多的自由去做你想做的事?这对大多数孩子有什么影响?如何处理它的提示/建议?’);
如果(url.segment(3)=‘有什么样的学校传统’)
$(“#问题"sub”).text(‘有什么样的学校传统?它们有趣还是愚蠢?’);
var seg2='';
如果(url.segment(2)=“大学生活”)
seg2=“大学生活”;
else if(url.segment(2)=“学术界”)
seg2=“学术界”;
else if(url.segment(2)=‘生活环境’)
seg2=“生活环境”;
else if(url.segment(2)=‘社交生活’)
seg2=“社会生活”;
var title=“关于学院”;
如果(seg2!='')
标题+=“|”+seg2;
如果($(“#问题_sub”).text()!=”)
title+=“|”+$(“#问题_sub”).text();
document.title=标题;
$(“#建议”)。单击(函数(){
$(“.questions、.sections、#question_sub、#discuss_thread”).hide()
$(“.about_college_nav_item:not(#advice)”).css(“字体重量”,“正常”);
$(“#建议”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#advice)”).css(“颜色”、“黑色”);
$(“建议”).css(“颜色”、“蓝色”);
$(“#建议导航”).show();
});
$(“#应用”)。单击(函数(){
$(“.questions、.sections、#question_sub、#discuss_thread”).hide()
$(“.about_college_nav_item:not(#application)”).css(“字体重量”,“正常”);
$(“#应用”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#application)”).css(“color”,“black”);
$(“#应用”).css(“颜色”、“蓝色”);
$(“#应用导航”).show();
});
$(“#大学生活”)。单击(函数(){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#college_life)”).css(“字体重量”,“正常”);
$(“大学生活”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#college_life)”).css(“颜色”、“黑色”);
$(“大学生活”).css(“颜色”、“蓝色”);
$(“大学生活导航问题”).show();
});
如果(url.segment(2)=“大学生活”){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#college_life)”).css(“字体重量”,“正常”);
$(“大学生活”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#college_life)”).css(“颜色”、“黑色”);
$(“大学生活”).css(“颜色”、“蓝色”);
$(“大学生活导航问题”).show();
}
$(“#学术”)。单击(函数(){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#academics)”).css(“字体重量”,“正常”);
$(“#学术”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#academics)”).css(“color”,“black”);
$(“#学术”).css(“颜色”、“蓝色”);
$(“关于学术问题”).show();
});
如果(url.segment(2)=“学术界”){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#academics)”).css(“字体重量”,“正常”);
$(“#学术”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#academics)”).css(“color”,“black”);
$(“#学术”).css(“颜色”、“蓝色”);
$(“关于学术问题”).show();
}
$(“#生活环境”)。单击(函数(){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#living_environment)”).css(“字体重量”、“正常”);
$(“#生活环境”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#living_environment)”).css(“颜色”、“黑色”);
$(“生活环境”).css(“颜色”、“蓝色”);
$(“关于生活环境导航问题”).show();
});
如果(url.segment(2)=“生活环境”){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#living_environment)”).css(“字体重量”、“正常”);
$(“#生活环境”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item:not(#living_environment)”).css(“颜色”、“黑色”);
$(“生活环境”).css(“颜色”、“蓝色”);
$(“关于生活环境导航问题”).show();
}
$(“#社交生活”)。单击(函数(){
$(“.questions,.sections”).hide()
$(“.about_college_nav_item:not(#social_life)”).css(“字体重量”,“正常”);
$(“社交生活”).css(“字体重量”、“粗体”);
$(“.about_college_nav_item
var seg2 = '';
if (url.segment(2) == 'academics')
    seg2 = "Academics";
else if (url.segment(2) == 'living-environment')
    seg2 = "Living Environment";
else if (url.segment(2) == 'social-life')
    seg2 = "Social Life";
var title = document.title;
if (seg2 != '')
    title += " | " + seg2;
var seg3 = url.segment(3);
seg3[0].toUpperCase();
seg3.slice(1);
title += " | " + seg3;
if ($("#question_sub").text() != '')
    title += " | " + $("#question_sub").text();
document.title = title;
$(document).ready(function(){   
    url = $.url();

    $("#academics_nav, #living_environment_nav, #social_life_nav, .questions, .sections, #major_list, .stratify").hide();
    if (url.segment(1) == 'about-college') {
        $("#advice_nav").show();
        $("#advice").css("font-weight", "bold");
        $("#advice").css("color", "blue");

        if (url.segment(3) == 'is-it-hard-to-do-all-the-things-you-want-to-do')
            $("#question_sub").text('Is it hard to do all the things you want to do? (ex. schoolwork, research, volunteering, clubs, exercise, sports, hobbies, friends, personal time, sleep) Tips/advice on handling it?');
        if (url.segment(3) == 'is-it-easier-to-procrastrinate-in-college')
            $("#question_sub").text('Is it easier to procrastinate in college, being that you often live with your friends, and have more freedom to do what you want? How does this effect most kids? Tips/advice on handling it?');
        if (url.segment(3) == 'what-kinds-of-school-traditions-are-there')
            $("#question_sub").text('What kinds of school traditions are there? Are they fun or stupid?');

        var seg2 = '';
        if (url.segment(2) == 'college-life')
            seg2 = "College Life";
        else if (url.segment(2) == 'academics')
            seg2 = "Academics";
        else if (url.segment(2) == 'living-environment')
            seg2 = "Living Environment";
        else if (url.segment(2) == 'social-life')
            seg2 = "Social Life";
        var title = "About College";
        if (seg2 != '')
            title += " | " + seg2;
        if ($("#question_sub").text() != '')
            title += " | " + $("#question_sub").text();
        document.title = title;

        $("#advice").click(function() {
            $(".questions, .sections, #question_sub, #disqus_thread").hide()
            $(".about_college_nav_item:not(#advice)").css("font-weight", "normal");
            $("#advice").css("font-weight", "bold");
            $(".about_college_nav_item:not(#advice)").css("color", "black");
            $("#advice").css("color", "blue");
            $("#advice_nav").show();
        });
        $("#applying").click(function() {
            $(".questions, .sections, #question_sub, #disqus_thread").hide()
            $(".about_college_nav_item:not(#applying)").css("font-weight", "normal");
            $("#applying").css("font-weight", "bold");
            $(".about_college_nav_item:not(#applying)").css("color", "black");
            $("#applying").css("color", "blue");
            $("#applying_nav").show();
        });
        $("#college_life").click(function() {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#college_life)").css("font-weight", "normal");
            $("#college_life").css("font-weight", "bold");
            $(".about_college_nav_item:not(#college_life)").css("color", "black");
            $("#college_life").css("color", "blue");
            $("#college_life_nav .questions").show();
        });
        if (url.segment(2) == 'college-life') {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#college_life)").css("font-weight", "normal");
            $("#college_life").css("font-weight", "bold");
            $(".about_college_nav_item:not(#college_life)").css("color", "black");
            $("#college_life").css("color", "blue");
            $("#college_life_nav .questions").show();
        }
        $("#academics").click(function() {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#academics)").css("font-weight", "normal");
            $("#academics").css("font-weight", "bold");
            $(".about_college_nav_item:not(#academics)").css("color", "black");
            $("#academics").css("color", "blue");
            $("#about_academics_nav .questions").show();
        });
        if (url.segment(2) == 'academics') {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#academics)").css("font-weight", "normal");
            $("#academics").css("font-weight", "bold");
            $(".about_college_nav_item:not(#academics)").css("color", "black");
            $("#academics").css("color", "blue");
            $("#about_academics_nav .questions").show();
        }
        $("#living_environment").click(function() {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#living_environment)").css("font-weight", "normal");
            $("#living_environment").css("font-weight", "bold");
            $(".about_college_nav_item:not(#living_environment)").css("color", "black");
            $("#living_environment").css("color", "blue");
            $("#about_living_environment_nav .questions").show();
        });
        if (url.segment(2) == 'living-environment') {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#living_environment)").css("font-weight", "normal");
            $("#living_environment").css("font-weight", "bold");
            $(".about_college_nav_item:not(#living_environment)").css("color", "black");
            $("#living_environment").css("color", "blue");
            $("#about_living_environment_nav .questions").show();
        }
        $("#social_life").click(function() {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#social_life)").css("font-weight", "normal");
            $("#social_life").css("font-weight", "bold");
            $(".about_college_nav_item:not(#social_life)").css("color", "black");
            $("#social_life").css("color", "blue");
            $("#about_social_life_nav .questions").show();
        });
        if (url.segment(2) == 'social-life') {
            $(".questions, .sections").hide()
            $(".about_college_nav_item:not(#social_life)").css("font-weight", "normal");
            $("#social_life").css("font-weight", "bold");
            $(".about_college_nav_item:not(#social_life)").css("color", "black");
            $("#social_life").css("color", "blue");
            $("#about_social_life_nav .questions").show();
        }
    }
    else {
        if (url.segment().length < 2) {
            $("#academics_nav").show();
            $("#academics").css("font-weight", "bold");
            $("#academics").css("color", "blue");
            $("#classes").css("font-style", "italic");
            $("#classes").css("color", "#6666FF");
            $(".questions_header").text("Classes");
            $("#classes_nav .questions").show();
        }

        if (url.segment(4) == 'do-professors-explain-things-clearly-are-professors-interesting') {
            $("#question_sub").text('Do they make things easy to understand? Do they make you want to go to class? Do they make you more or less interested in the subject?');
            $(".stratify").show();
        }
        if (url.segment(4) == 'are-professors-fair') {
            $("#question_sub").text('Are they fair? strict? (think tests, assignments, rules...)');
            $(".stratify").show();
        }
        if (url.segment(4) == 'how-hot-are-the-girls-is-it-easy-to-hook-up-if-youre-a-guy')
            $("#question_sub").text('How hot are the girls? Is it easy to hook up if you’re a guy?');
        if (url.segment(4) == 'how-hot-are-the-guys-is-it-easy-to-hook-up-if-youre-a-girl')
            $("#question_sub").text('How hot are the boys? Is it easy to hook up if you’re a girl? (I know... that shouldn’t even be a question).');
        if (url.segment(4) == 'how-often-to-people-smoke-weed')
            $("#question_sub").text('How often do people smoke weed? What about other drugs?');

        $("#academics").click(function() {
            $("#living_environment_nav, #social_life_nav").hide();
            $(".main_college_nav_item:not(#academics)").css("font-weight", "normal");
            $("#academics").css("font-weight", "bold");
            $(".main_college_nav_item:not(#academics)").css("color", "black");
            $("#academics").css("color", "blue");
            $("#academics_nav").show();
            $("#question_sub").css("margin-top", "150px");
        });
        if (url.segment(2) == 'academics') {
            $("#living_environment_nav, #social_life_nav").hide();
            $(".main_college_nav_item:not(#academics)").css("font-weight", "normal");
            $("#academics").css("font-weight", "bold");
            $(".main_college_nav_item:not(#academics)").css("color", "black");
            $("#academics").css("color", "blue");
            $("#academics_nav").show();
            $("#question_sub").css("margin-top", "150px");
        }
            $("#professors").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#professors)").css("font-style", "normal");
                $("#professors").css("font-style", "italic");
                $(".subnav_item:not(#professors)").css("color", "black");
                $("#professors").css("color", "#6666FF");
                $(".questions_header").text("Professors");
                $("#professors_nav .questions").show();
            });
            if (url.segment(3) == 'professors')
            {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#professors)").css("font-style", "normal");
                $("#professors").css("font-style", "italic");
                $(".subnav_item:not(#professors)").css("color", "black");
                $("#professors").css("color", "#6666FF");
                $(".questions_header").text("Professors");
                $("#professors_nav .questions").show();
            }
            $("#classes").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#classes)").css("font-style", "normal");
                $("#classes").css("font-style", "italic");
                $(".subnav_item:not(#classes)").css("color", "black");
                $("#classes").css("color", "#6666FF");
                $(".questions_header").text("Classes");
                $("#classes_nav .questions").show();
            });
            if (url.segment(3) == 'classes') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#classes)").css("font-style", "normal");
                $("#classes").css("font-style", "italic");
                $(".subnav_item:not(#classes)").css("color", "black");
                $("#classes").css("color", "#6666FF");
                $(".questions_header").text("Classes");
                $("#classes_nav .questions").show();
            }
            $("#difficulty").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#difficulty)").css("font-style", "normal");
                $("#difficulty").css("font-style", "italic");
                $(".subnav_item:not(#difficulty)").css("color", "black");
                $("#difficulty").css("color", "#6666FF");
                $(".questions_header").text("Difficulty");
                $("#difficulty_nav .questions").show();
            });
            if (url.segment(3) == 'difficulty') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#difficulty)").css("font-style", "normal");
                $("#difficulty").css("font-style", "italic");
                $(".subnav_item:not(#difficulty)").css("color", "black");
                $("#difficulty").css("color", "#6666FF");
                $(".questions_header").text("Difficulty");
                $("#difficulty_nav .questions").show();
            }
            $("#major").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#major)").css("font-style", "normal");
                $("#major").css("font-style", "italic");
                $(".subnav_item:not(#major)").css("color", "black");
                $("#major").css("color", "#6666FF");
                $("#major_list").show();
                var a = 0;
                original_link = [];
                $(".major_question").each(function() {
                    original_link[a] = $(this).attr("href");
                    a++;
                });
            });
                $("#major_list li").click(function() {
                    $("#major_sub").text($(this).text());
                    $("#major_nav .questions").hide();
                    $("#question_sub, #disqus_thread, .stratify").hide();
                    $("#major_nav .questions").show("fast");
                    major = $(this).text();
                    major = major.toLowerCase();
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    major = major.replace(" ", "-");
                    var i = 0;
                    $(".major_question").each(function() {
                        link = original_link[i];
                        i++;
                        link = "/" + url.segment(1) + "/academics/" + major + "/" + link;
                        $(this).attr("href", link);
                    });
                });
        if (url.segment(4) == 'what-do-you-think-of-the-major-requirements' || 
            url.segment(4) == 'are-you-satisfied-with-the-course-offerings' || 
            url.segment(4) == 'what-was-your-favorite-class' || 
            url.segment(4) == 'what-was-your-least-favorite-class' || 
            url.segment(4) == 'is-there-anything-that-makes-this-program-special' || 
            url.segment(4) == 'what-do-kids-typically-do-with-the-degree' || 
            url.segment(4) == 'do-you-have-any-regrets-with-this-major' || 
            url.segment(4) == 'are-you-well-prepared-for-your-career' || 
            url.segment(4) == 'how-valuable-do-you-think-your-degree-is' || 
            url.segment(4) == 'how-strong-is-the-alumni-network' || 
            url.segment(4) == 'how-were-the-career-services' || 
            url.segment(4) == 'what-are-you-doing-now') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#major)").css("font-style", "normal");
                $("#major").css("font-style", "italic");
                $(".subnav_item:not(#major)").css("color", "black");
                $("#major").css("color", "#6666FF");
                $("#major_list").show();
                var a = 0;
                original_link = [];
                $(".major_question").each(function() {
                    original_link[a] = $(this).attr("href");
                    a++;
                });
                $("#major_nav .questions").hide();
                $("#major_nav .questions").show("fast");
                major = url.segment(3);
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                major = major.replace("-", " ");
                $("#major_sub").text(major);
                $("#major_sub").css("text-transform", "capitalize");
                var i = 0;
                $(".major_question").each(function() {
                    link = original_link[i];
                    i++;
                    $(this).attr("href", link);
                });
            }
        $("#social_life").click(function() {
            $("#academics_nav, #living_environment_nav").hide();
            $(".main_college_nav_item:not(#social_life)").css("font-weight", "normal");
            $("#social_life").css("font-weight", "bold");
            $(".main_college_nav_item:not(#social_life)").css("color", "black");
            $("#social_life").css("color", "blue");
            $("#social_life_nav").show();
            $("#question_sub").css("margin-top", "103px");
        });
        if (url.segment(2) == 'social-life')
        {
            $("#academics_nav, #living_environment_nav").hide();
            $(".main_college_nav_item:not(#social_life)").css("font-weight", "normal");
            $("#social_life").css("font-weight", "bold");
            $(".main_college_nav_item:not(#social_life)").css("color", "black");
            $("#social_life").css("color", "blue");
            $("#social_life_nav").show();
            $("#question_sub").css("margin-top", "103px");
        }
            $("#kids").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#kids)").css("font-style", "normal");
                $("#kids").css("font-style", "italic");
                $(".subnav_item:not(#kids)").css("color", "black");
                $("#kids").css("color", "#6666FF");
                $(".questions_header").text("Kids");
                $("#kids_nav .questions").show();
            });
            if (url.segment(3) == 'kids')
            {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#kids)").css("font-style", "normal");
                $("#kids").css("font-style", "italic");
                $(".subnav_item:not(#kids)").css("color", "black");
                $("#kids").css("color", "#6666FF");
                $(".questions_header").text("Kids");
                $("#kids_nav .questions").show();
            }
            $("#parties").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#parties)").css("font-style", "normal");
                $("#parties").css("font-style", "italic");
                $(".subnav_item:not(#parties)").css("color", "black");
                $("#parties").css("color", "#6666FF");
                $(".questions_header").text("Parties");
                $("#parties_nav .questions").show();
            });
            if (url.segment(3) == 'parties')
            {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#parties)").css("font-style", "normal");
                $("#parties").css("font-style", "italic");
                $(".subnav_item:not(#parties)").css("color", "black");
                $("#parties").css("color", "#6666FF");
                $(".questions_header").text("Parties");
                $("#parties_nav .questions").show();
            }
        $("#living_environment").click(function() {
            $("#academics_nav, #social_life_nav").hide();
            $(".main_college_nav_item:not(#living_environment)").css("font-weight", "normal");
            $("#living_environment").css("font-weight", "bold");
            $(".main_college_nav_item:not(#living_environment)").css("color", "black");
            $("#living_environment").css("color", "blue");
            $("#living_environment_nav").show();
            $("#question_sub").css("margin-top", "150px");
            $("#question_sub, #disqus_thread, .stratify").hide();
        });
        if (url.segment(2) == 'living-environment')
        {
            $("#academics_nav, #social_life_nav").hide();
            $(".main_college_nav_item:not(#living_environment)").css("font-weight", "normal");
            $("#living_environment").css("font-weight", "bold");
            $(".main_college_nav_item:not(#living_environment)").css("color", "black");
            $("#living_environment").css("color", "blue");
            $("#living_environment_nav").show();
            $("#question_sub").css("margin-top", "150px");
        }
            $("#campus").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#campus)").css("font-style", "normal");
                $("#campus").css("font-style", "italic");
                $(".subnav_item:not(#campus)").css("color", "black");
                $("#campus").css("color", "#6666FF");
                $(".questions_header").text("Campus");
                $("#campus_section, #campus_section .questions").show();
            });
            if (url.segment(3) == 'campus') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#campus)").css("font-style", "normal");
                $("#campus").css("font-style", "italic");
                $(".subnav_item:not(#campus)").css("color", "black");
                $("#campus").css("color", "#6666FF");
                $(".questions_header").text("Campus");
                $("#campus_section, #campus_section .questions").show();
            }
            $("#food").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#food)").css("font-style", "normal");
                $("#food").css("font-style", "italic");
                $(".subnav_item:not(#food)").css("color", "black");
                $("#food").css("color", "#6666FF");
                $(".questions_header").text("Food");
                $("#food_nav, #food_nav .questions").show();
            });
            if (url.segment(3) == 'food') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#food)").css("font-style", "normal");
                $("#food").css("font-style", "italic");
                $(".subnav_item:not(#food)").css("color", "black");
                $("#food").css("color", "#6666FF");
                $(".questions_header").text("Food");
                $("#food_nav, #food_nav .questions").show();
            }
            $("#housing").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#housing)").css("font-style", "normal");
                $("#housing").css("font-style", "italic");
                $(".subnav_item:not(#housing)").css("color", "black");
                $("#housing").css("color", "#6666FF");
                $(".questions_header").text("Housing");
                $("#housing_nav").show();
            });
            if (url.segment(3) == 'housing') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#housing)").css("font-style", "normal");
                $("#housing").css("font-style", "italic");
                $(".subnav_item:not(#housing)").css("color", "black");
                $("#housing").css("color", "#6666FF");
                $(".questions_header").text("Housing");
                $("#housing_nav").show();
            }
            $("#weather").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#weather)").css("font-style", "normal");
                $("#weather").css("font-style", "italic");
                $(".subnav_item:not(#weather)").css("color", "black");
                $("#weather").css("color", "#6666FF");
                $(".questions_header").text("Weather");
                $("#weather_section").show();
            });
            if (url.segment(3) == 'weather') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#weather)").css("font-style", "normal");
                $("#weather").css("font-style", "italic");
                $(".subnav_item:not(#weather)").css("color", "black");
                $("#weather").css("color", "#6666FF");
                $(".questions_header").text("Weather");
                $("#weather_section").show();
            }
            $("#safety").click(function() {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#safety)").css("font-style", "normal");
                $("#safety").css("font-style", "italic");
                $(".subnav_item:not(#safety)").css("color", "black");
                $("#safety").css("color", "#6666FF");
                $(".questions_header").text("Safety");
                $("#safety_nav .questions").show();
            });
            if (url.segment(3) == 'safety') {
                $(".questions, .sections, #major_list").hide();
                $(".subnav_item:not(#safety)").css("font-style", "normal");
                $("#safety").css("font-style", "italic");
                $(".subnav_item:not(#safety)").css("color", "black");
                $("#safety").css("color", "#6666FF");
                $(".questions_header").text("Safety");
                $("#safety_nav .questions").show();
            }
        $("#information").click(function() {
            $("#academics_nav, #living_environment_nav, #social_life_nav, .questions, .sections, #major_list, #question_sub, #disqus_thread, .stratify").hide();
            $(".main_college_nav_item:not(#information)").css("font-weight", "normal");
            $("#information").css("font-weight", "bold");
            $(".main_college_nav_item:not(#information)").css("color", "black");
            $("#information").css("color", "blue");
            $(".subnav_item").css("font-style", "normal");
            $(".subnav_item").css("color", "black");
            $("#information_section").show();
        });
        $("#other").click(function() {
            $("#academics_nav, #living_environment_nav, #social_life_nav, .questions, .sections, #major_list, #question_sub, #disqus_thread, .stratify").hide();
            $(".main_college_nav_item:not(#other)").css("font-weight", "normal");
            $("#other").css("font-weight", "bold");
            $(".main_college_nav_item:not(#other)").css("color", "black");
            $("#other").css("color", "blue");
            $("#other_section").show();
        });

        var seg2 = '';
        if (url.segment(2) == 'academics')
            seg2 = "Academics";
        else if (url.segment(2) == 'living-environment')
            seg2 = "Living Environment";
        else if (url.segment(2) == 'social-life')
            seg2 = "Social Life";
        var title = document.title;
        if (seg2 != '')
            title += " | " + seg2;
        var seg3 = url.segment(3);
        seg3[0].toUpperCase();
        seg3.slice(1);
        title += " | " + seg3;
        if ($("#question_sub").text() != '')
            title += " | " + $("#question_sub").text();
        document.title = title;
    }
});
seg3[0].toUpperCase();
seg3.slice(1);
seg3 = seg3[0].toUpperCase() + seg3.substr(1);