
	removeElement = function( rmElement, message) {
		
		$('#'+rmElement).fadeOut();
		$('#'+rmElement).remove();
		
		if( message.length != 0) {
			showMessage( message, "#5fa651");
		}
	};
	
	removeItem = function( url, rmElement) {
		
		$( '#'+rmElement).fadeTo('slow', 0.4);
		$.get( 
			url, 
			function(message) {
				removeElement( rmElement, message);
			}, 
			'json'
		);
	};
	
	var loadedSelects = [];
	loadSelect = function( theSelect, destinationUrl) {	
		
		if( $.inArray( theSelect, loadedSelects) == -1) {			
			updateSelect( theSelect, destinationUrl);
			loadedSelects.push( theSelect);
		}			
	};
	
	updateSelect = function( theSelect, destinationUrl) {

		select = $(theSelect);
		select.after( renderLoading());
	    selectedIndex = select.val();
		$.get( destinationUrl, {ID: selectedIndex}, function( data) {
			$('#'+data.selectID).html(data.code);
			$(document).ready(function() { 
				removeLoading();
			});	
		}, "json");
	};
	
	renderLoading = function() {
		return '<span id="loading-select"><img src="/images/loading.gif" alt="loading" /></span>';
	};
	
	removeLoading = function() {
		$('#loading-select').remove();
	};

