function select_tab(item) {

	/* We need to work with the tab items themselves, plus the divs
	 * containing the tab content.
	 */
	var t1 = document.getElementById('album_tab');
	var t2 = document.getElementById('cancel_tab');
	var d1 = document.getElementById('album_div');
	var d2 = document.getElementById('cancel_div');

	/* Switch off to the appropriate tab handler.
	 */
	if(item == 'album') {

		/* Show/hide to get the selected content visibile.
		 */
		d1.style.display = "block";
		d2.style.display = "none";
		
		/* Add the "selected" class to the clicked tab.
		 */
		t1.className = t1.className + ' selected';

		/* Remove it from the other two.
		 */
		t2.className = t2.className.replace(/selected/g,"");
		/* Clean up any leftover whitespace in the class string.
		 * We remove multiple whitespace characters, and trim
		 * leading and trailing whitespace.
		 * We need to do this since we don't know where in the string the
		 * target class name will be found.
		 */
		t1.className = t1.className.replace(/\s+/g," ");
		t2.className = t2.className.replace(/\s+/g," ");
		t1.className = t1.className.replace(/^\s+/g,"");
		t2.className = t2.className.replace(/^\s+/g,"");
		
	} else if(item == 'cancel') {

		/* Same comments as in "recent" section apply.
		 */
		d1.style.display = "none";
		d2.style.display = "block";
		t2.className = t2.className + ' selected';
		t1.className = t1.className.replace(/selected/g,"");
		t1.className = t1.className.replace(/\s+/g," ");
		t2.className = t2.className.replace(/\s+/g," ");
		t1.className = t1.className.replace(/^\s+/g,"");
		t2.className = t2.className.replace(/^\s+/g,"");
	}
	/* Let the form remember which tab was set.
	 */
	var tab_var = document.getElementById('where_tab');
	tab_var.value = item;
}
