$(document).ready(function() { 
						   
	if ($.browser.msie && $.browser.version < 7) {
$('img[@src$=.png]').ifixpng(); 	}
	
	$('#logo img').after('<ul><li><a href="expertise.php">Expertise</a></li><li><a href="crime.php">Crime</a></li><li><a href="civil_practice.php">Civil Litigation</a></li><li><a href="international.php">International</a></li><li><a href="human_rights.php">Human Rights</a></li><li><a href="http://www.bellyardevents.co.uk/" target="_blank">Seminars &amp; Training</a></li><li><a href="http://www.bellyardevents.co.uk/" target="_blank">Events</a></li><li><a href="clerks_details.php">Clerks&acute; Room</a></li><li><a href="people.php">Administration</a></li><li><a href="barrister_what.php">What is a Barrister?</a></li><li><a href="direct_professional_access.php">Direct Public Access</a></li><li><a href="careers.php">Recruitment &amp; Training</a></li><li><a href="http://www.blog.9-12bellyard.com/" target="_blank">Blog</a></li><li><a href="what_others_say.php">What others say</a><li><a href="dictionary_of_terms.php">Glossary of Terms</a></li><li><a href="contact_details.php">Contact Details</a></li><li><a href="links.php">Useful Links</a></li><li><a href="privacy_policy.php">Privacy Policy</a></li><li><a href="about_chambers.php">Home Page</a></li></ul>');
						 					    

	$('#logo ul').hide();	
	
	$('#logo').hover(function(){
							  $(this).next('img').replaceWith('<img src="images/logoover.png" alt="logo" />');
		$(this).parent().find('#logo ul').show('fast'); 
								  
	},function(){
		$(this).parent().find('#logo ul').hide('fast'); 
	})
		
	$('#headerright input#query').click(function(){
	 $(this).val('');
	});
	
	$("#seniority, #crime, #regulatory, #civil, #international, #other").change(function()
	{
		$(this).parent().addClass('active');
		
		// Added by AGT 23-7-9
		if($('#seniority :selected').text() == 'Make selection') {
			$('#seniority').parent().removeClass('active');
		}
		if($('#crime :selected').text() == 'Make selection') {
			$('#crime').parent().removeClass('active');
		}
		if($('#regulatory :selected').text() == 'Make selection') {
			$('#regulatory').parent().removeClass('active');
		}
		if($('#civil :selected').text() == 'Make selection') {
			$('#civil').parent().removeClass('active');
		}
		if($('#international :selected').text() == 'Make selection') {
			$('#international').parent().removeClass('active');
		}
		if($('#other :selected').text() == 'Make selection') {
			$('#other').parent().removeClass('active');
		}
		// End added
	});

		
	var name = "#logo";
	var menuYloc = null;
	
			menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")));
			$(window).scroll(function () { 
				offset = menuYloc+$(document).scrollTop()+"px";
				$(name).animate({top:offset},{duration:500,queue:false});
			});
			
			
	// Code for barrister search preview page		
	var previousId;
	$(".barristerresults > li > a").mouseover(function(event) {										   
		event.preventDefault();
		
		// Remove active style from previous selection
		if(previousId != "undefined") {
			$("#p"+previousId).parent().removeClass('active');	
		}
		
		// Get new barrister details
		var currentId = $(this).attr('id');
		if( currentId ){ currentId = currentId.substr(1); }
		var currstr = $(this).attr('rel');
		$.get('include/barrister_search_preview.php?_=' + (+new Date()), {barrister_id:currentId,querystring:currstr}, function(returned_data){
			 $(".leftinfo").html(returned_data);
		});
		
		// Update page to show active selection
		$(this).parent().addClass('active');
		previousId = currentId; 
	});

	// Auto select first result	
	var currentId = $(".barristerresults > li:first > a").attr('id');
	if( currentId ){ currentId = currentId.substr(1); }
	var currstr = $(".barristerresults > li:first > a").attr('rel');
/*	
	
	if(typeof(currentId) !== "undefined") {
		$.get('include/barrister_search_preview.php?_=' + (+new Date()), {barrister_id:currentId,querystring:currstr}, function(returned_data){
			 $(".leftinfo").html(returned_data);
		});	
		
		// Update page to show active selection
		$(".barristerresults > li:first > a").parent().addClass('active');
		previousId = currentId; 
	} else {
		// Clear up so page doesnt say click to view summary with no results
		$(".leftinfo").html("");
		$(".searchinfo").hide(0);
	}	
*/		
	

	//Set up fancy zoom for all elements classed "fancyzoom"
	$(".fancyzoom").fancyZoom();
	
});