var RikiButton=function()
{
        //create our own command, we dont want to use the FCKDialogCommand because it uses the default fck layout and not our own
};
RikiButton.prototype.Execute=function(){


}
RikiButton.GetState=function() {
        return FCK_TRISTATE_OFF; //we dont want the button to be toggled
}

RikiButton.Execute=function() {
        //open a popup window when the button is clicked
        //window.open('RikiButton.do', 'RikiButton', 'width=500,height=400,scrollbars=no,scrolling=no,location=no,toolbar=no');
		this.Riki();
		//alert( 'im hrer' );
		//return 'here';
}


RikiButton.Riki=function()
{
	if (FCK.EditorWindow.getSelection)
	{
		txt = FCK.EditorWindow.getSelection();
	}
	else if (FCK.EditorDocument.getSelection)
	{
		txt = FCK.EditorDocument.getSelection();
		//foundIn = 'document.getSelection()';
	}
	else if (FCK.EditorDocument.selection)
	{
		txt = FCK.EditorDocument.selection.createRange().text;
		//foundIn = 'document.selection.createRange()';
	}
	
	//alert( 'text = ' + txt );
	FCK.InsertHtml( '<a href="?a=riki&tag=' + txt + '">' + txt + '</a>' );
	

	
	
}


FCKCommands.RegisterCommand('RikiButton', RikiButton ); //otherwise our command will not be found

var oRikiButton = new FCKToolbarButton('RikiButton', 'RikiButton');
oRikiButton.IconPath = FCKConfig.PluginsPath + '/rikibutton/rikibuttion.gif'; //specifies the image used in the toolbar

FCKToolbarItems.RegisterItem( 'RikiButton', oRikiButton );
