var oFCKeditor = null;
var wysiwyg = null;
var oFCKactivated = false;

function showElement(x)
{
	if (document.getElementById(x))
		document.getElementById(x).style.display = '';
}

function hideElement(x)
{
	if (document.getElementById(x))
		document.getElementById(x).style.display = 'none';
}

function showAndTrackElement (el, div, alignX, alignY)
{
	if (document.getElementById)
	{
		var i = document.getElementById(el);
		var c = document.getElementById(div);
		if (c.style.display != "block")
		{
			var box = getRelativeDimension(i,'container');
			var left = box.x, top = box.y;
			c.style.visibility = 'hidden';
			c.style.display = "block";
//alert(""+left+","+top)
			if(alignX == 'left')
				left -= c.offsetWidth;
			else
				left += i.offsetWidth;
			if(alignY == 'top')
				top -= c.offsetHeight;
			else
				top += i.offsetHeight;
//alert(""+c.offsetWidth+","+i.offsetHeight)
			if(top<10)
				top = 10;
			if(left<0)
				left = 10;
			//if(gClientIsIE5)
			if(false)
			{
				left += document.body.scrollLeft;
				top += document.body.scrollTop;
			}
			c.style.left = left+'px';
			c.style.top = top+'px';
			c.style.visibility = 'visible';
		}
		else
		{
			c.style.display="none";
		}
	}
}

function activateFck(areaId,areaWidth,areaHeight,toolbarSet)
{
	if ( !oFCKactivated )
	{
		oFCKeditor = new FCKeditor(areaId);
		oFCKeditor.BasePath = "/javascript/fckeditor/";
		oFCKeditor.Width = areaWidth;
		oFCKeditor.Height = areaHeight;
		oFCKeditor.Config["ToolbarStartExpanded"] = true;
		oFCKeditor.ToolbarSet=toolbarSet;
		//oFCKeditor.Config["SkinPath"] = "/editor/fck/editor/skins/default/";
		oFCKeditor.ReplaceTextarea()
		wysiwyg = oFCKeditor._IsCompatibleBrowser();

		oFCKactivated = true;
	}
}

	function transposeAddress(userid,domainName,domainExt,subject)
	{
		var email = domainName + '.' + domainExt +'@' + userid;
		var TempBefore = '';
		var TempAfter = '';
		var NewString = '';
		var Start = 0;

		var WhereHash = email.indexOf ('@');
		for (Count = 1; Count <= WhereHash; Count ++)
		{
			TempBefore += email.substring (Start, Count);
			Start++
		}
		Start = WhereHash;
		Start ++
		WhereHash +=2;
		for (Count = WhereHash; Count <=email.length; Count++)
		{
			TempAfter +=email.substring (Start, Count)
			Start++
		}
		NewString = TempAfter +'@' + TempBefore;
		parent.location = 'mailto:'+NewString+'?subject='+subject;
	}

	function chiocciola()
	{
		document.write('@');
	}