﻿
$(document).ready(function () {

    $('#leftShadow').animate({ "opacity": "0.1" }, "slow");
    $('#leftShadow').show("slide", { direction: "left" }, 1000);
    $("div#internalRightColumn a").each(
      function () {
          var color;
          var path = this.href.split('/');
          switch (path[3]) {
              case 'be_ready': color = '#846DAA'; break;
              case 'be_enterprising': color = '#6E87AB'; break;
              case 'be_involved': color = '#6CA8A4'; break;
              case 'be_safe': color = '#72AA6D'; break;
              case 'be_global': color = '#C2CC58'; break;
              case 'be_spoke': color = '#C481C3'; break;
              case 'work_wise': color = '#718bb1'; break;
              default: color = ''; break;
          }
          if (color != '') {
              $(this).css('color', color);
              $(this).css('font-weight', '700');
              $(this).css('text-decoration', 'underline');
          }
      }

      );

    // Find every class with a class of mouseover
    $(".mo").each(
    function () {

        switch (this.tagName) {
            case 'IMG': var normal = $(this).attr('src'); break;
            default: var normal = $(this).css('background-image'); break;

        }
        if (normal != '') {
            var extension = normal.substring(normal.lastIndexOf('.'), normal.length);
            var over = normal.replace(extension, '-mo' + extension);
            //var active = normal.replace(extension, '-a' + extension);


            switch (this.tagName) {
                case 'IMG':
                    $(this).bind("mouseover", function () { $(this).attr('src', over); });
                    $(this).bind("mouseout", function () { $(this).attr('src', normal); });
                    jQuery.preLoadImages(normal, over);

                    break;
                default:
                    $(this).bind("mouseover", function () { $(this).css('background-image', over); });
                    $(this).bind("mouseout", function () { $(this).css('background-image', normal); });
                    jQuery.preLoadImages(normal.substring(5, normal.length - 2), over.substring(5, over.length - 2));
                    break;



            }
            $(this).bind("mousedown", function () { $(this).stop().animate({ "opacity": "0.5" }, "slow"); });


        }

    });


});



/*


nice funky way to do rollovers for css menus. we like. 
$(document).ready(function () {
$('li.mo').hover(
function () {
$(this).animate({ backgroundColor: 'Yellow', color: 'Red' }, { queue: false, duration: 500 });
}, function () {
$(this).animate({ backgroundColor: '#ececed', color: '#777777' }, { queue: false, duration: 500 });
});
});
*/

(function ($) {
    var cache = [];
    // Arguments are image paths relative to the current page.
    $.preLoadImages = function () {
        var args_len = arguments.length;
        for (var i = args_len; i--; ) {
            var cacheImage = document.createElement('img');
            cacheImage.src = arguments[i];
            cache.push(cacheImage);
        }
    }
})(jQuery)


