﻿$(document).ready(function () {
    //Slide down navigation menu
    $("#main_nav ul li").mouseover(function () {
        $(this).children("ul").stop(true, true);
        $(this).children("ul").slideDown(400);
    }).mouseleave(function () {
        $(this).children("ul").slideUp(200);
    });

    //Homage page image rotators
    $('#slider').nivoSlider({
        effect: 'random', //Specify sets like: 'fold,fade,sliceDown'
        slices: 15,
        animSpeed: 700,
        pauseTime: 6000,
        startSlide: 0, //Set starting Slide (0 index)
        directionNav: false, //Next & Prev
        directionNavHide: true, //Only show on hover
        controlNav: false, //1,2,3...
        controlNavThumbs: false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav: true, //Use left & right arrows
        pauseOnHover: true, //Stop animation while hovering
        manualAdvance: false, //Force manual transitions
        captionOpacity: 0.8 //Universal caption opacity
    });

    //Fix sizing issue with #slider in IE on intial load
    $('#slider').height(210);

    //Colorbox for employee email forms
    $("a.colorbox_form").colorbox({ opacity: "0.75", width: "700px", height: "380px", iframe: true });


    //IF there is enough content on the left, show the quote form, otherwise hide it
    if ($("#interior_content").height() > 1200) {
        $(".form_controls").show();
        $("a.show_form").addClass("active");
    }

    //Toggle show/hide of quote form
    $("a.show_form").click(function (e) {
        e.preventDefault();
        $(".form_controls").slideToggle("slow");
        $(this).toggleClass("active");
    })

    //Fix sizing of file input in FF because FF does not apply CSS to file inputs
    $("input.UploaderInputFile").attr("size", "10");

    //Toggle show/hide of maps for locations on PRemployer Contact Us page
    $("a.toggle_map").click(function (e) {
        e.preventDefault();
        if ($(this).hasClass("Corporate")) {
            $(".map.Corporate").slideToggle();
        }
        else if ($(this).hasClass("Administration")) {
            $(".map.Administration").slideToggle();
        }
    });
});