﻿


$(document).ready(function () {


   
    /*Sub nav ddls*/
    $('.TabList option').each(function () {
        this.text = this.text.replace('--', '');
        this.text = this.text.replace('------', '');
    });
    $('.TabList option:selected').each(function () {
        this.text = this.text.replace('>>>>>>', '');
    });
    $('#ddlNavAboutPrimary option').each(function () {
        this.text = this.text.replace('About Archway', 'Inside About Archway');
    });

    $('#dnn_dnnSEARCH_txtSearch').val('Search Our Site'); //add the search text to the search input
    $("#dnn_dnnSEARCH_txtSearch").focus(function () { //clear the default text out of the search input

        if ($(this).val() == "Search Our Site") {
            $(this).val('');
        }

    });
    $('input.lc-email').val('Subscribe Via Email'); //add the search text to the search input
    $('input.lc-email').focus(function () { //clear the default text out of the search input

        if ($(this).val() == "Subscribe Via Email") {
            $(this).val('');
        }

    });
   

    if ($(".tab-content h3").length > 0) {
        $(".tab-content").hide();
        $(".module-title").hide();
        if ($(".tab-content").hasClass('red')) {
            var strTabContent = "<div class=\"tabs-content red\">\n";
            var strTabUL = "<div class=\"tab-navigation red\">\n<ul>\n";
        }
        else {
            var strTabContent = "<div class=\"tabs-content\">\n";
            var strTabUL = "<div class=\"tab-navigation\">\n<ul>\n";
        }
        var intTabCount = 0;
        var strTabTitle;
        $(".tab-content").each(function () {
            strTabTitle = $(".module-title", this).text();
            strTabUL += "<li><a id=\"tabs-nav-" + (intTabCount + 1) + "\" href=\"#tabcontent" + intTabCount + "\"><span>" + strTabTitle + "</span></a></li>\n";
            strTabContent += "<div class=\"tab-details\" id=\"tabcontent" + intTabCount + "\">" + $(this).html() + "</div>\n";
            intTabCount++;
        });

        strTabUL += "</ul></div>";
        strTabContent += "</div>";
        if ($(".tab-content").hasClass('red')) {
            $(".tab-content:first").replaceWith("<div class=\"tabs-holder red\">" + strTabUL + strTabContent + "</div>");
        }
        else {
            $(".tab-content:first").replaceWith("<div class=\"tabs-holder\">" + strTabUL + strTabContent + "</div>");
        }

        $(".tab-details:first").show();
        $(".tab-navigation").addClass("tab1-active");
        $(".tab-navigation li:first").addClass("active");
        $(".tab-navigation a").click(function () {
            if (!$(this).parent().hasClass("active")) {

                var strContent = $(this).attr("href").split("#")[1];
                $(".tab-navigation li").removeClass("active");
                $(this).parent().addClass("active");

                if (this.id === "tabs-nav-1") {
                    $(".tab-navigation").removeClass("tab2-active").addClass("tab1-active");
                } else {
                    $(".tab-navigation").removeClass("tab1-active").addClass("tab2-active");
                }

                $(".tab-details").hide();
                $("#" + strContent).fadeIn("normal");
            }
            $(this).blur();
			return false;
            
        });
		return false;
    }
    if ($(".collapse-wrap").length > 0) {
        $(".collapse-wrap .title").click(function () {
            if ($(this).parent().find(".collapse-content").css("display") != "block") {
                $(this).addClass("collapse-expanded");
                
                $(this).parent().find(".collapse-content").slideDown("fast");
            } else {
                $(this).removeClass("collapse-expanded");
                $(this).parent().find(".collapse-content").slideUp("fast");
            }
        });

        $('<div class="collapse-border-bottom"></div>').insertAfter(".collapse-wrap:last");
    }

    if ($(".collapse-wrap").length > 1) {
        //$(".collapse-wrap:first").prepend("<p><a href=\"javascript:void(0);\" class=\"collapsible-collapse-all\">Collapse All</a> | <a href=\"javascript:void(0);\" class=\"collapsible-expand-all\">Expand All</a></p>");
        $(".collapsible-collapse-all").click(function () {
            expandAll('collapse');
        });
        $(".collapsible-expand-all").click(function () {
            expandAll('expand');
        });
    }

    return false;


});

// expand/collapse all collapsible content
function expandAll(strMode) {
    if (strMode == "expand") {
        $(".collapse-wrap .title").each(function () {
            $(this).addClass("collapse-expanded");
            $(this).parent().find(".collapse-content").slideDown("fast");
        });
    } else {
        $(".collapse-wrap .title").each(function () {
            $(this).removeClass("collapse-expanded");
            $(this).parent().find(".collapse-content").slideUp("fast");
        });
    }
}
$(function () {
    var offset = $("#contact-box").offset();
    if (offset) {
        var topPadding = 15;
        $(window).scroll(function () {
            if ($(window).scrollTop() > offset.top) {
                $("#contact-box").stop().animate({
                    marginTop: $(window).scrollTop() - offset.top + topPadding
                });
            } else {
                $("#contact-box").stop().animate({
                    marginTop: 0
                });
            };
        });
    }
});


$(function () {
    $('#contact-box').hover(function () {
        $(this).animate({ left: '0px' }, { queue: false, duration: 500 });
    }, function () {
        $(this).animate({ left: '-299px' }, { queue: false, duration: 500 });
    });
});




$(function () {
    $('.clients-home-gallery img').mouseenter(function () {
        var spano = $(this).attr("class");
        $("span." + spano).slideDown("slow");
    });

    $('.clients-home-gallery img').mouseleave(function () {
        var spano = $(this).attr("class");
        $("span." + spano).slideDown("slow");


    });

});

$(function () {
       
        $('.email-signup-form').hide();

        $('.email-signup-click').click(
            function () {
                $('.email-signup-form').slideToggle();
                $(this).toggleClass('Open');

            });

        $(".form-input").focus(function (srcc) {

            if ($(this).val() == $(this)[0].value) {
                $(this).addClass("form-input-active");
                $(this).val("");
            }
        });

        $(".form-input").blur(function () {
            if ($(this).val() == "") {
                $(this).addClass("form-input-active");
                $(this).val($(this)[0].value);
            }
        });

        $(".form-input").blur();

        if ($('div.top-pane').is(':empty')) {
            var title = $(".NewsArticles h1");
            $(title).css("marginBottom", "0px");
            $(title).appendTo('div.top-pane');
        }

    });


