
$(document).ready(function(){
var url = window.location.pathname;
var lastSlash = url.lastIndexOf("/");
var firstQuestionMark = url.indexOf("?");
if(firstQuestionMark == -1) {
firstQuestionMark = url.length;
}


var filename = url.substring(lastSlash + 1, firstQuestionMark);

// For each of the nav pages, add a class to their corresponding link
// in the jquery where you do the fadey stuff, just make sure that the thing isn't applied to any link with the ".thispage" class
switch(filename) {
case "index.html":
$("#indexlink").addClass("thispage");
break;
case "about.html":
$("#aboutlink").addClass("thispage");
break;
case "services.html":
$("#serviceslink").addClass("thispage");
break;
case "gallery.html":
$("#gallerylink").addClass("thispage");
break;
case "contact.html":
$("#contactlink").addClass("thispage");
break;
case "testimonials.html":
$("#testimoniallink").addClass("thispage");
break;
}

$("#main_nav .nav_link").not(".thispage").hover(
function() {
$(this).next("em").animate({opacity: "show", left: "-35"}, "slow");
},
function() {
$(this).next("em").animate({opacity: "hide", left: "-45"}, "fast");
});

$("#sub_nav .nav_link").not(".thispage").hover(
function() {
$(this).next("em").animate({opacity: "show", left: "-19"}, "slow");
},
function() {
$(this).next("em").animate({opacity: "hide", left: "-29"}, "fast");
});

$('ul#sub_nav a').click(function() {

    $('ul#sub_nav .active').removeClass('active');
		$(this).parent().addClass('active');
		
			});


});
