$(document).ready(function(){
$("ul.tabNavigation > li:last-child").addClass("last");
$("ul.tabNavigation li:first-child").removeClass("last"); 

$(".tabNavigation").accordian({
"delay":20,
"style": "mega",
"speed": 500,
"colwidth": 119
});



	$(".fancy").fancybox({'overlayShow': true, 'zoomSpeedIn' : 300, 'zoomSpeedOut' : 350, 'padding' : 0, 'overlayOpacity' : 0.5});

	$(".emailtab a").fancybox({ 'type': 'iframe', 'width': 370, 'height': 460, 'overlayShow': true, 'zoomSpeedIn' : 200, 'zoomSpeedOut' : 200, 'padding' : 0, 'overlayOpacity' : 0.5 });
	
 

/* This script finds the location of the current page by splitting the location and matching against menu items. */

	var loca = location.href; 									// grab the location and stick it into a variable.
	
	var tmp =  loca.split('/');  								//split the variable at slash points and put those chunks into a variable.
	
	var link = tmp[tmp.length-1]; 								//count back 1 place from the end of the previous variable - this is the value we are looking for.
	
  	$("#topnav a[href$='" + link + "']").addClass("current"); 	//find the a:link in topnav whose href ends with our current variable value and add the class of current to it.
  	
 	if (link==''){ 												// if the value is empty eg the visitor has gone to the directory instead of index.
 	
 	$("#topnav a").removeClass("current"); 						//remove the class of current from all a:links in the top nav.
 	
 	$("#topnav a[href$='index.php']").addClass("current");		// add current to the one that says index.php.
 	}
 	
 	//Repeat for sidenav
 	
  	$("#sidenav a[href$='" + link + "']").addClass("current");
 	if (link==''){
 	$("#sidenav a").removeClass("current");
 	$("#sidenav a[href$='index.php']").addClass("current");
 	}

    });

