﻿
     $(document).ready(function() {
         //function preload menu and banner images
         jQuery.preloadImages = function() {
             for (var i = 0; i < arguments.length; i++) {
                 jQuery("<img>").attr("src", arguments[i]);
             }
         };
         $.preloadImages("images/1a.gif", "images/1b.gif", "images/2a.gif", "images/2b.gif", "images/3a.gif", "images/3b.gif", "images/4b.gif", "images/ban1.jpg", "images/ban2.jpg", "images/ban3.jpg");
         //function resize columns left+right
         function equalHeight(group) {
             tallest = 0;
             group.each(function() {
                 thisHeight = $(this).height();
                 if (thisHeight > tallest) {
                     tallest = thisHeight;
                 }
             });
             group.height(tallest);
         }
         equalHeight($(".column"));
         //function carosel fade adn speed
         $('.images').carousel({
             hide: 'fadeOut', // jquery show / hide effect method name
             show: 'fadeIn', // jquery show / hide effect method name
             duration: 5000, // duration of wait in milliseconds
             speed: 300, // speed in milliseconds, 'slow' or 'fast',
             seed: 5 // length of random classname applied to item to keep things all nice and seperate
             // warning: setting this to something ridiculous will make it take ages to load.
         });
     });
    //Image Preloading. menu banner rotator
	$.preloadImages = function(preload){ 
	$(document.createElement('img')).bind('load', function(){ 
	if(preload[0]) this.src = preload.shift(); 
	}).trigger('load'); 
	}
	$.preloadImages(['images/1a.gif', 'images/1b.gif', 'images/2a.gif', 'images/2b.gif', 'images/3a.gif', 
	'images/3b.gif', 'images/4b.gif', 'images/hlight.gif', 'images/ban1.jpg', 'images/ban2.jpg', 'images/ban3.jpg']);
	//Consolidate the Hight. left and right columns of content. 
	function equalHeight(group) {
	    tallest = 0;
	    group.each(function() {
	        thisHeight = $(this).height();
	        if (thisHeight > tallest) {
	            tallest = thisHeight;
	        }
	    });
	    group.height(tallest);
	}
	$(document).ready(function() {
	    equalHeight($(".column"));
	});
	//Highlight the side menu current selected item
	function highlight() {
	    var div = document.getElementById("MenuDiv");
	    if (div) {
	        var elements = div.getElementsByTagName("li");
	        if (elements) {
	            for (i = 0; i < elements.length; i++) {
	                if (elements[i].firstChild.href == document.location) {
	                    elements[i].style.backgroundColor = '#c8e0ec';
	                    elements[i].firstChild.style.color = '#3c3f42';
	                    elements[i].style.backgroundImage = 'url(../images/arrow.gif)';
	                    elements[i].style.backgroundRepeat = 'no-repeat';
	                    break;
	                }
	            }
	        }
	    }
	}
	$(document).ready(function() {
	    highlight();
	});
	//Speed and Fade of Banner rotator.
	  $(document).ready(function() {        
		$('.images').carousel({
		  hide: 'fadeOut', // jquery show / hide effect method name
		  show: 'fadeIn', // jquery show / hide effect method name
		  duration: 5000, // duration of wait in milliseconds
		  speed: 300, // speed in milliseconds, 'slow' or 'fast',
		  seed: 5 // length of random classname applied to item to keep things all nice and seperate
		});
	  });

