/**
* Lxmenu v1.02
* Copyright 2005 Georg Lorenz
* DHTML Menu Module for Mambo Open Source
* Mambo Open Source is Free Software
* Released under GNU/GPL License: http://www.gnu.org/copyleft/gpl.html
**/

function popupWindow(url,width,height,toolbar,location,status,menubar,scrollbars)
{
	var options = 'toolbar='+toolbar+',location='+location+',status='+status+',menubar='+menubar+',scrollbars='+scrollbars+',resizable=yes';
	if(width > 0 && height > 0)
	{
		var centered;
		x = (screen.availWidth - width) / 2;
		y = (screen.availHeight - height) / 2;
		centered ='width=' + width + ',height=' + height + ',left=' + x + ',top=' + y + ',' + options;
	}else
	{
		centered = options;
	}	
	var popup = window.open(url, '_blank', centered);
    if (!popup.opener) popup.opener = self;
	popup.focus();
}

bbcode = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[img]','[/img]','[url]','[/url]','[code]','[/code]','[quote]','[/quote]');
function addtag(id,idx)
{
	// 0 = b
	// 1 = /b
	// 2 = i
	// 3 = /i
	// 4 = u
	// 5 = /u
	// 6 = img
	// 7 = /img
	// 8 = url
	// 9 = /url
	// 10 = code
	// 11 = /code
	// 12 = quote
	// 13 = /quote
	var txtarea = document.post.Body;
	var btn = document.getElementById(id);
	txtarea.value += bbcode[idx];
	txtarea.focus();
	if( id == idx )
	{
		btn.onclick = new Function("addtag("+id+","+(id+1)+");");
		btn.value = bbcode[id+1];
	}
	else
	{
		btn.onclick = new Function("addtag("+id+","+id+");");
		btn.value = bbcode[id];
	}
}
