function do_sorting(category, rental_sales)
{
	var order = document.getElementById('order').value;
	var orderby = document.getElementById('orderby').value;
	var per_page = document.getElementById('per_page').value;

	if (rental_sales == 'S')
	{
		var link = 'sales_catalogue.php?';
	}
	else
	{
		var link = 'rental_catalogue.php?';
	}

	window.location = link + 'category='+ category +'&order='+ order +'&orderby='+ orderby +'&per_page='+ per_page;
}

function show_hide_imgs(id)
{
	if (document.getElementById('bookimgs_' + id).style.display == 'none')
	{
		document.getElementById('bookimgs_' + id).style.display = "";
		document.getElementById('shimgs_' + id).innerHTML = "Hide More Images";
	}
	else
	{
		document.getElementById('bookimgs_' + id).style.display = "none";
		document.getElementById('shimgs_' + id).innerHTML = "Show More Images";
	}
}

function accountTypeSelect(type)
{
	if (type == 'child_only')
	{
		show_hide('tr_children', 'show');
		show_hide('tr_children_all_at_once', 'show');
		show_hide('tr_children_pref_list', 'show');

		show_hide('tr_all_at_once', 'hide');
		show_hide('tr_adult_pref_list', 'hide');
	}
	else if (type == 'adult_only')
	{
		show_hide('tr_children', 'hide');
		show_hide('tr_children_all_at_once', 'hide');
		show_hide('tr_children_pref_list', 'hide');

		show_hide('tr_all_at_once', 'show');
		show_hide('tr_adult_pref_list', 'show');
	}
	else if (type == 'both')
	{
		show_hide('tr_children', 'show');
		show_hide('tr_children_all_at_once', 'show');
		show_hide('tr_children_pref_list', 'show');

		show_hide('tr_all_at_once', 'show');
		show_hide('tr_adult_pref_list', 'show');
	}
	else
	{
		show_hide('tr_children', 'hide');
		show_hide('tr_children_all_at_once', 'hide');
		show_hide('tr_children_pref_list', 'hide');

		show_hide('tr_all_at_once', 'hide');
		show_hide('tr_adult_pref_list', 'hide');
	}
}

function show_hide(elementID, show_hide)
{
	if (!show_hide)
	{
		if (document.getElementById(elementID).style.display == 'none')
		{
			document.getElementById(elementID).style.display = '';
		}
		else
		{
			document.getElementById(elementID).style.display = 'none';
		}
	}
	else
	{
		if (show_hide == 'hide')
		{
			document.getElementById(elementID).style.display = 'none';
		}
		else
		{
			document.getElementById(elementID).style.display = '';
		}
	}
}