// next 2 lines, load the google analytics file. (does not execute anything yet)

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));



jQuery.preloadImages = function(){

	jQuery.each(arguments, function(e){

		jQuery('<img src="' + this + '" />');

	});

}



$(document).ready(function(){

	

	$(".sf-menu A").each(function () {

		var url = $(this).attr('href');

		var regex=new RegExp("^"+url+"$");

		pathArray = window.location.pathname.split('/');

		if(regex.test(pathArray[pathArray.length-1])){

			$(this).parents('li').addClass("current");

		}

    });



	// superfish menu. Do not change anything here except the "delay".

	$("ul.sf-menu").superfish({

		autoArrows:    false,

		dropShadows:   false, 

		animation: {height:'show'},

		delay:     1200,

		pathClass:  'current'

	});

	

	// images preloading (menu)

	/*$.preloadImages("images/esm_rollover.png",

					"images/whoweserve_rollover.png",

					"images/solutions_rollover.png",

					"images/thisispresidium_rollover.png",

					"images/subnav_blog-rollover.png",

					"images/subnav_change-management-rollover.png",

					"images/subnav_colleges-universities-rollover.png",

					"images/subnav_community-colleges-rollover.png",

					"images/subnav_contact-us-rollover.png",

					"images/subnav_ed-tech-100-rollover.png",

					"images/subnav_esm-rollover.png",

					"images/subnav_it-esm-rollover.png",

					"images/subnav_k-12-rollover.png",

					"images/subnav_media-center-rollover.png",

					"images/subnav_meet-the-team-rollover.png",

					"images/subnav_multi-modal-rollover.png",

					"images/subnav_online-educator-rollover.png",

					"images/subnav_service-desk-operation-rollover.png",

					"images/subnav_service-desk-sourcing-rollover.png",

					"images/subnav_sla-management-rollover.png",

					"images/subnav_solution-esm-rollover.png",

					"images/subnav_solution-vignettes-rollover.png",

					"images/subnav_student-services-rollover.png",

					"images/subnav_systems-consortia-rollover.png",

					"images/subnav_white-papers-rollover.png");*/

	

	// google analytics page tracking

	try{

		var pageTracker = _gat._getTracker("UA-3153620-3");

		pageTracker._trackPageview();

	}

	catch(err) {}

	

});







// SlideShow

//$(function() { 



	//startSlideshow(slides);

	

    function startSlideshow() { 

         

        //var totalSlideCount = 1 + slides.length;

		var slides = $('#slideshow').children();

		var totalSlideCount = slides.length;

		

        var $slideshow = $('#slideshow'); 

         

        // markup contains only a single slide; before starting the slideshow we  

        // append one slide and prepend one slide (to account for prev/next behavior)

        //$slideshow.prepend(slides[totalSlideCount-1]); 

        //$slideshow.append(slides[0]); 

 

        // start slideshow 

        $('#slideshow').cycle({ 

            fx: 'scrollHorz', 

            startingSlide: 0,  // start on the slide that was in the markup 

            fit: 		1,

            timeout:	4000,

			continuous:	0,

            speed:		1500, 

            prev:    	'#left_arrow', 

            next:    	'#right_arrow', 

            before:   	onBefore,

			pause:	  	1,

			cssAfter: 	"width:200px",

			cleartype:	true

        }); 

         

 

        function onBefore(curr, next, opts, fwd) { 

            // on Before arguments: 

            //  curr == DOM element for the slide that is currently being displayed 

            //  next == DOM element for the slide that is about to be displayed 

            //  opts == slideshow options 

            //  fwd  == true if cycling forward, false if cycling backward 

                 

            // on the first pass, addSlide is undefined (plugin hasn't yet created the fn yet) 

            if (!opts.addSlide) 

                return; 

                 

            // have we added all our slides? 

            if (opts.slideCount == totalSlideCount) 

                return; 

 

            // shift or pop from our slide array  

            var nextSlideSrc = fwd ? slides.shift() : slides.pop(); 

             

            // add our next slide 

            opts.addSlide(nextSlideSrc, fwd == false); 

        }; 

    }; 

//}); 

