function lightbox_next_page()
{
	var myAjax = new Ajax.Updater(
		'lightbox_placeholder', 
		base_url + 'lightbox/next_page', 
		{
			method: 'get', 
			parameters: '',
			evalScript: true
		}
	);
}

function lightbox_prev_page()
{
	var myAjax = new Ajax.Updater(
		'lightbox_placeholder', 
		base_url + 'lightbox/prev_page', 
		{
			method: 'get', 
			parameters: '',
			evalScripts: true
		}
	);
}

function lightbox_swap_items(id1, id2, for_view)
{
	if (for_view == undefined) {
		for_view = 0;
	}
	var placeHolder = for_view ? 'lightbox_thumbs_placeholder' : 'lightbox_placeholder';
	var myAjax = new Ajax.Updater(
		placeHolder, 
		base_url + 'lightbox/swap_items/' + id1 + '/' + id2 + '/' + for_view + '/' + Math.random(),
		{
			method: 'get', 
			parameters: ''
		}
	);	
}

function lightbox_add_item(id)
{
	text_obj = $('lb_text_' + id);
	if (text_obj) {
		text_obj.innerHTML = 'Processing...';
	}
	var myAjax = new Ajax.Updater(
		'lightbox_placeholder', 
		base_url + 'lightbox/add_item/' + id,
		{
			method: 'get', 
			parameters: '',
			evalScripts: true
		}
	);	
}

function lightbox_delete_item(id)
{
	var myAjax = new Ajax.Updater(
		'lightbox_placeholder', 
		base_url + 'lightbox/delete_item/' + id,
		{
			method: 'get', 
			parameters: '',
			evalScripts: true
		}
	);	
}

function lightbox_select(id)
{
	var myAjax = new Ajax.Updater(
		'lightbox_placeholder', 
		base_url + 'lightbox/select/' + id,
		{
			method: 'get', 
			parameters: '',
			evalScripts: true
		}
	);	
}

function lightbox_check_item(lb_id, item_id, value)
{
	value = value ? 1 : 0;
	var myAjax = new Ajax.Request(
		base_url + 'lightbox/check_item/' + lb_id + '/' + item_id + '/' + value,
		{
			method: 'get',
			parameters: false
		}
	);
}

function lightbox_select_all(lb_id)
{
	selectItem = function( element ) { 
		element.checked = true;
	};
	$$('input.lightbox_checkbox').each( selectItem );
	var myAjax = new Ajax.Request(
		base_url + 'lightbox/select_all_items/' + lb_id + '/1',
		{
			method: 'get',
			parameters: false
		}
	);	
}

function lightbox_unselect_all(lb_id)
{
	unselectItem = function( element ) { 
		element.checked = false;
	};
	$$('input.lightbox_checkbox').each( unselectItem );
	var myAjax = new Ajax.Request(
		base_url + 'lightbox/select_all_items/' + lb_id + '/0',
		{
			method: 'get',
			parameters: false
		}
	);		
}

function lightbox_hide()
{
	var myAjax = new Ajax.Request(
		base_url + 'lightbox/hide_box',
		{
			method: 'get',
			parameters: false
		}
	);
	$('lightbox_visible_content').style.display = 'none';
	$('lightbox_visible_header').style.display  = 'none';
	$('lightbox_hidden_header').style.display   = 'block';
}

function lightbox_show()
{
	var myAjax = new Ajax.Request(
		base_url + 'lightbox/show_box',
		{
			method: 'get',
			parameters: false
		}
	);
	$('lightbox_visible_content').style.display = 'block';
	$('lightbox_visible_header').style.display  = 'block';
	$('lightbox_hidden_header').style.display   = 'none';
}