	function Popup(url, w, h)
	{
		var x = 0;
		var y = 0;
		if((parseInt(navigator.appVersion) >= 4))
		{
			x = (screen.width - w) / 2;
			y = (screen.height - h) / 2;
		}
		if(x < 0)
			x = 0;
		if(y < 0)
			y = 0;
		tmp = window.open(url,'popup','width=' + w + ',height=' +h + ',location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,xposition='+ x +',left='+ x +',yposition='+ y +',top=' + y);
		tmp.focus();
	}

	function ToggleDiv(id)
	{
		var b = (navigator.appName.substring(0,2) == "Mi") ? 1:0;
		var oDiv = document.getElementById(id);
		if(oDiv != null)
		{
			if (b)
				oDiv.style.display = oDiv.style.display == 'inline' ? 'none' : 'inline';
			else
				oDiv.style.display = oDiv.style.display == 'table-cell' ? 'none' : 'table-cell';
		}
	}

	function ToggleBlockDiv(id)
	{
		var oDiv = document.getElementById(id);
		var v = oDiv.style.display == 'block';
		oDiv.style.display = v ? 'none' : 'block';
		var oTool = document.getElementById('tool'+id);
		if (oTool) {
			var width = oTool.clientWidth; 
			oTool.style.backgroundPosition = v ? '0 0' : '-'+width+'px 0';
		}
	}
	
	function ToggleTableRow(id)
	{
		var oTR = document.getElementById(id);
		var b = (navigator.appName.substring(0,2) == "Mi") ? 1:0;
		for(i=0,c=oTR.childNodes.length;i<c;i++)
		{
			var oTD = oTR.childNodes[i];
			if (b)
				oTD.style.display = oTD.style.display == 'none' ? 'inline' : 'none';
			else
				oTD.style.display = oTD.style.display == 'none' ? 'table-cell' : 'none';
		}
	}


	function ToggleImage(id, src1, src2)
	{
		var oImg = document.getElementById(id);
		if(oImg != null)
			oImg.src = oImg.src.indexOf(src2) != -1 ? src1 : src2;
	}

	function CalcAbsoluteTop(oEl, nLast)
	{
		if(oEl != null)
		{
			nLast = nLast + oEl.offsetTop;
			return CalcAbsoluteTop(oEl.offsetParent, nLast);
		}
		return nLast;
	}

	function CalcAbsoluteLeft(oEl, nLast)
	{
		if(oEl != null)
		{
			nLast = nLast + oEl.offsetLeft;
			return CalcAbsoluteLeft(oEl.offsetParent, nLast);
		}
		return nLast;
	}

	function ShowPopup(sId, oBase)
	{
		var b = (navigator.appName.substring(0,2) == "Mi") ? 1:0;
		var oPopup = document.getElementById(sId);
		if(b)
		{
			oPopup.style.top = CalcAbsoluteTop(oBase, 0) + 14;
			oPopup.style.left = CalcAbsoluteLeft(oBase, 0);
		}
		oPopup.style.display = 'block'
	}

	function onSelectOpen(event)
	{
		var ind = document.getElementById('list_imitation').style.zIndex;
		if (!ind || ind == -1)
			document.getElementById('list_imitation').style.zIndex = 5;
		else
			document.getElementById('list_imitation').style.zIndex = -1;
		var e = (event) ? event : window.event;
		e.cancelBubble = true;
	}
	function closeSelect()
	{
		document.getElementById('list_imitation').style.zIndex = -1;
	}

