﻿$(function () {
    var originalFontSize = $('body').css('font-size').replace("px", "");

    // Normal
    $(".normal").click(function () {
        $('.mainContentBody, .mainContentHome, .subNavContentHome, .mainContent, #feed').css('font-size', '100%');
        $(".large, .extraLarge").removeClass("current");
        $(this).addClass("current");
        if ($('#car-wrap').is(".auto")) {
            $('#car-wrap').removeClass("auto");
        }
        return false;
    });
    // Large
    $(".large").click(function () {
        $('.mainContentBody, .mainContentHome, .subNavContentHome, .mainContent, #feed').css('font-size', '120%');
        $(".normal, .extraLarge").removeClass("current");
        $(this).addClass("current");
        $('#car-wrap').addClass("auto");
        return false;
    });
    // Extra Large
    $(".extraLarge").click(function () {
        $('.mainContentBody, .mainContentHome, .subNavContentHome, .mainContent, #feed').css('font-size', '150%');
        $(".normal, .large").removeClass("current");
        $(this).addClass("current");
        $('#car-wrap').addClass("auto");
        return false;
    });

    // FAQs
    $(".fAQs dd").hide();
    $(".fAQs dt a").click(function () {
        $(this).parent().next("dd").slideToggle(1500);
        if ($(this).text() == "Reveal Answer") {
            $(this).text("Hide Answer");
            $(this).attr("title", "Hide Answer");
            $(this).removeClass("dropToggleExpand");
            $(this).addClass("dropToggleClose");
        } else {
            $(this).text("Reveal Answer");
            $(this).attr("title", "Reveal Answer")
            $(this).removeClass("dropToggleClose");
            $(this).addClass("dropToggleExpand");
        }
        return false;
    });

    // SITE MAP
    $(".siteMapListing ul li ul").hide();
    $(".siteMapListing ul li ul li ul").show();
    $(".siteMapListing .dropToggleExpand, .siteMapListing .dropToggleClose").click(function () {
        $(this).parent().next("ul").slideToggle(1500);
        if ($(this).text() == "Expand Selection") {
            $(this).text("Close Selection");
            $(this).attr("title", "Close Selection");
            $(this).removeClass("dropToggleExpand");
            $(this).addClass("dropToggleClose");
        } else {
            $(this).text("Expand Selection");
            $(this).attr("title", "Expand Selection");
            $(this).removeClass("dropToggleClose");
            $(this).addClass("dropToggleExpand");
        }
        return false;
    });

    // FOOTER IMAGES
    $(".footerImgLinks img").hover(function () {
        var src = $(this).attr("src");
        $(this).attr("src", src.replace("/Grayscale", ""));
    }, function () {
        var src = $(this).attr("src");
        $(this).attr("src", src.replace("/Images", "/Images/Grayscale"));
    });

    // STYLE CHECKBOXES
    $("input:checkbox").checkbox({
        cls: 'jquery-safari-checkbox',
        empty: '/images/empty.png'
    });

    // STYLE TABLE ROWS
    $("table tr:odd").addClass("odd");
    $("table tr:even").addClass("even");
    $("table thead tr").removeClass("even").removeClass("odd");

    // CAROUSEL
    $("#car").jCarouselLite({
        btnNext: "#next",
        btnPrev: "#prev",
        visible: 4,
        speed: 400
    });

    $("#social a, #feed a").attr("target", "_blank");

});
