$(document).ready(function () {

	/* Add class to currently navigated menu item */
	var page = location.pathname;
        // If there is a slash on the end, add a Default.aspx to it... because that's likely the page we're on
        //if (page.charAt(page.length-1) == 'QVAR/')
        //    page = page.concat('default.aspx');

        // Remove all the folders above the file...
				/*
        var index;
        var counter = 0;
        while (((index = page.indexOf('QVAR/')) != -1) && counter < 100) {
            page = page.slice(index+1);
            counter++;
        }
				*/

        // See if any of the primary links have a match
        $(".Menu a").each(function () {
																		var tmp = page;
																		var tmp2 = $(this).attr('href');
						// dont add highlight to homepage if we aren't on it
						if ($(this).attr('href') == "/" && page.length > 1) {
							// don't add
						} else {
							if(page.indexOf($(this).attr('href')) !=-1){
									$(this).addClass("Selected");
							}
						}
        });
});
