function jst_dom_element(id) {
	return document.getElementById(id);
}
function jst_dom_elements_by_class(className, tag, elm){
	var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for (var i = 0; i < length; i++) {
		current = elements[i];
		if (testClass.test(current.className)) returnElements.push(current);
	}
	return returnElements;
}
function jst_dom_toggle(el_block, el_link, text_show, text_hide) {
	var was_visible = (el_block.style.display == 'none') ? false : true;
	el_block.style.display = (was_visible) ? 'none' : 'block';
	if (el_link) {
		if (text_show == null) text_show = '[more]';
		if (text_hide == null) text_show = '[hide]';
		el_link.innerHTML = (was_visible) ? text_show : text_hide;
	}
	return was_visible;
}
function jst_dom_pos(el) {
	var left = 0;
	var top = 0;
	while (el.offsetParent){
		left += el.offsetLeft;
		top += el.offsetTop;
		el = el.offsetParent;
	}
	left += el.offsetLeft;
	top += el.offsetTop;
	return {x:left, y:top};
}
function jst_dom_width(el) {
	return (el.offsetWidth);
}
function jst_dom_height(el) {
	return (el.offsetHeight);
}
function jst_dom_left(el) {
	var pos = jst_dom_pos(el);
	return pos.x;
}
function jst_dom_right(el) {
	var pos = jst_dom_pos(el);
	return pos.x + jst_dom_width(el);
}
function jst_dom_top(el) {
	var pos = jst_dom_pos(el);
	return pos.y;
}
function jst_dom_bottom(el) {
	var pos = jst_dom_pos(el);
	return pos.y + jst_dom_height(el);
}
// deprecated
	function jst_getElementsByClassName(className, tag, elm){
		return jst_dom_elements_by_class(className, tag, elm);
	}
	function jst_get_elements_by_class(className, tag, elm){
		return jst_dom_elements_by_class(className, tag, elm);
	}
	function _get_position(obj) {
		return jst_dom_pos(obj);
	}
	function jst_find_pos(obj) {
		if (obj == null) return 0;
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
			return [curleft,curtop];
		}
	}
	function jst_show_hide(block_id, link_id, text_show, text_hide) {
		return jst_dom_toggle(jst_dom_element(block_id), jst_dom_element(block_id), text_show, text_hide);
		/*var block = document.getElementById(block_id);
		if (block.style.display == 'none') block.style.display = 'block';
		else block.style.display = 'none';
		if (link_id != null) {
			if (text_show == null) text_show = '[more]';
			if (text_hide == null) text_show = '[hide]';
			var link = document.getElementById(link_id);
			if (block.style.display == 'none') link.innerHTML = text_show;
			else link.innerHTML = text_hide;
		}*/
	}