function byClient()
{
	// AJAX BROWSE FILTERING
	$('ul#byClient li a').click(
		function(){
			
			if( $(this).parent().hasClass("more") ){
				return true;
			}else{
				clientID = $(this).attr('class').replace(/cliID-/,'');
				type = 'workClients';
				$.ajax({
					type: "POST",
					url: "/ajax/filterByClient.php",
					dataType: "html",
					data: {clientID: clientID, type: type},
					success: function(html){
						$('#rightcol').html(html).children('div').hide().fadeIn();
					}
				});
				return false;
			}
		}
	);
}

function byIndustry()
{
	// AJAX BROWSE FILTERING
	$('ul#byIndustry li a').click(
		function(){
			industryID = $(this).attr('class').replace(/indID-/,'');
			$.ajax({
				type: "POST",
				url: "/ajax/filterByIndustry.php",
				dataType: "html",
				data: {industryID: industryID},
				success: function(html){
					$('#rightcol').html(html).children('div').hide().fadeIn();
				}
			});
			return false;
		}
	);
}

function byCategory()
{
	// AJAX BROWSE FILTERING
	$('ul#browseCats li a').click(
		function(){
			$(this).parent().siblings().children().removeClass('selected');
			$(this).addClass('selected');
			categoryID = $(this).attr('id').replace(/catID-/,'');
			$.ajax({
				type: "POST",
				url: "/ajax/filterByCategory.php",
				dataType: "html",
				data: {categoryID: categoryID},
				success: function(html){
					$('#rightcol').html(html).children('div').hide().fadeIn();
				}
			});
			return false;
		}
	);
}

$(document).ready(function(){
	byClient();
	byCategory();
	byIndustry();
});
