
Element.implement({disableSelection:function(){if(Browser.Engine.trident){this.unselectable="on";var e,i=0;while((e=this.all[i++])){e.unselectable='on';}}else if(Browser.Engine.gecko){this.setStyle("MozUserSelect","none");}else if(Browser.Engine.webkit){this.setStyle("KhtmlUserSelect","none");this.addEvent("mousedown",$lambda(false));}else{this.setStyle("userSelect","none");}
return this;},isDisplayed:function(){return this.getStyle('display')!='none';},toggle:function(){return this[this.isDisplayed()?'hide':'show']();},hide:function(){var d;try{if('none'!=this.getStyle('display'))d=this.getStyle('display');}catch(e){}
return this.store('originalDisplay',d||'block').setStyle('display','none');},show:function(display){return this.setStyle('display',display||this.retrieve('originalDisplay')||'block');},swapClass:function(remove,add){return this.removeClass(remove).addClass(add);}});var SK_StyleDropDowm=new Class({Implements:Options,isIe6:$defined(Browser.Engine.trident4),dropDownWidth:null,selectedValue:null,selectedIndex:undefined,isOpen:false,options:{onChange:false,selectControl:false,dropDownCSS:'',maxHeight:300,dropDownHeight:18,dropDownEncoding:'utf-8',getCloseHandlerElements:function(){return[$(document.body)];}},closeHandlerElements:[],optionsMap:[],onControlChange:$lambda(true),initialize:function(options){this.setOptions(options);this.dropdownControl=$(options.selectControl);if($type(options.onChange)=='function'){this.onControlChange=options.onChange;}
if(Browser.loaded){this.onLoaded();}else{window.addEvent('domready',this.onLoaded.bind(this));}},onLoaded:function(){this.bounds={showList:this.showList.bindWithEvent(this),hideList:this.hideList.bindWithEvent(this),keydown:function(event){if(event.key=='esc'){this.hideList(event);}}.bind(this)};this.buildInput();this.buildList();this.listContainer.disableSelection();this.inputContainer.disableSelection();this.closeHandlerElements=this.options.getCloseHandlerElements();},buildInput:function(){this.dropDownWidth=this.dropdownControl.getStyle("width").toInt();this.dropDownHeight=this.options.dropDownHeight;this.inputLabel=new Element('div',{'class':'cdc-input-label'}).setStyle('width',this.dropDownWidth-16).grab(new Element('span'));this.inputButton=new Element('div',{'class':'cdc-input-button'});this.inputContainer=new Element('div',{'class':'cdc-input'}).grab(this.inputLabel).grab(this.inputButton).inject(this.dropdownControl,'after').setStyles({width:this.dropDownWidth,height:this.dropDownHeight}).addEvents({'mouseover':function(){this.addClass('cdc-over');},'mouseout':function(){this.removeClass('cdc-over');},'click':this.bounds.showList});this.dropdownControl.hide();},buildList:function(){this.listContainer=new IFrame({src:'/Shared/Html/style_drop_down.html?encoding='+this.options.dropDownEncoding,'onload':function(IFrameDocument){this.IFrame=IFrameDocument;var styleElement=this.IFrame.newElement('style',{"rel":"stylesheet","type":"text/css"}).inject(this.IFrame.head);if(Browser.Engine.trident){styleElement.styleSheet.cssText=this.options.dropDownCSS;}else{styleElement.appendChild(document.createTextNode(this.options.dropDownCSS));}
this.IFrameWindow=this.IFrame.getWindow();this.list=this.IFrame.newElement('ul').inject(this.IFrameWindow.$(this.IFrame.body).disableSelection());$each($A(this.dropdownControl.options),function(option,index){this.optionsMap[index]=option.value;var list_element=this.IFrame.newElement('li',{id:'cdc-list-item_'+index}).grab(this.IFrame.newElement('span',{'class':option.value}).set('text',option.text)).addEvents({'mouseover':function(){this.addClass('cdc-over');},'mouseout':function(){this.removeClass('cdc-over');},'click':function(e){this.hideList(e);this.setValueByIndex(index);this.setDropdownControlValue(index);}.bind(this)}).inject(this.list);if(option.selected){this.setValueByIndex(index);}},this);this.setContainerStyles.delay(1000,this);if(!$defined(this.selectedIndex)){this.setValue(0);}}.bind(this),"frameborder":"0","class":"cdc-list-iframe","style":"left:-1000px;top:-1000px;position:absolute;z-index:1;border: 1px solid #B7B7A6"}).inject(this.inputContainer,'after');},fixDropDownColors:function(){var color_names=new Hash({'rgba(0, 0, 0, 0)':'transparent','aliceblue':'#f0f8ff','antiquewhite':'#faebd7','aqua':'#00ffff','aquamarine':'#7fffd4','azure':'#f0ffff','beige':'#f5f5dc','bisque':'#ffe4c4','black':'#000000','blanchedalmond':'#ffebcd','blue':'#0000ff','blueviolet':'#8a2be2','brown':'#a52a2a','burlywood':'#deb887','cadetblue':'#5f9ea0','chartreuse':'#7fff00','chocolate':'#d2691e','coral':'#ff7f50','cornflowerblue':'#6495ed','cornsilk':'#fff8dc','crimson':'#dc143c','cyan':'#00ffff','darkblue':'#00008b','darkcyan':'#008b8b','darkgoldenrod':'#b8860b','darkgray':'#a9a9a9','darkgrey':'#a9a9a9','darkgreen':'#006400','darkkhaki':'#bdb76b','darkmagenta':'#8b008b','darkolivegreen':'#556b2f','darkorange':'#ff8c00','darkorchid':'#9932cc','darkred':'#8b0000','darksalmon':'#e9967a','darkseagreen':'#8fbc8f','darkslateblue':'#483d8b','darkslategray':'#2f4f4f','darkslategrey':'#2f4f4f','darkturquoise':'#00ced1','darkviolet':'#9400d3','deeppink':'#ff1493','deepskyblue':'#00bfff','dimgray':'#696969','dimgrey':'#696969','dodgerblue':'#1e90ff','firebrick':'#b22222','floralwhite':'#fffaf0','forestgreen':'#228b22','fuchsia':'#ff00ff','gainsboro':'#dcdcdc','ghostwhite':'#f8f8ff','gold':'#ffd700','goldenrod':'#daa520','gray':'#808080','grey':'#808080','green':'#008000','greenyellow':'#adff2f','honeydew':'#f0fff0','hotpink':'#ff69b4','indianred':'#cd5c5c','indigo':'#4b0082','ivory':'#fffff0','khaki':'#f0e68c','lavender':'#e6e6fa','lavenderblush':'#fff0f5','lawngreen':'#7cfc00','lemonchiffon':'#fffacd','lightblue':'#add8e6','lightcoral':'#f08080','lightcyan':'#e0ffff','lightgoldenrodyellow':'#fafad2','lightgray':'#d3d3d3','lightgrey':'#d3d3d3','lightgreen':'#90ee90','lightpink':'#ffb6c1','lightsalmon':'#ffa07a','lightseagreen':'#20b2aa','lightskyblue':'#87cefa','lightslategray':'#778899','lightslategrey':'#778899','lightsteelblue':'#b0c4de','lightyellow':'#ffffe0','lime':'#00ff00','limegreen':'#32cd32','linen':'#faf0e6','magenta':'#ff00ff','maroon':'#800000','mediumaquamarine':'#66cdaa','mediumblue':'#0000cd','mediumorchid':'#ba55d3','mediumpurple':'#9370d8','mediumseagreen':'#3cb371','mediumslateblue':'#7b68ee','mediumspringgreen':'#00fa9a','mediumturquoise':'#48d1cc','mediumvioletred':'#c71585','midnightblue':'#191970','mintcream':'#f5fffa','mistyrose':'#ffe4e1','moccasin':'#ffe4b5','navajowhite':'#ffdead','navy':'#000080','oldlace':'#fdf5e6','olive':'#808000','olivedrab':'#6b8e23','orange':'#ffa500','orangered':'#ff4500','orchid':'#da70d6','palegoldenrod':'#eee8aa','palegreen':'#98fb98','paleturquoise':'#afeeee','palevioletred':'#d87093','papayawhip':'#ffefd5','peachpuff':'#ffdab9','peru':'#cd853f','pink':'#ffc0cb','plum':'#dda0dd','powderblue':'#b0e0e6','purple':'#800080','red':'#ff0000','rosybrown':'#bc8f8f','royalblue':'#4169e1','saddlebrown':'#8b4513','salmon':'#fa8072','sandybrown':'#f4a460','seagreen':'#2e8b57','seashell':'#fff5ee','sienna':'#a0522d','silver':'#c0c0c0','skyblue':'#87ceeb','slateblue':'#6a5acd','slategray':'#708090','slategrey':'#708090','snow':'#fffafa','springgreen':'#00ff7f','steelblue':'#4682b4','tan':'#d2b48c','teal':'#008080','thistle':'#d8bfd8','tomato':'#ff6347','turquoise':'#40e0d0','violet':'#ee82ee','wheat':'#f5deb3','white':'#ffffff','whitesmoke':'#f5f5f5','yellow':'#ffff00','yellowgreen':'#9acd32'});var body=this.IFrameWindow.$(this.IFrame.body);var background_color=body.getComputedStyle('background-color');if(background_color){if($defined(color_names[background_color])){background_color=color_names[background_color];}
this.list.getElements('span').each(function(span){var color_chanels,color=span.getComputedStyle('color');if($defined(color_names[color])){color=color_names[color];}
if(background_color!=color){return;}
var span_background_color=span.getComputedStyle('background-color');if($defined(color_names[span_background_color])){span_background_color=color_names[span_background_color];}
if(span_background_color!=background_color&&span_background_color!='transparent'){return;}
if(color.match(/rgb/))color_chanels=color.rgbToHex().hexToRgb(true);else if(color.match(/hsb/))color_chanels=color.hsbToRgb();else color_chanels=color.hexToRgb(true);var inverted_color=color_chanels.map(function(value){return 255-value;}).rgbToHex();span.setStyle('background-color',inverted_color);},this);}},setContainerStyles:function(){this.fixDropDownColors();var content_size=this.list.getSize();if(content_size.y>this.options.maxHeight){content_size.y=this.options.maxHeight;}
var container_position=this.inputContainer.getPosition();this.listContainer.setStyles({"position":"absolute","top":container_position.y+this.inputContainer.getHeight(),"left":container_position.x,"width":content_size.x+20,"height":content_size.y,"display":"none","left":"","top":""});},setDropdownControlValue:function(index){var option=this.dropdownControl.options[index];this.dropdownControl.value=option.value;this.onControlChange(option.value);},setValueByIndex:function(index){var option=this.dropdownControl.options[index];if(this.selectedIndex!=index){if($defined(this.selectedIndex)){this.IFrameWindow.$('cdc-list-item_'+this.selectedIndex).removeClass('cdc-selected');}
this.IFrameWindow.$('cdc-list-item_'+index).addClass('cdc-selected');this.selectedIndex=index;this.inputLabel.getElement('span').set('text',option.text);}},setValue:function(value){var index=0;for(var i=0;i<this.optionsMap.length;i++){if(this.optionsMap[i]==value){index=i;break;}}
this.setValueByIndex(index);},showList:function(e){e.stop();if(this.isOpen){this.hideList(e);}else{this.listContainer.show().focus();for(var i=0;i<this.closeHandlerElements.length;i++){this.closeHandlerElements[i].addEvent('click',this.bounds.hideList);this.closeHandlerElements[i].addEvent('keydown',this.bounds.keydown);}
this.isOpen=true;}},hideList:function(e){if($type(e)=='event'){e.stop();}
for(var i=0;i<this.closeHandlerElements.length;i++){this.closeHandlerElements[i].removeEvent('click',this.bounds.hideList);this.closeHandlerElements[i].removeEvent('keydown',this.bounds.keydown);}
this.listContainer.hide();this.IFrameWindow.$$('li[id^=cdc-list-item_]').removeClass('cdc-over');this.isOpen=false;}});


function ConfigureStyleFormatPlugin(oRTE){var MapClassNameShortcutKey={plain:49,heading1:50,heading2:51,alert:52,plainfixedwidth:53,plainsmall:54,plainlarge:55};var toolbar_items_handlers=[];var method=ConfigureStyleFormatPlugin__extendWithStyleDropDowm();if(typeof(method)=='function'){toolbar_items_handlers.push(method);}
oRTE.getPluginById('StyleFormat').configure({styles:arrSKCSSStyles,shortcuts_map:MapClassNameShortcutKey,toolbar_items_handlers:toolbar_items_handlers});}
function ConfigureStyleFormatPlugin__extendWithStyleDropDowm(){if(typeof(SK_StyleDropDowm)=='function'){return function(oStyleSelector){var oldStyleSelectorSetValue=oStyleSelector.setValue.bind(oStyleSelector);oStyleSelector.setValue=function(value){styleDropDowm.setValue(value);oldStyleSelectorSetValue(value);}
var sCSS='';for(var i=0;i<window.sPageStylesheet.length;i++){sCSS+='@import url("'+window.sPageStylesheet[i]+'");\n';}
sCSS+=window.sCSSEditorStyle;var charset=$try(function(){return SK.Singletons.env.get('encoding');},function(){return window.parent.SK.Singletons.env.get('encoding');},function(){return(Browser.Engine.trident)?document.charset:document.characterSet;});var styleDropDowm=new SK_StyleDropDowm({selectControl:oStyleSelector.id,onChange:oStyleSelector.executeAction,dropDownCSS:sCSS,dropDownEncoding:charset,getCloseHandlerElements:function(){var elements=[];var d=$(document);elements.push($(d.documentElement));return elements;}});};}}
function ConfigureLinkPlugin(oRTE){oRTE.getPluginById('SKLink').configure({obj_id:iObjID,node_id:iNodeID,form_name:RTE_SKI_FORM_NAME});}
function RTE_InitSKLinksUI(oRTE,sPluginName){var oSKLinksUI=oRTE.getPluginById(sPluginName).SKLinksUI;oSKLinksUI.Manager.Init();}
function ConfigureLimitAreaPlugin(oRTE){oRTE.getPluginById('LimitArea').configure({width:iWidth});}
function ConfigureFormPlugin(oRTE){var oSKFormPlugin=oRTE.getPluginById('SKForm');oSKFormPlugin.configure({obj_id:iObjID,node_id:iNodeID,form_name:RTE_SKI_FORM_NAME,export_content_callback:SetFormProps,onregister_change_callback:FormPlugin_ActionRegisteredChanged});oSKFormPlugin.configureAction('SendToEmail',{default_email:sLoggedUserEmail,template_holder_element_id:'template_holder'});oSKFormPlugin.configureAction('SubmitToFB',{fb_list:oForumBlogList,template_holder_element_id:'template_holder'});oSKFormPlugin.configureAction('SendConfirmEmail',{default_email:sLoggedUserEmail,template_holder_element_id:'template_holder'});oSKFormPlugin.configureAction('MailingList',{ml_list:oMailingLists});if(oDatabasesList!=null){oSKFormPlugin.configureAction('FormToDB',{databases:oDatabasesList,default_email:sLoggedUserEmail});}}
function InitializeFormPlugin(oRTE){var oFormPlugin=oRTE.getPluginById('SKForm');if(iNodeID>0){var oForm=document.forms[RTE_SKI_FORM_NAME];var sFormProps=oForm['FormProps'+sEditTmplSuffix].value;oFormPlugin.importProperties(sFormProps);}else{oFormPlugin.setDefaults();}
oFormPlugin.select();}
function FormPlugin_ActionRegisteredChanged(sActionName,bRegistered){}
function SetFormProps(sFormProps){var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['FormProps'+sEditTmplSuffix].value=sFormProps;}
function Form_ShowAutoFillOptions(){Popup('autofill',"/Shared/StaticHtml/form_autofill_options.htm",540,320,1,1);}
function ConfigureRadioPlugin(oRTE){oRTE.getPluginById('Radio').configure({export_content_callback:SetRadioGroupProps});}
function InitializeRadioPlugin(oRTE){var oRadioPlugin=oRTE.getPluginById('Radio');if(iNodeID>0){var oForm=document.forms[RTE_SKI_FORM_NAME];var sRadioGroupProps=oForm['RadioGroupProps'+sEditTmplSuffix].value;if(!sRadioGroupProps){oRadioPlugin.setDefaults();}else{oRadioPlugin.setRadioGroups(sRadioGroupProps);}}else{oRadioPlugin.setDefaults();}}
function SetRadioGroupProps(sRadioGroupProps){var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['RadioGroupProps'+sEditTmplSuffix].value=sRadioGroupProps;}
function ConfigureSavePlugin(oRTE){oRTE.getPluginById('SKSave').configure({save_function:SaveContent});}
function ConfigurePastePlugin(oRTE,type){oRTE.getPluginById('SKPaste').configure({cleanup_type:type});}
function DisplaySpelling(sSpelledHTML,iMispelledCount,sRTEId){var oRTE=RTE_GetById(sRTEId);var oPlugin=oRTE.getPluginById('Spellchecker');oPlugin.spellingDone(sSpelledHTML,iMispelledCount);}
function ErrorSpelling(sRTEId){var oRTE=RTE_GetById(sRTEId);var oPlugin=oRTE.getPluginById('Spellchecker');oPlugin.errorSpelling();}
function DoSpellcheck(sHtmlContent,sRTEId,sPrefix,sAttrName){var oSpellcheckerFrame=document.getElementById('rte_spellchecker_frame').contentWindow;oSpellcheckerFrame.document.getElementById('html_string').value=sHtmlContent;oSpellcheckerFrame.document.getElementById('rte_id').value=sRTEId;oSpellcheckerFrame.document.getElementById('spellchecker').submit();}
function ConfigureSpellcheckerPlugin(oRTE){oRTE.getPluginById('Spellchecker').configure({spellcheck_function:DoSpellcheck});}
function ConfigureTablePlugin(oRTE){oRTE.getPluginById('Table').configure({change_color_function:ToggleColorWidget,recommended_colors:oTemplateColors[iTemplateKey]});}
function AddNewLocalImage(sImageSrc){var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_image_new_files'].value+=sImageSrc+',';}
function ConfigureImagePlugin(oRTE){oRTE.getPluginById('Image').configure({change_color_function:ToggleColorWidget,new_image_added_function:AddNewLocalImage,recommended_colors:oTemplateColors[iTemplateKey]});oRTE.getPluginById('Image').configure(oImageSharedConstants);var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_image_new_files'].value='';}
function AddNewLocalMedia(sImageSrc){var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_media_new_files'].value+=sImageSrc+',';}
function ConfigureMediaPlugin(oRTE){oRTE.getPluginById('Media').configure({change_color_function:ToggleColorWidget,new_media_added_function:AddNewLocalMedia,recommended_colors:oTemplateColors[iTemplateKey]});oRTE.getPluginById('Media').configure(oMediaSharedConstants);var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_media_new_files'].value='';}
function AddNewAnchor(){var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_new_anchor_added'].value=1;}
function ConfigureAnchorPlugin(oRTE){oRTE.getPluginById('Anchor').configure({new_anchor_added_function:AddNewAnchor});oRTE.getPluginById('Anchor').configure(oAnchorSharedConstants);var oForm=document.forms[RTE_SKI_FORM_NAME];oForm['rte_new_anchor_added'].value=0;}
function ConfigureSnippetPlugin(oRTE){oRTE.getPluginById('Snippet').configure(oSnippetSharedConstants);}
function ConfigureColorPickerPlugin(oRTE){oRTE.getPluginById('ColorPicker').configure({recommended_colors:oTemplateColors[iTemplateKey]});}
var oLastCleanupPlugin=null;var oLastUploadFilesPopupWnd=null;var oFilesPopupWndTimeout=null;function UploadLocalFiles(iLocalFilesCount,sLocalFilesSrc,oPlugin){if(!(oLastUploadFilesPopupWnd==null||oLastUploadFilesPopupWnd.closed)){alert('Please first close any opened popup windows with local files upload!');return;}
oLastCleanupPlugin=oPlugin;var sParamFilesSrc=sLocalFilesSrc;if(document.all){sParamFilesSrc=escape(sParamFilesSrc);}
var sUrl=sLocalFilesUploadFileSrc+'?files_cnt='+iLocalFilesCount+'&files_src='+sParamFilesSrc;var FILES_POPUP_WIDTH=490;var FILES_POPUP_HEIGHT=280;oLastUploadFilesPopupWnd=Popup('rte_local_files',sUrl,FILES_POPUP_WIDTH,FILES_POPUP_HEIGHT,true,false);oFilesPopupWndTimeout=window.setInterval('CheckLocalFilesPopup()',500);}
function CheckLocalFilesPopup(){if(oLastUploadFilesPopupWnd==null||oLastUploadFilesPopupWnd.closed){window.clearTimeout(oFilesPopupWndTimeout);LocalFilesUploaded();}}
function LocalFilesUploaded(sFilesSrc){window.clearTimeout(oFilesPopupWndTimeout);if(oLastCleanupPlugin==null){return;}
var sNewFilesStr='';if(isDefined(sFilesSrc)){var sSeparator='|';sFilesSrc=unescape(sFilesSrc);sFilesSrc=sFilesSrc.substr(0,sFilesSrc.length-1);var arrReturnFilesSrc=sFilesSrc.split(sSeparator);for(var i=0;i<arrReturnFilesSrc.length;i++){var sFileSrc=arrReturnFilesSrc[i];AddNewLocalImage(sFileSrc);sNewFilesStr+=sFileSrc+sSeparator;}}
oLastCleanupPlugin.localFilesUploaded(sNewFilesStr);oLastCleanupPlugin=null;}
function ConfigureCleanupPlugin(oRTE){oRTE.getPluginById('Cleanup').configure({upload_local_files_function:UploadLocalFiles});}
function ConfigureHandleErrorPlugin(oRTE){oRTE.getPluginById('HandleError').configure({external_report_function:RTE_ReportError});}
function RTE_ReportError(oRTE,sErrorMessage){if(isUndefined(oRTE)){var oForm=document.forms[RTE_SKI_FORM_NAME];if(oForm!=null){var oRTEIdHolderField=oForm['rte_id'];if(oRTEIdHolderField!=null){oRTE=RTE_GetById(oRTEIdHolderField.value);}}}
if(isDefined(oRTE)){var sLogs=oRTE.getLogMessages();sErrorMessage+='\n\n RTE Logs:['+GetSKEnvironmentString()+'\n'+sLogs+']';}
if(RTE_DEBUG_MODE){alert(sErrorMessage);}
var oLogFrame=document.getElementById('rte_log_frame');if(oLogFrame==null){alert('No Log frame found ....');return;}
oLogFrame.contentWindow.LogError(sErrorMessage);}
function RTE_LogActions(oRTE){var sLogs=oRTE.getLogMessages();var oLogFrame=document.getElementById('rte_log_frame');if(oLogFrame==null){alert('No Log frame found ....');return;}
oLogFrame.contentWindow.LogAction(GetSKEnvironmentString()+'\n'+sLogs);}
function GetSKEnvironmentString(){var sSKENV='SK Environment:\n';sSKENV+='NodeID => ['+iNodeID+']\n';sSKENV+='ObjID => ['+iObjID+']\n';sSKENV+='TmplKey => ['+iTemplateKey+']\n';sSKENV+='CSKey => ['+iColorSchemeKey+']\n';sSKENV+='RTE_DEBUG_MODE => ['+RTE_DEBUG_MODE+']\n';return sSKENV;}
function RTESetBrowserNotSupported(){document.getElementById('rte_holder_id').innerHTML=document.getElementById('rte_env_not_supported').innerHTML;}
var sRTETooltipKey='rte_hint';if(typeof(TOOLTIPS)=='undefined'){TOOLTIPS=[];}
if(typeof(NO_ESCAPE)=='undefined'){NO_ESCAPE=[];}
TOOLTIPS[sRTETooltipKey]='';NO_ESCAPE[sRTETooltipKey]=1;var RTE_TOOLTIP_WIDTH=200;var RTE_TOOLTIP_HEIGHT=25;var RTE_TOOLTIP_RIGHT_OFFSET=245;var iCheckHintIntervalId=null;var sLastHintMessage='';function RTE_ShowHint(sHint,oDomObj){if(sLastHintMessage==sHint&&_TOOLTIP_IS_ALREADY_SHOWN){return;}
var RTE_TOOLTIP_LEFT=document.body.clientWidth-RTE_TOOLTIP_RIGHT_OFFSET-RTE_TOOLTIP_WIDTH;if(iCheckHintIntervalId!=null){window.clearTimeout(iCheckHintIntervalId);}
TOOLTIPS[sRTETooltipKey]=sHint;sLastHintMessage=sHint;var iTopPosition=0;if(document.all){iTopPosition=window.event.y;}else{iTopPosition=FF_mouse_y;}
iTopPosition-=RTE_TOOLTIP_HEIGHT;ShowTooltip(oDomObj,sRTETooltipKey,RTE_TOOLTIP_WIDTH,RTE_TOOLTIP_HEIGHT,undefined,undefined,RTE_TOOLTIP_LEFT,iTopPosition);if(!oDomObj.id){oDomObj.id='qq'+Math.random().toString().substr(2,6);}
iCheckHintIntervalId=window.setInterval('RTE_CheckHintForClosing("'+oDomObj.id+'")',200);}
function RTE_CheckHintForClosing(sDomId){if(document.getElementById(sDomId)!=null){return;}
window.clearTimeout(iCheckHintIntervalId);iCheckHintIntervalId=null;RTE_HideHint();}
function RTE_HideHint(){HideTooltip();}
var FF_mouse_y=0;function SetFFMouseY(e){FF_mouse_y=e.clientY;}
function ConfigureRTEHints(oRTE){if(!document.all){window.onmousemove=SetFFMouseY;}
oRTE.configure({external_hint_handler:RTE_ShowHint})}
oColorWidgets={};oCurrentColorWidget=null;function ToggleColorWidget(oColorSelect){var id=oColorSelect.data.parent;var colors=oColorSelect.data.colors;var parent=document.getElementById(id);var widget=null;if(oColorWidgets[id]){widget=oColorWidgets[id];widget.attach(parent);if(widget.root)widget.root.style.display='block';}else{widget=new ColorWidget(parent,colors,document.getElementById('color_widget_template').innerHTML,128);widget.setManualColor(oColorSelect.getColor());widget.ontoggle=function(extended){CoverElements(oColorSelect.plugin,oColorSelect.data.cover,extended?'extended':'basic');}
widget.onselect=function(color){ToggleColorWidget(oColorSelect);oColorSelect.setNewColor(color);}
widget.oncancel=function(){ToggleColorWidget(oColorSelect);}
oColorWidgets[id]=widget;var clickOutside=function(e){var target=(e.target?e.target:e.srcElement);for(var curr=target,inside=false;curr;curr=curr.parentNode){if(curr==widget.root){inside=true;break;}}
if(!inside&&oCurrentColorWidget&&oCurrentColorWidget==widget){ToggleColorWidget(oColorSelect);}}
var body=document.body;if(body.addEventListener){body.addEventListener('click',clickOutside,false);}else{body.attachEvent('onclick',clickOutside);}}
if(parent.style.visibility=='visible'){parent.style.visibility='hidden';CoverElements(oColorSelect.plugin,oColorSelect.data.cover,'hidden');oCurrentColorWidget=null;}else{CoverElements(oColorSelect.plugin,oColorSelect.data.cover,'basic');if(oCurrentColorWidget){oCurrentColorWidget.oncancel();}
oCurrentColorWidget=widget;parent.style.visibility='visible';if(widget.extended)widget.toggle();}}
function CoverElements(plugin,config,mode){var elems=config?config[mode]:null;if(elems){for(var name in elems){var elem=document.getElementById(name)||document.getElementById(plugin.propertyPanel.getPropElementId(name));if(elem){elem.style.visibility=(elems[name])?'visible':'hidden';}}}}
function ResizeRTEContentArea(){var iHeight=parseInt(document.body.clientHeight);var HEIGHT_OF_EDIT_TMPL=130;var MINIMAL_CONTENT_HEIGHT=200;if(iHeight>HEIGHT_OF_EDIT_TMPL){var iContentHeight=iHeight-HEIGHT_OF_EDIT_TMPL;if(iContentHeight<MINIMAL_CONTENT_HEIGHT){iContentHeight=MINIMAL_CONTENT_HEIGHT;}
var oForm=document.forms[RTE_SKI_FORM_NAME];var oRTE=RTE_GetById(oForm['rte_id'].value);oRTE.setContentAreaDimensions(null,iContentHeight);}
document.body.scroll='no';}
function SetRTELogLevel(oRTE){var iLogLevel=RTE_CONST.LL_ACTION;if(RTE_DEBUG_MODE){iLogLevel=RTE_CONST.LL_DEBUG;}
oRTE.configure({log_level:iLogLevel});}


function Popup(name,url,width,height,scrollbars,resizable,left,top,menubar,toolbar,loc_bar,statusbar,directories){var wnd;var xcen,ycen;var nn=document.layers?1:0;width=width?width:300;height=height?height:300;xcen=(screen.availWidth-width)/2;ycen=(screen.availHeight-height)/2;directories=directories?',directories=yes':',directories=no';loc_bar=loc_bar?',location=yes':',location=no';statusbar=statusbar?',status=yes':',status=no';toolbar=toolbar?',toolbar=yes':',toolbar=no';menubar=menubar?',menubar=yes':',menubar=no';resizable=resizable?',resizable=yes':',resizable=no';scrollbars=scrollbars?',scrollbars=yes':',scrollbars=no';width=width?('width='+width):'width=300';height=height?(',height='+height):',height=300';left=left?((nn?',screenX=':',left=')+left):((nn?',screenX=':',left=')+xcen);top=top?((nn?',screenY=':',top=')+top):((nn?',screenY=':',top=')+ycen);document.body.style.cursor='wait';wnd=window.open(url,name,width+height+scrollbars+resizable+
left+top+menubar+toolbar+loc_bar+statusbar+
directories);document.body.style.cursor='default';if(wnd!=null){wnd.focus();}
return wnd;}


SAVE_CONTENT_FRAME_ID='rte_save_frame';SAVE_CONTENT_FORM_ID='save_form';EDIT_TMPL_FORM_NAME='ObjEditForm';EDIT_TMPL_SUBMIT_BUTTON_ID='submitbutton';RTE_SK_SAVE_PLUGIN_NAME='SKSave';WCE_CONTENT_PROP_NAME='HtmlText';MSG_STILL_SAVING='Another save process is still running.';MSG_ERROR_SAVING_CONTENT='Error saving content.';MSG_CONTENT_EXPIRED='Your edit session has expired. Please export your content and login again.';MSG_NEW_RTE_ADDING='You are about to add a new object. The current page will close. Continue?';MSG_NEW_FILES_UPLOADED='There are new files uploaded. The page must reload. Continue?';MSG_NEW_ANCHORS_ADDED='There are new anchors added. The page must reload. Continue?';MSG_NEW_MLIST_ADDED='There is new mailing list added. The page must reload. Continue?';MSG_COVER_RELOADING='Reloading page';var COVER_IMAGE_SRC='half_transparent.gif';var bSaveRunning=false;var bReloadAfterSave=false;function SaveContent(sContent,sRTEId){if(bSaveRunning){var oSavePlugin=RTE_GetById(sRTEId).getPluginById(RTE_SK_SAVE_PLUGIN_NAME);oSavePlugin.failSaveContent(MSG_STILL_SAVING);};if(!node_id){if(confirm(MSG_NEW_RTE_ADDING)){SubmitEditTmpl();}}else{var oForm=document.forms[EDIT_TMPL_FORM_NAME];if(oForm.rte_image_new_files.value!=''||oForm.rte_media_new_files.value!=''||oForm.rte_new_anchor_added.value>0||oForm.new_mlist!=null&&oForm.new_mlist.value>0){var sConfirmationMessage=MSG_NEW_FILES_UPLOADED;if(oForm.rte_new_anchor_added.value>0){sConfirmationMessage=MSG_NEW_ANCHORS_ADDED;}else if(oForm.new_mlist!=null&&oForm.new_mlist.value>0){sConfirmationMessage=MSG_NEW_MLIST_ADDED;}
if(!confirm(sConfirmationMessage)){return;}else{bReloadAfterSave=true;var progress_ui=new SK.UI.Progress();progress_ui.init(MSG_COVER_RELOADING);progress_ui.display();}}
bSaveRunning=true;PerformSave(sContent,sRTEId);RTE_LogActions(RTE_GetById(sRTEId));}}
function PerformSave(sContent,sRTEId){redirected_from_old_obj_id=1;var oSaveContentFrame=document.getElementById(SAVE_CONTENT_FRAME_ID).contentWindow;var sFieldsHTML='';var oSrcForm=document.forms[EDIT_TMPL_FORM_NAME];var arrInputElements=oSrcForm.getElementsByTagName('INPUT');var arrElementValues=[];for(var i=0;i<arrInputElements.length;i++){var oElement=arrInputElements[i];var sElementValue=oElement.getAttribute('value');var sElementName=oElement.getAttribute('name');if(!sElementName){continue;}
arrElementValues.push({name:sElementName,value:sElementValue})
sFieldsHTML+='<input '+'type  = "'+oElement.getAttribute('type')+'" '+'name  = "'+oElement.getAttribute('name')+'" '+'id    = "'+oElement.getAttribute('name')+'" '+'>';}
var oSaveContentForm=oSaveContentFrame.document.getElementById(SAVE_CONTENT_FORM_ID);if(oSaveContentForm==null){ErrorSavingContent(sRTEId,MSG_STILL_SAVING);return;}
oSaveContentForm.innerHTML=sFieldsHTML;for(var i=0;i<arrElementValues.length;i++){oSaveContentForm[arrElementValues[i].name].value=arrElementValues[i].value;}
oSaveContentForm.action=oSaveContentFrame.TEMPLATE_NAME;oSaveContentForm.rte_id.value=sRTEId;oSaveContentForm[WCE_CONTENT_PROP_NAME+sEditTmplSuffix].value=sContent;oSaveContentForm.pp_rte_add_update.value='go';oSaveContentForm.content_saved.value=1;oSaveContentForm.submit();}
function ContentSaved(sRTEId){bSaveRunning=false;var oSavePlugin=RTE_GetById(sRTEId).getPluginById(RTE_SK_SAVE_PLUGIN_NAME);oSavePlugin.contentSavedSuccess();if(bReloadAfterSave){location.reload();}}
function ErrorSavingContent(sRTEId,sErrMessage){bSaveRunning=false;var oSavePlugin=RTE_GetById(sRTEId).getPluginById(RTE_SK_SAVE_PLUGIN_NAME);if(!sErrMessage){sErrMessage=MSG_ERROR_SAVING_CONTENT;}
oSavePlugin.failSaveContent(sErrMessage);}
function ContentExpired(sRTEId){bSaveRunning=false;alert(MSG_CONTENT_EXPIRED);}
function SubmitEditTmpl(){document.getElementById(EDIT_TMPL_SUBMIT_BUTTON_ID).click();}


