   RadEditorCommandList["InsertImage"] = function(commandName, editor, oTool)
   {      
	 addImage();
   };
   RadEditorCommandList["InsertDocLink"] = function(commandName, editor, oTool)
   {      
     addLink('Document', editor);
   };
   RadEditorCommandList["InsertFolderLink"] = function(commandName, editor, oTool)
   {      
     addLink('Article', editor);
   };
   RadEditorCommandList["InsertResourceLink"] = function(commandName, editor, oTool)
   {      
     addResource(editor);
   };
   RadEditorCommandList["HelpPersonalise"] = function(commandName, editor, oTool)
   {      
     PersonalisedHelp();
   };

	function addImage()
	{
		var ImageWindow;
		ImageWindow = window.open('UploadImage.aspx?CameFrom=ContentEditor', 'ImageFile', 'toolbar=no,width=730,height=600,resizable, scrollbars');
		
	}
	function addLink(sLinkType, editor)
	{
		var bSelected=false;

		if (editor.GetSelectionHtml().length > 0)
		{
		    bSelected = true;
		} 

		//display the add link window only if something is selected
		if (bSelected){
			var linkWindow;
			if (sLinkType =='Document') {
				linkWindow = window.open('UploadFile.aspx?CameFrom=ContentEditor', 'linkFile', 'toolbar=no,width=700,height=600,resizable, scrollbars');
			}
			else if (sLinkType =='Article') {
				linkWindow = window.open('AddContentLinks.aspx?CameFrom=ContentEditor', 'linkFile', 'toolbar=no,width=600,height=500,resizable, scrollbars');	
			}
		}
		else{
			alert("Please select some text or image to create a link.");
		}   

			
	}
	
	function addImageToEditor(imageval,altText)
	{		
			if (imageval != "")
			{
				imageval = imageval + '"  alt="' + altText + '" border=0'
				document.execCommand("InsertImage", false, imageval);
			}
			else
			{
			alert("Please select an image")
			return
			}
	}
	function addDocumentLinkToEditor(theURL)
	{
		document.execCommand('CreateLink',false, theURL);
	}

	function addResource(editor)
	{

		var bSelected=false;
		if (editor.GetSelectionHtml().length > 0)
		{
		    bSelected = true;
		} 

		//display the add link window only if something is selected
		if (bSelected){
			var linkWindow;
			window.open('ResourceLink.aspx', 'ResourceLink', 'toolbar=no,width=700,height=600,resizable, scrollbars');
		}
		else{
			alert("Please select some text or image to create a link.");
		}   
		
	}
	function addResourceLinkToEditor(theURL)
	{
		document.execCommand('CreateLink',false, theURL);
	}

	function PersonalisedHelp()
	{
		var HelpWindow;
		HelpWindow = window.open('PersonaliseHelp.htm', 'PersonalisedHelp', 'toolbar=no,width=400,height=400,resizable, scrollbars');		
	}
