$(function(){
	
	$('.p-clients #clientshover li a').hover(
		function(){
			var rel = $(this).attr('rel');
			$('li.' + rel).addClass('highlight');
		}, 
		function(){
			var rel = $(this).attr('rel');
			$('.' + rel).removeClass('highlight');	
		}
	);

	// if there is a hash on the url, filter the links by the hash prop
	var toshow = window.location.hash ? '[hash=' + window.location.hash + ']' : ':first';
	var containers = $('#news-accordion > dd');
	
	$('#news-accordion dt a.opener').click(function () {
		containers.hide().filter(this.hash).show();
		
		$('#news-accordion dt a.opener').removeClass('selected');
		$(this).addClass('selected');
	}).filter(toshow).click();
	
	$('#news-accordion dt a.closer').click(function () {
		containers.hide();
		return false;
	});
	
	$('a.email-article').fancybox({
		'hideOnContentClick': false,
		'frameWidth': 177,
		'frameHeight': 270
	}); 
	
	
	$('.s-work area').each(function() {
		if ($(this).attr("alt") != ''){
			var tgt = $(this).is(':first-child') ? 'bottomMiddle' : 'topMiddle';
			var ttp = $(this).is(':first-child') ? 'topMiddle' : 'bottomMiddle';
			
			$(this).attr('title', '');
	
			$(this).qtip({
				content:  {
					text: $(this).attr("alt"), // Use the ALT attribute of the area map
					prerender: true
				},
				position: {
					corner: {
						target: tgt,
						tooltip: ttp
					}
				},
				style: {
					name: 'light', // Give it the preset style
					border: {
						width: 1, 
						radius: 4,
						color: '#d0419c'
				},
				tip: true // Apply a tip at the default tooltip corner
				}
			});
		}
	});

});