function fls_onAfterInsertMultiple(obj) {
	// reload
	obj.close();
	self.focus();
	document.location.href = document.location.href;
}

function alb_onClickDeleteImage() {
	if (!alb_data) return;
	XPS_replaceActionQueryParameterValue(null, ['delete_fileid'], [alb_data['pictures'][alb_data['curindex']]['fileid']], true);
}

function alb_onClickViewImage(obj, index) {
	if (!alb_data) return;
	
	// pulsate
	//if (obj) new Effect.Pulsate(obj, { duration: 1.5, pulses: 3 });
	
	// update image
	if (index == -1) {
		// last picture
		if (alb_data['curindex'] > alb_data['total'] - 1) {
			// another page?
			if (typeof(alb_data['offset_page_next']) == 'number') {
				// jump to next page
				XPS_replaceActionQueryParameterValue(null, new Array('mode', 'album_offset', 'album_offset_photo', 'fileid'), new Array('album', alb_data['offset_page_next'], 0, 0), true);
			} 
			else {
				// last picture
			}
		}
		else {
			// jump to next picture
			index = alb_data['curindex'] + 1;
		}
	}
	
	if (index == -2) {
		// first picture
		if (alb_data['curindex'] == 1) {
			// another page?
			if (typeof(alb_data['offset_page_previous']) == 'number') {
				// jump to previous page
				XPS_replaceActionQueryParameterValue(null, new Array('mode', 'album_offset', 'album_offset_photo', 'fileid'), new Array('album', alb_data['offset_page_previous'], alb_data['step'] - 1, 0), true);
			}
			else {
				// first picture
			}
		}
		else {
			// jump to previous picture
			index = alb_data['curindex'] - 1;
		}
	}
	
	if (!alb_data['pictures'][index]) return;
	
	// update index
	alb_data['curindex'] = index;
	
	// first picture (button)
	if (
		(alb_data['curindex'] == 1) &&
		(typeof(alb_data['offset_page_previous']) == 'boolean')
	) {
		$('alb_previous_button').hide();
	}
	else {
		$('alb_previous_button').show();
	}
	
	// last picture (button)
	if (
		(alb_data['curindex'] > alb_data['total'] - 1) &&
		(typeof(alb_data['offset_page_next']) == 'boolean')
	) {
		$('alb_next_button').hide();
	}
	else {
		$('alb_next_button').show();
	}
	
	// update picture
	XPS_elem('alb_image_380').src = alb_data['pictures'][index]['src'];
	
	// update notes
	WFS_XHR('alb', 'notes', { fileid: alb_data['pictures'][index]['fileid'], href: XPS_replaceActionQueryParameterValue(null, new Array('mode', 'album_offset_photo'), new Array('album', alb_data['curindex'] - 1), false) }, { callback: alb_onClickViewImage_callback });
	
	function alb_onClickViewImage_callback(reply) {
		XPS_elem('alb_notes').innerHTML = reply['html'];
	}
}
