$(document).ready(function() {

function infoRoller(settings) {

	$('.' + settings.hideable + ':not(:first)').hide();
	//$('.' + settings.linklist + ' li:first').addClass(settings.highlightclass);

	$('.' + settings.hideable).each( function () {
		$(this).data('t', $('a.' + settings.targetlinkclass, this).attr('name'));
	});

	$('.' + settings.linklist + ' li').click( function() {
		$('.' + settings.linklist + ' li:not(this) a').removeClass(settings.highlightclass);
		$('a', this).addClass(settings.highlightclass);
		var t = $('a', this).attr('href').substr(1);
		$('.' + settings.hideable).each( function () {
			if (t == $(this).data('t')) {
				$(this).slideDown('fast');
			} else {
				$(this).slideUp('fast');
			}
		});
		return false;
	});

}

var settings = {
	linklist: 'sec1Rollover',
	hideable: 'sec1RolloverHideable',
	targetlinkclass: 'sec1RolloverLink',
	highlightclass: 'row_four_letting_agents_hl'
}
infoRoller(settings);

var settings = {
	linklist: 'sec2Rollover',
	hideable: 'sec2RolloverHideable',
	targetlinkclass: 'sec2RolloverLink',
	highlightclass: 'row_four_tenants_contents_hl'
}
infoRoller(settings);

var settings = {
	linklist: 'sec3Rollover',
	hideable: 'sec3RolloverHideable',
	targetlinkclass: 'sec3RolloverLink',
	highlightclass: 'row_four_landlords_insurance_hl'
}
infoRoller(settings);

//The following code slides the right menu into the screen.
//var panel_x = $('#row_five').css('left');
//$('#row_five').css('left', '950px').css('filter', 'alpha(opacity=0)').css('opacity', '0.0').animate({left: panel_x, filter: 'alpha(opacity=100)', opacity: '1.0'});

});
