﻿//*************************************************************************************
// File     : nwec_functions.js
// Version  : 1.2
// Requires : jquery.js (version 1.2.6+), and braingnat.js (version 0.0.7+)
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : August 8, 2008
// Modified : September 30, 2008
// Purpose  : A set of functions specific to nwec.
//*************************************************************************************

$(document).ready(function(){activationSequence();});

function activationSequence() {
    // when the page has loaded, expand the content's height if it's not tall enough to fit the page.
    setContentHeight(20);
    $(window).resize(function(){setContentHeight(20);});
    stickyList();
    displayCurrentSubmenu();
    homePageSlideshow();
}


function displayCurrentSubmenu() {
    $('a.current').parent().parent().addClass('ulCurrent');
    $('.stickyList > li').bind('mouseover', function() {
        $('.stickyList > li ul').removeClass('displayNone');
        if($(this).children('ul').not('.ulCurrent').length > 0) {
            $('.stickyList > li ul.ulCurrent').addClass('displayNone'); 
        }
     });
 }

 function homePageSlideshow() {
     if ($('.homePicMainWrapper').length > 0) {
         $.get('/Controls/NWEC/imageList/imageList.aspx?dir=/uploads/Images/home/1/', function(data) {
             var list = data.split("|");
             list.pop();
             BrainGnat.slideshow.fadein(".homePicWrapper.one", list, 5000, 1000);
         });
         $.get('/Controls/NWEC/imageList/imageList.aspx?dir=/uploads/Images/home/2/', function(data) {
             var list = data.split("|");
             list.pop();
             BrainGnat.slideshow.fadein(".homePicWrapper.two", list, 6000, 1000);
         });
         $.get('/Controls/NWEC/imageList/imageList.aspx?dir=/uploads/Images/home/3/', function(data) {
             var list = data.split("|");
             list.pop();
             BrainGnat.slideshow.fadein(".homePicWrapper.three", list, 4000, 1000);
         });
         $.get('/Controls/NWEC/imageList/imageList.aspx?dir=/uploads/Images/home/4/', function(data) {
             var list = data.split("|");
             list.pop();
             BrainGnat.slideshow.fadein(".homePicWrapper.four", list, 5500, 1000);
         });
     }
 }
 