$(function () {
    var baseURL = "";
    var currentURL = window.location;


    if (window.location.pathname == "/") {
        $("li.home a").addClass("selected");
    }

    $("ul.subnav").hide();
    $("ul.nav li").hover(function () {
        $("ul.subnav", this).show().parent().addClass("on_hover").parent();
    }, function () {
        $("ul.subnav", this).hide().parent().removeClass("on_hover").parent();
    });
    $("ul.nav li:first").addClass("first");

    /*$('.register_interest #aspnetForm').get(0).setAttribute('action', '/thank-you.aspx');*/

    $(".textareaRow .inputArea").val(window.location);

    $("table.sm_calendar td").hover(function () {
        $(".events_today", this).fadeIn(200);
    },
    function () {
        $(".events_today", this).fadeOut(200);
    }
  );

    $(".landing_page .item:odd").css("margin-right", "0");

    if (window.location.pathname == "/liverpool.aspx") {
        $(".item_title").css("background-color", "#d09800");
    }

    if (window.location.pathname == "/about.aspx") {
        $(".item_title").css("background-color", "#7308ab");
    }

    if (window.location.pathname == "/accommodation.aspx") {
        $(".item_title").css("background-color", "#40842D");
    }

    /*==PAGINATION==*/
    $(".paging_container").each(function () {
        var pagingItems1 = Math.ceil(eval($("ul.activity_list li").length - 3) / 3);
        var countItems = 1;
        while (countItems <= pagingItems1 + 1) {
            $(" .paging").append("<span id=\"" + countItems + "\">" + countItems + "</span>");
            countItems++;
        }
        $(".paging span:first").addClass("active");
        $(".paging span").click(function () {
            $(".paging span").removeClass("active");
            $(this).addClass("active");
            var pageNumber = $(this).attr("id") - 1;
            $("ul.activity_list").animate({ "top": "-" + eval(pageNumber * 650) + "px" });
        });
    });

    $(".student_container").each(function () {
        var pagingItems1 = Math.ceil(eval($(".student_container table tr").length - 4) / 4);
        var countItems = 1;
        while (countItems <= pagingItems1 + 1) {
            $(" .paging").append("<span id=\"" + countItems + "\">" + countItems + "</span>");
            countItems++;
        }
        $(".paging span:first").addClass("active");
        $(".paging span").click(function () {
            $(".paging span").removeClass("active");
            $(this).addClass("active");
            var pageNumber = $(this).attr("id") - 1;
            $(".student_container table").animate({ "top": "-" + eval(pageNumber * 840) + "px" });
        });
    });
    $(".teacher_container").each(function () {
        var pagingItems1 = Math.ceil(eval($(".teacher_container table tr").length - 5) / 5);
        var countItems = 1;
        while (countItems <= pagingItems1 + 1) {
            $(" .paging").append("<span id=\"" + countItems + "\">" + countItems + "</span>");
            countItems++;
        }
        $(".paging span:first").addClass("active");
        $(".paging span").click(function () {
            $(".paging span").removeClass("active");
            $(this).addClass("active");
            var pageNumber = $(this).attr("id") - 1;
            $(".teacher_container table").animate({ "top": "-" + eval(pageNumber * 854) + "px" });
        });
    });

    $(".faq_container").wrapInner("<div class='faqs' />");

    $(".faq_container").each(function () {
        var pagingItems1 = Math.ceil(eval($(".faqs h4").length - 7) / 7);
        var countItems = 1;
        while (countItems <= pagingItems1 + 1) {
            $(" .paging").append("<span id=\"" + countItems + "\">" + countItems + "</span>");
            countItems++;
        }
        $(".paging span:first").addClass("active");
        $(".paging span").click(function () {
            $(".paging span").removeClass("active");
            $(this).addClass("active");
            var pageNumber = $(this).attr("id") - 1;
            $(".faqs").animate({ "top": "-" + eval(pageNumber * 768) + "px" });
        });
    });
});
