﻿$(document).ready(function () {


    // primary sub-nav
    var config = {
        over: makeTall, // function = onMouseOver callback (REQUIRED)    
        timeout: 500, // number = milliseconds delay before onMouseOut    
        out: makeShort // function = onMouseOut callback (REQUIRED)    
    };

    function makeTall() {
        $(this).find("div.sub-nav").slideDown();
    }

    function makeShort() {
        $(this).find("div.sub-nav").slideUp();
    }

    $("#primarynav ul li").hoverIntent(config)


    /*$("#primarynav ul li").hover(function () {
        $(this).find("div.sub-nav").slideDown();
    }, function () {
        $(this).find("div.sub-nav").slideUp();
    });*/

    // banner slide show
    var bannerRotator = $('div#banner ul');
    $(bannerRotator).after('<div class="pager">').cycle({
        fx: 'scrollHorz',
        timeout: 8000,
        speed: 750,
        cleartype: true,
        cleartypeNoBg: false,
        pager: '.pager'
    });

    // testimonial slide show
    var testRotator = $('div.testimonials ul.slides');
    $(testRotator).cycle({
        fx: 'scrollHorz',
        timeout: 16000,
        speed: 750,
        cleartype: true,
        cleartypeNoBg: true,
        next: 'div.testimonials ul.slides-nav li.next a'
    });

    // resource accordion
    var icons = {
        header: "ui-icon-triangle-1-e",
        headerSelected: "ui-icon-triangle-1-s"
    };

    $("div.accordion").accordion({
        autoHeight: false,
        active: false,
        icons: icons,
        collapsible: true

    });

    // Resources slide show
    $("div.resource-slides div.viewer").before('<ul id="resource-slideshow-nav2"><li><a href="#" id="resource-slideshow-nav2-prev">Prev</a></li><li><a href="#" id="resource-slideshow-nav2-next">Next</a></li></ul>');

    $('div.resource-slides div.viewer').after('<div id="resource-slideshow-nav">').cycle({
        fx: 'scrollHorz',
        speed: 'medium',
        timeout: 0,
        prev: '#resource-slideshow-nav2-prev',
        next: '#resource-slideshow-nav2-next',
        pager: '#resource-slideshow-nav',
        height: "auto",
        containerResize: 0
    });

    /*function onAfterPortfolio() {
        var thePortTitle = $(this).attr('alt');
        $("div.resource-slides div.caption p").html(thePortTitle);
    }*/


});
