$(document).ready(function() {

	$( ".datepicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
	$("a#map").fancybox({ 
		'frameWidth': 600, 'frameHeight': 360,
		'hideOnContentClick': false,
		'callbackOnClose': function() {
			$("#map").empty();
		} 
	});
	

	// Global
	//===================================================
	// Tooltip links for contact method icons
	$('.contact_link').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " ",
		top: -59,
		left: -52,
		fade: 250
	});
	// Drawer
	// Services and sectors info panel
	$('#services_and_sectors').hide();
	$('.services_and_sectors').click(function(e){
		e.preventDefault();
		var test = $(this).attr('href');
		$(test).slideToggle();
	});


	// Profiles
	//===================================================		
	$('.profile').hide();
	$('.plist').hide();
	// View full profile
	$('.profile_link').click(function(e){
		e.preventDefault();
		var profile = $(this).attr('href');
		$('.profile_intro').hide();
		$('.profile').hide();
		$(profile).fadeIn();

	});
	
	// View list by letter
	$('.al').click(function(e){
		e.preventDefault();
		var letter = $(this).html();
		$('.plist').hide();
		$('.'+letter).fadeIn();
	});

	// View full list		
	$('.all').click(function(e){
		e.preventDefault();
		$('.plist').fadeIn();
	});

	// View list by position
	$("#selectposition").change(function(e){
		e.preventDefault();
		var selectedPosition = $(this).val();
		$('.plist').hide();
		$('.'+selectedPosition).fadeIn();
	});

	$('#nojs').hide();

	$('.intro').hide();

	if(window.location.hash){
		$('.profile_intro').hide();
		$(window.location.hash).fadeIn();
	}
});

