function Root()
	{
	function _dhtml()
		{
		var browserId = (document.all) ? 'ie' : ((document.getElementById) ? 'other' : null);
		var mouseX = 0;
		var mouseY = 0;
		
		function setPosition(tagId, x, y)
   		{
   		if(browserId == 'ie')
      		{
      		document.all[tagId].style.left = x+'px';
      		document.all[tagId].style.top = y+'px';
      		}
   		if(browserId == 'other')
      		{
      		document.getElementById(tagId).style.left = x+'px';
				document.getElementById(tagId).style.top = y+'px';
      		}
   		}
		
		function setVisibility(tagId, visibility)
   		{
   		if(browserId == 'ie')
      		document.all[tagId].style.visibility = (visibility) ? 'visible' : 'hidden';
   		if(browserId == 'other')
				document.getElementById(tagId).style.visibility = (visibility) ? 'visible' : 'hidden';
   		}
		
		function setOpacity(tagId, opacity)
   		{
   		if(browserId == 'ie')
      		document.all[tagId].style.filter = 'alpha(opacity='+opacity+')';
   		if(browserId == 'other')
      		document.getElementById(tagId).style.MozOpacity = opacity+'%';
   		}
		
		function setInnerHTML(tagId, string)
   		{
   		if(browserId == 'ie')
      		document.all[tagId].innerHTML = string;
   		if(browserId == 'other')
				document.getElementById(tagId).innerHTML = string;
   		}
		
		function setZIndex(tagId, zIndex)
   		{
   		if(browserId == 'ie')
      		document.all[tagId].style.zIndex = zIndex;
   		if(browserId == 'other')
      		document.getElementById(tagId).style.zIndex = zIndex;
   		}
		
		function setClip(tagId, t, r, b, l, w, h)
   		{
			if(w && h)
				{
				r = w-r;
				b = h-b;
				}
   		if(browserId == 'ie')
	   		document.all[tagId].style.clip = 'rect('+t+'px '+r+'px '+b+'px '+l+'px)';
   		if(browserId == 'other')
				document.getElementById(tagId).style.clip = 'rect('+t+'px '+r+'px '+b+'px '+l+'px)';
   		}
		
		function getInnerHTML(tagId)
   		{
   		if(browserId == 'ie')
      		return document.all[tagId].innerHTML;
   		if(browserId == 'other')
				return document.getElementById(tagId).innerHTML;
   		}
		
		function getAreaX()
   		{
   		if(browserId == 'ie')
				return document.body.scrollLeft;
   		if(browserId == 'other')
				return window.pageXOffset;
   		}
	
		function getAreaY()
   		{
   		if(browserId == 'ie')
				return document.body.scrollTop;
   		if(browserId == 'other')
				return window.pageYOffset;
   		}
		
		function getMouseX(relative)
   		{
			return (relative) ? mouseX-getAreaX() : mouseX;
   		}
		
		function getMouseY(relative)
   		{
			return (relative) ? mouseY-getAreaY() : mouseY;
   		}
		
		this.setPosition = setPosition;
		this.setVisibility = setVisibility;
		this.setOpacity = setOpacity;
		this.setInnerHTML = setInnerHTML;
		this.setZIndex = setZIndex;
		this.setClip = setClip;
		this.getInnerHTML = getInnerHTML;
		this.getAreaX = getAreaX;
		this.getAreaY = getAreaY;
		this.getMouseX = getMouseX;
		this.getMouseY = getMouseY;
		
		function getMouseEvent(e)
   		{
   		if(browserId == 'ie')
				{
				mouseX = event.clientX+document.body.scrollLeft;
	   		mouseY = event.clientY+document.body.scrollTop;
				}
   		if(browserId == 'other')
      		{
				mouseX = e.pageX;
	   		mouseY = e.pageY;
				}
   		}
		
		document.onmousemove = getMouseEvent;
		}
	
	function _messages()
		{
		this.layerId = '';
		this.menuHTML = '';
		this.textHTML = '';
		
		function show(messages)
			{
			var stringHTML = this.menuHTML;
			for(var id in messages)
				stringHTML += changeKeyWords(this.textHTML, {'text' : messages[id]});
			if(id)
				{
				dhtml.setInnerHTML(this.layerId, stringHTML);
				dhtml.setVisibility(this.layerId, true);
				}
			}
		
		function clear()
			{
			dhtml.setVisibility(this.layerId, false);
			dhtml.setInnerHTML(this.layerId, '');
			}
		
		this.show = show;
		this.clear = clear;
		}

	function _ajaxRequest()
		{
		var req = mint.Request();
		req.retryNum = 1;
		req.timeout = 8000;
		
		function send(url, jsFxName, formId)
			{
			req.OnSuccess = function()
   			{
				try
					{
					eval('var jsonData = '+this.responseText);
					this.responseText = '';
					if(typeof jsonData.data != 'object')
						throw changeKeyWords(words.errors['3'], {'object' : 'jsonData.data'});
					if(typeof jsonData.messages != 'object')
						throw changeKeyWords(words.errors['3'], {'object' : 'jsonData.messages'});
					messages.show(jsonData.messages);
					eval(jsFxName+'(jsonData.data);');
					}
		  		catch(error)
					{
					if(this.responseText)
						{
						document.write(this.responseText);
						document.close();
						}
					else
						window.alert(error);
					}
				}
			
			req.OnError = function()
				{
				window.alert(words.errors['1']);
				}
			
			req.OnAbort = function()
				{
				window.alert(words.errors['2']);
				}
			
			if(formId)
				req.SendForm(formId, url);
			else
				req.Send(url);
			}
		
		this.send = send;
		}
	
	function changeKeyWords(string, keyWords)
		{
		for(var id in keyWords)
			eval('string = string.replace(/\\{\\$'+id+'\\}/g, keyWords[id]);');
		return string;
		}
	
	var dhtml = new _dhtml();
	var messages = new _messages();
	var ajaxRequest = new _ajaxRequest();
	
	this.dhtml = dhtml;
	this.messages = messages;
	this.ajaxRequest = ajaxRequest;
	this.changeKeyWords = changeKeyWords;
	}
