
function locationFunction () {
	//get the URL of the current page, convert it to a string and make the string lowercase	
	var location = window.location;
	location = location.toString();
	location = location.toLowerCase();
	//alert(location);
	
	// define a new array to contain the pairs necessary to identify the current directory and corresponding div
	navItem = new Array();

	// directory is a string containing the name of the directory each section of the site is contained in, framed by slashes
	// menuLink is a string containing the unique id of the <a> tag that the menuCurrentLoc class  needs to be applied to
	navItem[0] = new Object();
			navItem[0].directory = "5minuteautoloan.com/apply.cfm"; 
			navItem[0].menuLink = "navApply";
			
	navItem[1] = new Object();
			navItem[1].directory = "/howitworks/"; 
			navItem[1].menuLink = "navHowItWorks";
	
	navItem[2] = new Object();
			navItem[2].directory = "/testimonials/"; 
			navItem[2].menuLink = "navTestimonials";
			
	navItem[3] = new Object();
			navItem[3].directory = "/services/"; 
			navItem[3].menuLink = "navServices";
			
	navItem[4] = new Object();
			navItem[4].directory = "/resources/"; 
			navItem[4].menuLink = "navResources";
			
	navItem[5] = new Object();
			navItem[5].directory = "/about/"; 
			navItem[5].menuLink = "navAbout";
				
	navItem[6] = new Object();
			navItem[6].directory = "5minuteautoloan.com/index.cfm"; 
			navItem[6].menuLink = "navHome";	
    
	// initiate a for loop to cycle through the array of site directories
	for (var i=0; i < navItem.length; i++) {
	
	// move through the array, checking if the .directory element string is present in the URl of the current page  
	if 	(location.match(navItem[i].directory))  { 
		// change the class of the corresponding menu item if it matches the current directory
	    document.getElementById(navItem[i].menuLink).className="menuCurrentLoc";
		return;
	}
	
	}
	
}
