function sales_initCallback(){
	$('#sales_right').bind('click', function() {
		nextCarousel("sales");
		return false;
	});

	$('#sales_left').bind('click', function() {
		prevCarousel("sales");
		return false;
	});
}

function let_initCallback(){
	$('#lettings_right').bind('click', function() {
		nextCarousel("let");
		return false;
	});

	$('#lettings_left').bind('click', function() {
		prevCarousel("let");
		return false;
	});
}


function student_initCallback(){
	$('#studentlets_right').bind('click', function() {
		nextCarousel("student");
		return false;
	});

	$('#studentlets_left').bind('click', function() {
		prevCarousel("student");
		return false;
	});
}

var showcase = ['sales','let','student', 'intro'];

function show_case(div_to_show){
	if(!div_to_show) return;
	$.each(showcase, function(index, value){
		if(value != div_to_show){
			$('.' + value + '-showcase:visible').hide();
			$('a[rel="' + value + '"]').removeClass('active-tab');
		}
		else{	
			//show_div(div_to_show);
			$('.' + value + '-showcase:hidden').show();
			$('a[rel="' + value + '"]').addClass('active-tab');
		}
	});

}

var tabs = ['sales','let','student', 'intro'];

function show_div(div_to_show){
	if(!div_to_show) return;
	$.each(tabs, function(index, value){
		if(value != div_to_show){
			$('#' + value + '-tab:visible').hide();
			$('#' + value).hide();
			$('a[rel="' + value + '"]').removeClass('active-tab');
		}
		else{
			//show_case(div_to_show);

			$('#' + value + '-tab:hidden').show();
			$('#' + value).show();
			$('a[rel="' + value + '"]').addClass('active-tab');
		}
	});
	
}

jQuery(document).ready(function() {
	student_initCallback();
	sales_initCallback();
	let_initCallback();
	
	$('#let, #student').hide();

	$('#advSearch a').click(function(){
		show_div($(this).attr('rel'));
		show_case($(this).attr('rel'));
	});

	$('#featureProps a.content-tab').click(function(){
		show_case($(this).attr('rel'));
		show_div($(this).attr('rel'));
	});
	
	$('a#lettings_left').hide();
	$('a#studentlets_left').hide();
	$('a#sales_left').hide();

});
