			function XShowHide (theLayer, isVisible)
			{
				if ((theLayer) && (theLayer.style))
				{
					if ((theLayer.style.visibility != 'visible') && (isVisible))
					{
						theLayer.style.visibility = 'visible';
						theLayer.style.display = 'block';
					}
					else if ((theLayer.style.visibility == 'visible') && (!isVisible))
					{
						theLayer.style.visibility = 'hidden';
						theLayer.style.display = 'none';
					}
				}
			}

			theShowIndex = -1;
			theShowOver = 0;
			
			var	isToHide = 0;
			
			function XShowMenu(theIndex, theOver)
			{
				if (((isToHide == 1) || (theIndex != 0)) && ((theShowIndex != theIndex) || (theShowOver != theOver)))
				{
					XShowHide (document.getElementById('TopMenu' + theShowIndex), 	0);
					XShowHide (document.getElementById('TopMenu' + theIndex), 		1);
	
					XShowHide (document.getElementById('SubMenu' + theShowIndex + theShowOver), 	0);
					XShowHide (document.getElementById('SubMenu' + theIndex + theOver), 			1);
			
					theShowIndex 	= theIndex;
					theShowOver 	= theOver;
				}
				isToHide = 0;
			}
			function XHideMenu()
			{
				isToHide = 1;
				setTimeout ("XShowMenu(0, 0)", 50);
			}




	function dom_include(script_filename)
	{
		//not work in safari 2.0!! use document.write
		var html_doc = document.getElementsByTagName('head').item(0);
		var js = document.createElement('script');
		js.setAttribute('language', 'javascript');
		js.setAttribute('type', 'text/javascript');
		js.setAttribute('src', script_filename);
		html_doc.appendChild(js);
		return false;
	}

	function dom_display (obj, is_vis)
	{
		if (!obj) return;
		obj.style.display = (is_vis ? 'block' : 'none');
	}

	function dom_tr_display (obj, is_vis)
	{
		if (!obj) return;
		obj.style.display = (is_vis ? 'table-row' : 'none');
	}

	function dom_show (obj, is_vis)
	{
		if (!obj) return;
		obj.style.visibility = (is_vis ? 'visible' : 'hidden');
	}

	function dom_class_remove (obj, deleting_class)
	{
		if (obj && obj.className)
		{
			if (obj.className.indexOf (deleting_class != -1))
			{
				if (!document.reg_hash)
					document.reg_hash = new Object();
				if (!document.reg_hash[deleting_class])
					document.reg_hash[deleting_class] = new RegExp ('\\s*' + deleting_class, 'gi');
					
				obj.className = obj.className.replace (document.reg_hash[deleting_class], '');
			}
		}
	}
	
	function dom_class (obj, toggle_class, is_to_add)
	{
		if (obj)
		{
			if (is_to_add)
			{
				if (obj.className.indexOf (toggle_class) == -1)
					obj.className += ' ' + toggle_class;
			}
			else
				dom_class_remove (obj, toggle_class);
		}
	}
	
	function dom_remove_all_childs (obj)
	{
		if (!obj) return;
		while (obj.firstChild)
		{
			obj.removeChild (obj.firstChild);
		}
	}


	function dom_prev (cur_obj, node_name)
	{
		while ((cur_obj = cur_obj.previousSibling) != null)
		{
			if (cur_obj.nodeName == node_name || cur_obj.nodeName == node_name.toUpperCase())
			{
				return cur_obj;
			}
		}
		return null;
	}

	function dom_next (cur_obj, node_name)
	{
		while ((cur_obj = cur_obj.nextSibling) != null)
		{
			if (cur_obj.nodeName == node_name || cur_obj.nodeName == node_name.toUpperCase())
			{
				return cur_obj;
			}
		}
		return null;
	}

	function dom_up (cur_obj, node_name)
	{
		do
		{
			if (cur_obj.nodeName == node_name || cur_obj.nodeName == node_name.toUpperCase())
			{
				return cur_obj;
			}
		}
		while ((cur_obj = cur_obj.parentNode) != null);
		
		return null;
	}

	function dom_upper (cur_obj, node_name)
	{
		while ((cur_obj = cur_obj.parentNode) != null)
		{
			if (cur_obj.nodeName == node_name || cur_obj.nodeName == node_name.toUpperCase())
			{
				return cur_obj;
			}
		}
		
		return null;
	}

	function dom_down (cur_obj, node_name)
	{
		childs = cur_obj.childNodes;
		for (child_index = 0; child_index < childs.length; child_index++)
		{
			child = childs[child_index];
			if (child.nodeName && (child.nodeName == node_name || child.nodeName == node_name.toUpperCase()))
			{
				return child;
			}
		}

		return null;
	}
	
	function dom_child (obj, name)
	{
		childs = obj.childNodes;
		for (child_index = 0; child_index < childs.length; child_index++)
		{
			child = childs[child_index];
			if (child.getAttribute && child.getAttribute ('name') == name)
				return child;
		}
		return null;
	}

	function dom_child (obj, name)
	{
		childs = obj.childNodes;
		for (child_index = 0; child_index < childs.length; child_index++)
		{
			child = childs[child_index];
			if (child.getAttribute && child.getAttribute ('name') == name)
				return child;
		}
		return null;
	}
	
	
	function namedTagChild (obj, tag, name)
	{
		childs = obj.getElementsByTagName (tag);
		for (child_index = 0; child_index < childs.length; child_index++)
		{
			child = childs[child_index];
			if (child.getAttribute && child.getAttribute ('name') == name)
				return child;
		}
		return null;
	}

	function dom_insert_after (cur_obj, new_node)
	{
		cur_node_name = cur_obj.nodeName;
		cur_father = cur_obj.parentNode;
		next_obj = dom_next (cur_obj, cur_node_name);
		if (next_obj)
			cur_father.insertBefore (new_node, next_obj);
		else
			cur_father.appendChild (new_node);
	}
	
	function dom_remove (obj)
	{
		obj.parentNode.removeChild (obj);
	}

	function dom_replace (cur_obj, new_node)
	{
		cur_node_name = cur_obj.nodeName;
		cur_father = cur_obj.parentNode;
		next_obj = dom_next (cur_obj, cur_node_name);
		cur_father.removeChild (cur_obj);
		if (next_obj)
			cur_father.insertBefore (new_node, next_obj);
		else
			cur_father.appendChild (new_node);
	}
	
	
	

	function dom_process_node (xsltProcessor, cur_obj)
	{
		var xml_doc = document.implementation.createDocument('', '', null);
		imported_node = xml_doc.importNode(cur_obj, true);
		xml_doc.appendChild (imported_node);
		return xsltProcessor.transformToFragment(xml_doc, document);
	}

	function dom_process_xml (xsltProcessor, xml_doc)
	{
		new_doc = document.implementation.createDocument('', '', null);
		new_doc.appendChild(xml_doc.documentElement);
		return xsltProcessor.transformToFragment(new_doc, document);
	}
	
	function dom_xsl (xsltProcessor, url)
	{
		var ajax_req = new XMLHttpRequest();
		ajax_req.open("GET", url, false);
		ajax_req.send(null);
		xsltProcessor.importStylesheet(ajax_req.responseXML);
	}

	var ajax_pool = new Array;

	function dom_ajax_get (url, track_function, param1, param2)
	{
		var ajax_req = new XMLHttpRequest();
		ajax_pool[ajax_pool.length] = ajax_req;
		ajax_req.track_function = track_function;
		ajax_req.url = url;
		ajax_req.param1 = param1;
		ajax_req.param2 = param2;
		ajax_req.onreadystatechange = dom_ajax_track;
		ajax_req.open ('GET', url, true);
		ajax_req.send('');
		
	}

	function dom_ajax_track()
	{	
		for (var cur_index = 0; cur_index < ajax_pool.length; cur_index++)
		{
			ajax_req = ajax_pool[cur_index];
			if (ajax_req.readyState == 4)
			{
				if (ajax_req.status == 200)
				{
					if (ajax_req.responseXML)
					{
						xml_doc =  ajax_req.responseXML;
						ajax_req.track_function (xml_doc, ajax_req.param1, ajax_req.param2);
						ajax_pool.splice (cur_index, 1);
					}
					else if (ajax_req.responseText)
					{
						text_doc =  ajax_req.responseText;
						ajax_req.track_function (text_doc, ajax_req.param1, ajax_req.param2);
						ajax_pool.splice (cur_index, 1);
					}
					else
						alert("i2: dom_ajax_track error: answer empty:\n" + ajax_req.statusText);
				}
				else
					alert("i2: dom_ajax_track error:\n" + ajax_req.statusText);
			}
		}
	}
	
	
	

