
function CreateImage(str_id, str_class, str_src, str_width, str_height, str_alt) { /* {{{ */

	// create new dom object
	var elm_img = document.createElement('img');

	// set id if given
	if (str_id) {
		elm_img.id = str_id;
	}

	// set class if given
	if (str_class) {
		elm_img.className = str_class;
	}

	// set src if given
	if (str_src) {
		elm_img.src = str_src;
	}

	// set height if given
	if (str_height) {
		elm_img.style.height = str_height;
	}

	// set width if given
	if (str_width) {
		elm_img.style.width = str_width;
	}

	// set alt if given
	if (str_alt) {
		elm_img.alt = str_alt;
	}

	// set image to be hidden by default
	elm_img.style.display = 'none';

	return elm_img;
} /* }}} */

function LoadImage(str_id, str_class, str_src, str_width, str_height, str_alt, func_handler, elm_buffer) { /* {{{ */

	// create new image
	var elm_img = CreateImage(str_id, str_class, str_src, str_width, str_height, str_alt);

	// attach loading handler
	elm_img.onload = func_handler;

	// add element to buffer
	elm_buffer.appendChild(elm_img);

	// destroy reference
	elm_img = null;

	return;
} /* }}} */

function ClearBuffer(elm_buffer) { /* {{{ */

	while (elm_buffer.hasChildNodes()) {
		ClearBuffer(elm_buffer.lastChild);
		elm_buffer.removeChild(elm_buffer.lastChild);
	}

	return;
} /* }}} */


