$(document).ready(function(){

	// Read more
	$('a.read_more').click(function(){
		var parent = $(this).closest('td');
		$(this).hide();
		$('span.more', parent).show();
		return false;
	});
	
	// Read less
	$('a.read_less').click(function(){
		var parent = $(this).closest('td');
		$('span.more', parent).hide();
		$('a.read_more', parent).show();
		return false;
	});
	
	// Tabs
	$('#tabs .menu ul li a').click(function(){
		var id = $(this).attr('href').substring(1);
		$(this).parent().parent().children('li').removeClass('selected');
		$(this).parent().addClass('selected');
		
		$('#tabs div[id^="files"]').each(function(){
			if ($(this).attr('id') == id) {
				$(this).show();
			}
			else {
				$(this).hide();
			}
		});
		
		return false;
	});

});

function changeStatusMessage(val) {
	if (val == "1") {
		//alert("If approving the user for the first time, make sure you click 'Save Changes'.");
	}
}

function toggleAccess(val) {
	if ((val != "5")) {
		$('#region').show('slow');
		$('#page').show('slow');
	
	} else {
		$('#region').hide();
		$('#page').hide();
	}
}

function toggleFilter(el) {
	$('tr.corporate_access').hide();
	$('tr.bank_holidays').hide();
	$('tr.' + el).show();
}

function checkAllRegions(check) {
	$('input.region_checkbox').each(function(){
		$(this).attr('checked', check);
	});
}

function checkAllPages(check) {
	$('input.page_checkbox').each(function(){
		$(this).attr('checked', check);
	});
}
