﻿$(document).ready(function () {

    // homepage hover panels
    $(".panels .sub_panel").hover(function () {

        $(this).find('span.showme').fadeIn('fast');
        $(this).find('a.reg').addClass('hov');
        //$('div.panels').find('span.box-default').fadeOut('fast');
        $("#divDefaultTag").clearQueue();
        $("#divDefaultTag").fadeOut('fast');

    }, function () {
        $(this).find('span.showme').fadeOut('fast');
        $(this).find('a.reg').removeClass('hov');
        $("#divDefaultTag").css("opacity", "1");
        $("#divDefaultTag").fadeIn();

        // old fade, to many opacity issues
        //$("#divDefaultTag").queue(function () {
        //   $(this).delay(5).fadeIn(200);
        // $(this).dequeue();
        // });

    });

    // --------------
    // hack for fast mouse people
    $(".main").mouseenter(function () {
        $("#divDefaultTag").show();
    });
    // --------------



    // homepage slideshow
    var inners = $('.inner-slideshow').cycle().cycle('stop');

    var slideshow = $('#slideshow').cycle({
        fx: 'scrollHorz',
        speed: 300,
        timeout: 0,
        prev: '#prev',
        next: '#next',
        before: function () {
            // stop all inner slideshows
            inners.cycle('stop');

            // start the new slide's slideshow
            $(this).cycle({
                fx: 'fade',
                timeout: 2000,
                autostop: true,
                end: function () {
                    // when inner slideshow ends, advance the outer slideshow
                    slideshow.cycle('next');
                }
            });
        }
    });


    // get url path
    var urlpath = window.location.pathname;


});


// homepage copy show more/less functions
function showCopy() {
    $("#divExtraCopy").show();
    $("#spanShowMore").hide();
    $("#spanShowLess").show();
}
function hideCopy() {
    $("#divExtraCopy").hide();
    $("#spanShowMore").show();
    $("#spanShowLess").hide();
}

function hideVidBox() {
    $("#endVideo").hide();
}

