var oEditor		= window.parent.InnerDialogLoaded();
var FCK			= oEditor.FCK;
var FCKLang		= oEditor.FCKLang;
var FCKConfig	= oEditor.FCKConfig;
var oLink = FCK.Selection.MoveToAncestorNode('A');
if (oLink) FCK.Selection.SelectNode(oLink);
window.onload = function()
{
	oEditor.FCKLanguageManager.TranslatePage(document);
	LoadSelection();
	window.parent.SetOkButton(true);
}
function LoadSelection()
{
	if (!oLink) return;
	var sHRef = oLink.getAttribute('_fcksavedurl');
	if (!sHRef || sHRef.length == 0) sHRef = oLink.getAttribute('href' , 2) + '';
	GetE('txtUrl').value = sHRef;
}
function Ok()
{
	var sUri;
	sUri = GetE('txtUrl').value;
	if (sUri.length == 0)
	{
		alert(FCKLang.DlnLnkMsgNoUrl);
		return false;
	}
	if (oLink)
	{
		oLink.href = sUri;
	}
	else
	{
		oLink = oEditor.FCK.CreateLink(sUri);
		if (!oLink) return true;
	}
	
	SetAttribute(oLink, '_fcksavedurl', sUri);
	SetAttribute(oLink, 'target', '_blank');
	return true;
}