// FLASH DETECTION VARIABLES
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
var uagent = navigator.userAgent.toLowerCase();
var hasFlash = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if (!hasFlash) {
	location.href="simple.html"	
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//Page load handlers
$(function() {
	
	//show the nav arrows
	$("div.arrows").show();
	
	//get the collection of nav links as a jQuery object
	var subNavLinks =  $("#work-subnav li a");
	
	//count the number of projects
	var numProjects = subNavLinks.length;
	
	//set the active item
	subNavLinks.each(function() {
		if (location.href.indexOf(this.href) != -1) {
			$(this).addClass("active");
		}
	});
	
	//get the index of the active item
	var activeSubNavIndex = subNavLinks.index($("a.active"));

	//set the HREF for the previous and next links
	//previous arrow
	if (activeSubNavIndex > 0) {
		$("a.arrow-left").attr("href", subNavLinks.eq(activeSubNavIndex - 1).attr("href"));
	} else {
		//disable previous
		$("a.arrow-left").addClass("off");
	}
	//next arrow
	if (numProjects - activeSubNavIndex > 1) {
		$("a.arrow-right").attr("href", subNavLinks.eq(activeSubNavIndex + 1).attr("href"));
	} else {
		//disable next
		$("a.arrow-right").addClass("off").removeAttr("href");
	}
	MM_preloadImages(
		"../images/nav-services-over.png", 
		"../images/nav-work-over.png", 
		"../images/nav-about-over.png",
		"../images/nav-contact-over.png", 
		"../images/nav-leadership-over.png", 
		"../images/nav-company-over.png", 
		"../images/nav-careers-over.png", 
		"../images/nav-work-over.png", 
		"../images/subnav-arrow-r-on.png", 
		"../images/subnav-arrow-l-on.png",
		"../images/subnav-arrow-r-active.png", 
		"../images/subnav-arrow-l-active.png"
	)
});
