$(document).ready(function() {
	
	// media lightbox
	 if ($("div.latestMedia").length != 0) {
		$("div.latestMedia a img").parent().addClass("addLightbox");
		$("div.latestMedia a.addLightbox").lightBox();
	}
	
	// client profiles
	
		// hide all but first profile
		$("div.profileDetail").hide();
		$("div.firstProfileArea").show();
		
		// click a "Profile"
		$("div#profileNav ul li a").click(function() {
			
			// get url anchor of clicked link
			var clickedLink = $(this).attr("href");
			
			// update active class
			$("div#profileNav ul li a").removeClass("activeProfile");
			$(this).addClass("activeProfile");
			
			// hide active divs
			$("div.profileDetail").hide();
			
			// show new div
			$("div#"+ clickedLink +"").show();
			
			return false; // stop link
		});
	
	// testimonials
	
		$("div.testimonialInfo").hide(); // hide all testimonials
		
		$("div.testimonialInfo").removeClass("testNoJs"); // remove no js class
		
		$("div#testTwo").show(); // show second testimonial
		
		$("div#testimonialsContent").css("height", "400px"); // set height
		
		$("div#testimonialsContent").addClass("testWithJs"); // add js class
		
		// add testimonial links
		var testLinks = '<div id="testLinks"><img id="q1" src="images/q1.gif" alt="Testimonial One" /><img id="q2" src="images/q2-over.gif" alt="Testimonial Two" /><img id="q3" src="images/q3.gif" alt="Testimonial Three" /><img id="q4" src="images/q4.gif" alt="Testimonial Four" /><img id="q5" src="images/q5.gif" alt="Testimonial Five" /></div>';
		$("div#testimonialsContent").append(testLinks);
		
		// reset links
		function resetLinks() {
		 	$("div#testLinks img#q1").attr("src","images/q1.gif");
			$("div#testLinks img#q2").attr("src","images/q2.gif");
			$("div#testLinks img#q3").attr("src","images/q3.gif");
			$("div#testLinks img#q4").attr("src","images/q4.gif");
			$("div#testLinks img#q5").attr("src","images/q5.gif");
		}
		
		// q1 hover
		
		$("div#testLinks img#q1").hover( function() {
			resetLinks();
			$(this).attr("src","images/q1-over.gif");
			
			$("div.testimonialInfo").hide();
			$("div#testOne").show();
		}, function() { });
		
		
		// q2 hover
		$("div#testLinks img#q2").hover( function() {
			resetLinks();
			$(this).attr("src","images/q2-over.gif");
			
			$("div.testimonialInfo").hide();
			$("div#testTwo").show();
		}, function() { });
		
		// q3 hover
		
		$("div#testLinks img#q3").hover( function() {
			resetLinks();
			$(this).attr("src","images/q3-over.gif");
			
			$("div.testimonialInfo").hide();
			$("div#testThree").show();
		}, function() { });
		
		
		// q4 hover
		$("div#testLinks img#q4").hover( function() {
			resetLinks();
			$(this).attr("src","images/q4-over.gif");
			
			$("div.testimonialInfo").hide();
			$("div#testFour").show();
		}, function() { });
		
		// q5 hover
		/*
		$("div#testLinks img#q5").hover( function() {
			resetLinks();
			$(this).attr("src","images/q5-over.gif");
			
			$("div.testimonialInfo").hide();
			$("div#testFive").show();
		}, function() { });
		*/
});
