﻿/* Contegro add-on methods */
launchParameters = new Object();
function callBackFunctionPtr(returnValue) {
    if (returnValue) {
        launchParameters['LSeditor'].PasteHtml(returnValue);
    }
}
try{
RadEditorCommandList["LSCreateInternalLink"] = function(commandName, editor, oTool) {
	launchParameters['LSeditor'] = editor;
	launchParameters['LStool'] = oTool;
    editor.ShowDialog("/Resources/RadControls/Editor/Controls/CreateInternalLink.aspx", launchParameters, 380, 195, callBackFunctionPtr, null, "Internal Link");
    return false;
};}catch(err){}
try{
RadEditorCommandList["LSCreateDocumentLink"] = function(commandName, editor, oTool) {
	launchParameters['LSeditor'] = editor;
	launchParameters['LStool'] = oTool;
    editor.ShowDialog("/Resources/RadControls/Editor/Controls/CreateDocumentLink.aspx", launchParameters, 380, 195, callBackFunctionPtr, null, "Internal Link");
    return false;
};}catch(err){}
try{
RadEditorCommandList["LSImageGallery"] = function(commandName, editor, oTool) {
	launchParameters['LSeditor'] = editor;
	launchParameters['LStool'] = oTool;
    editor.ShowDialog("/Modules/LSImageManager/ImageGallery.aspx", launchParameters, 800, 680, callBackFunctionPtr, null, "Internal Link");
    return false;
};}catch(err){}
try{
RadEditorCommandList["LSHelp"] = function(commandName, editor, oTool) {
	launchParameters['LSeditor'] = editor;
	launchParameters['LStool'] = oTool;
	var EditorHelp = window.open('/Admin/Help/HTML/word_editor_controls.htm', 'EditorHelp', 'width=800, height=570, status=1, resizable=1, scrollbar=1');
	try{EditorHelp.focus();}catch(err){}
	return false;
};}catch(err){}
try{
RadEditorCommandList["LSWordClean"] = function(commandName, editor, oTool) {
	var text = this.designEditor.document.body.innerHTML;
	// Remove all SPAN tags
    text = text.replace(/<\/?SPAN[^>]*>/gi, "" );
	// Remove Class attributes
	text = text.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	// Remove Style attributes
	text = text.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
	// Remove Lang attributes
	text = text.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	// Remove XML elements and declarations
	text = text.replace(/<\\?\?xml[^>]*>/gi, "") ;
	// Remove Tags with XML namespace declarations: <o:p></o:p>
	text = text.replace(/<\/?\w+:[^>]*>/gi, "") ;
	// Replace the &nbsp;
	text = text.replace(/&nbsp;/, " " );
	// Transform <P> to <DIV>
//	var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ;	// Different because of a IE 5.0 error
//	text = text.replace( re, "<div$2</div>" ) ;
	text=text.replace(/<FONT[^>]*>/gi,"");
	text=text.replace(/<\/FONT>/gi,"");
	text=text.replace(/<U>/gi,"");
	text=text.replace(/<\/U>/gi,"");
	text=text.replace(/<H[^>]*>/gi,"");
	text=text.replace(/<\/H[^>]*>/gi,"");
	this.designEditor.document.body.innerHTML = text;
	this.ExecuteCommand('removeformat');
    return false;
};}catch(err){}

