/*
Clients list, 25.11.09
Copyright (C) 2009 Bogdan Pop of WebRaptor (http://www.bogdanpop.info, http://www.webraptor.eu)
Published by Web International Awards (http://www.webia.info)

Released under Creative Commons Attribution 3.0 (http://creativecommons.org/licenses/by/3.0)
If you modify this source codes and use it in your own projects you must not modify or remove the above credits. 
However, you may add your own below this line.
*/
jQuery(document).ready(function($)
{
	// start the magic

	// resize column for same height
	var servicesHeight = $('.services').height();
	var clientsHeight = $('.clients').height();
	if(servicesHeight>clientsHeight)
	{
		$('.clients').height(servicesHeight);
	}
	else $('.services').height(clientsHeight);
	
	// the article code
	// if services on the left are clicked
	$('.services a').click(function(){
		
		$('.selected').attr('class','');
		// when we click one service we need to emphasize that it is selected
		$(this).attr('class','selected'); // set current link as selected	
		
		// get the services classes
		var classesString  = $(this).parent().attr('class');
		var classes = classesString.split(' ');
		// loop through all classes
		for(var i=0;i<classes.length;i++)
		{
			// set selected to all clients that have such a service
			$('.clients li.'+classes[i]+' a').attr('class','selected');
		}
	});
		
	// if clients on the right are clicked
	$('.clients li a').click(function(){
		$('.selected').attr('class','');
		// when we click one service we need to emphasize that it is selected
		$(this).attr('class','selected'); // set current link as selected
		
		// get the services classes
		var classesString  = $(this).parent().attr('class');
		var classes = classesString.split(' ');
		// loop through all classes
		for(var i=0;i<classes.length;i++)
		{
			// set selected to all clients that have such a service
			$('.services li.'+classes[i]+' a').attr('class','selected');
		}
	});
	
});