//var curvyCornersNoAutoScan = true;
(function ($) {
    $(window).load(function () {
        var tmOut;

        $(".topSrch").focus(function (src) {
            if ($(this).val() == $(this)[0].title) {
                $(this).val("");
            }
        });

        $(".topSrch").blur(function () {
            if ($(this).val() == "") {
                $(this).val($(this)[0].title);
            }
        });

        $(".topSrch").blur();

        $('#btProd li').last().addClass('noback');
        $('#btServ li').last().addClass('noback');
        $('#btProm li').last().addClass('noback');
        $('#btLoc li').last().addClass('noback');
        $('#btAbout li').last().addClass('noback');
        $('#btCareers li').last().addClass('noback');

        showActive();

        $("#navTop ul li a").mouseenter(function () {
            clearTimeout(tmOut);
            $('ul.btnav').hide();
            $('.hovOn').removeClass('hovOn');
            $(this).addClass('hovOn');
            var src = $(this).parent("li").attr("id").replace("tp", "bt");
            $('#' + src).show();
        })
        .mouseleave(function () {
            var src = $(this).parent("li").attr("id").replace("tp", "bt");
            tmOut = setTimeout("$('.hovOn').removeClass('hovOn');showActive();", 500);
        });

        $("#navBot").mouseenter(function () {
            clearTimeout(tmOut);
        })
        .mouseleave(function () {
            tmOut = setTimeout("$('.hovOn').removeClass('hovOn');showActive();", 1000);
        });

        if ($.browser.msie) {
            if (parseInt($.browser.version, 10) < 9) {
                //initCorners();
            }
        }
        if ($('.expandable').length > 0) {
            if ($('.expandable').length > 1) {
                $('.expandable:first').before('<p><a href="#" class="expandall">Expand All</a></p>');
                $('.expandall').click(function(e) {
                    e.preventDefault();
                    if ($(this).text() == 'Expand All') {
                        $('.expandable .contbody').show();
												$('.expandable').addClass('expanded');
                        $(this).text('Collapse All');
                    } else {
                        $('.expandable .contbody').hide();
												$('.expandable').removeClass('expanded');
                        $(this).text('Expand All');
                    }
                });
            }
            $('.expandable h3 a').click(function(e) {
                e.preventDefault();
                $(this).closest('.expandable').find('.contbody').toggle();
								$(this).closest('.expandable').toggleClass('expanded');
            });
        }
    });
})(jQuery);

function showActive() {
    $('ul.btnav').hide();
    var src = $("#navTop ul li a.active").parent("li").attr("id");
    if (src != undefined) {
        $('#' + src.replace("tp", "bt")).show();
    }
}

function initCorners() {

    var curvyCornersVerbose = false;

    var rnd15 = {
        tl: { radius: 15 },
        tr: { radius: 15 },
        bl: { radius: 15 },
        br: { radius: 15 },
        antiAlias: true
    }

    var rndtl10 = {
        tl: { radius: 10 },
        tr: { radius: 0 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true
    }

    var rndtlr15 = {
        tl: { radius: 15 },
        tr: { radius: 15 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true
    }

    /*curvyCorners(rnd15, ".rnd15");
    curvyCorners(rndtl10, ".rndtl10");
    curvyCorners(rndtlr15, ".rndtlr15");*/

    return true;
}
