/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/
*/

if(typeof EktronContentDesignerNS!="object")EktronContentDesignerNS={};EktronContentDesignerNS.onexception=function(ex,args,callee)
{if(document.cookie&&document.cookie.indexOf("ContentDesigner.onexception=")>-1)
{Ektron.OnException.alertException(ex,args,callee);}
if(typeof console!="undefined"&&console&&console.error&&document.cookie&&document.cookie.indexOf("ContentDesigner.console=")>-1)
{Ektron.OnException.consoleException(ex,args,callee);}}
EktronContentDesignerNS.trace=function()
{if(typeof console!="undefined"&&console&&console.log&&document.cookie&&document.cookie.indexOf("ContentDesigner.console=")>-1)
{console.log.apply(console,arguments);}}
EktronContentDesignerNS.onContentWindowChange=function(win,targetElement,context)
{try
{if(win)
{var theEditor=GetRadEditor(context.editorId);theEditor.ContentWindow=win;theEditor.Document=theEditor.ContentWindow.document;theEditor.ContentArea=theEditor.Document.body;if(theEditor.ContentAreaEventHandlers)
{var srcElement=theEditor.IsIE?theEditor.Document.body:theEditor.Document;for(var evName in theEditor.ContentAreaEventHandlers)
{var eventHandler=theEditor.ContentAreaEventHandlers[evName];if("function"==typeof eventHandler)
{RadEditorNamespace.Utils.AttachEventEx(srcElement,evName,eventHandler);}}}
if(theEditor.isMozilla)
{RadEditorNamespace.ConfigureMozillaEditMode(theEditor);var targetClassName=targetElement.className;if("dataentry"==theEditor.ekParameters.editMode&&targetClassName&&"design_richarea"==targetClassName)
{theEditor.EkScriptWindow.design_setSelectedField(targetElement);}}}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}}
EktronContentDesignerNS.onFieldButtonClick=function(event,win,targetElement,context)
{var theEditor=GetRadEditor(context.editorId);var oElem=theEditor.EkScriptWindow.design_getFieldFromFieldButton(targetElement);switch(oElem.className.toLowerCase())
{case"design_calendar":case"ektdesignns_calendar":if(EktronContentDesignerNS&&"function"==typeof EktronContentDesignerNS.PopupCalendar)
{var defaultValue=oElem.getAttribute("datavalue");if(null==defaultValue&&typeof defaultValue!="undefined")
{defaultValue=oElem.getAttribute("value");}
EktronContentDesignerNS.PopupCalendar(theEditor,oElem,defaultValue);}
else
{theEditor.EkScriptWindow.design_setSelectedField(targetElement);theEditor.Fire("EkCalendarPopup");}
break;case"design_imageonly":case"ektdesignns_imageonly":if(EktronContentDesignerNS&&"function"==typeof EktronContentDesignerNS.PopupResource)
{EktronContentDesignerNS.PopupResource(theEditor,oElem,"image","");}
else
{theEditor.EkScriptWindow.design_setSelectedField(targetElement);theEditor.Fire("EkImageOnlyPopup");}
break;case"design_filelink":case"ektdesignns_filelink":if(EktronContentDesignerNS&&"function"==typeof EktronContentDesignerNS.PopupResource)
{EktronContentDesignerNS.PopupResource(theEditor,oElem,"file","");}
else
{theEditor.EkScriptWindow.design_setSelectedField(targetElement);theEditor.Fire("EkFileLinkPopup");}
break;default:EktronContentDesignerNS.onexception(new RangeError("Unknown field button type: "+oElem.className),arguments);break;}}
EktronContentDesignerNS.onContextMenu=function(event,win,targetElement,context)
{var theEditor=GetRadEditor(context.editorId);theEditor.FireEvent(RadEditorNamespace.RADEVENT_CONTEXTMENU,event);}
EktronContentDesignerNS.onAutoheight=function(context)
{var theEditor=GetRadEditor(context.editorId);$ektron(theEditor.ContentAreaElement).autoheight({bindEvents:false});}
function EkRadEditor()
{this.isMozilla=(window.netscape&&!window.opera);this.isSelectionEditable=EkRadEditor_isSelectionEditable;this.addFilters=EkRadEditor_addFilters;this.InitRadEvents=EkRadEditor_InitRadEvents;this.GetDialogUrl=EkRadEditor_GetDialogUrl;this.getContentElement=EkRadEditor_getContentElement;this.InsertImage=EkRadEditor_InsertImage;this.ExecuteBrowserCommand=EkRadEditor_ExecuteBrowserCommand;this.ExecuteInsertObjectCommand=EkRadEditor_ExecuteInsertObjectCommand;this.getHtmlToClick=EkRadEditor_getHtmlToClick;this.getNodeToClick=EkRadEditor_getNodeToClick;this.isTextNeeded=EkRadEditor_isTextNeeded;this.validateContent=EkRadEditor_validateContent;this.validateDesign=EkRadEditor_validateDesign;this.validateXmlContent=EkRadEditor_validateXmlContent;this.validateContentXPathExpr=EkRadEditor_validateContentXPathExpr;this.validateSchemaDesign=EkRadEditor_validateSchemaDesign;this.validateAccessibility=EkRadEditor_validateAccessibility;this.OnContentError=EkRadEditor_OnContentError;this.autoheight=EkRadEditor_autoheight;this.autoheightActive=false;this.getToolbarFlavor=EkRadEditor_getToolbarFlavor;this.activateToolbar=EkRadEditor_activateToolbar;this.destroyToolbar=EkRadEditor_destroyToolbar;this.destroyEditor=EkRadEditor_destroyEditor;this.onContentPaste=EkRadEditor_onContentPaste;if(this.IsIE)
{this.SetFocus=EkRadEditor_SetFocusIE;this.SetActive=this.SetFocus;}
if(this.OnBeforePaste)
{this.OnBeforePaste=EkRadEditor_OnBeforePaste;}
this.SetEditable=function(editable){};this.setContent=EkRadEditor_setContent;this.getContent=EkRadEditor_getContent;this.SetContentAreaHtml=EkRadEditor_SetContentAreaHtml;this.GetHiddenTextareaValue=EkRadEditor_GetHiddenTextareaValue;this.private_SetPageHtml=EkRadEditor_private_SetPageHtml;this.GetHtml=EkRadEditor_GetHtml;this.GetText=EkRadEditor_GetText;this.contentCache=null;this.setStatusMessage=function(message)
{$ektron("img.ContentDesignerStatusMessage").attr("alt",message).attr("title",message);};this.SymbolsArray=["&#8364;","&#162;","&#163;","&#165;","&#164;","&#169;","&#174;","&#8482;","&#177;","&#8800;","&#8776;","&#8804;","&#8805;","&#247;","&#215;","&#8734;","&#189;","&#188;","&#190;","&#178;","&#179;","&#8240;","&#182;","&#167;","&#945;","&#946;","&#916;","&#181;","&#937;","&#8721;","&#216;","&#8736;","&#186;","&#171;","&#187;","&#183;","&#8226;","&#8224;","&#8225;","&#402;"];}
EkRadEditor.overrides=Ektron.Class.overrides("RadEditor",["InitRadEvents","GetDialogUrl","SetContentAreaHtml","GetHiddenTextareaValue","OnBeforePaste"]);function EkRadEditor_addFilters()
{if("dataentry"==this.ekParameters.editMode)
{this.FiltersManager.AddAt(new EkDataEntryFilter(this,this.dataEntryXslt,this.dataEntryXsltArgs),0);}
else
{this.FiltersManager.AddAt(new EkContentFilter(this),0);}}
function EkRadEditor_InitRadEvents()
{this.RadEditor_InitRadEvents();var thisEditor=this;this.EkScriptWindow=this.ContentWindow;this.EkScriptDocument=this.Document;if(this.isMozilla)
{this.AttachEventHandler("onclick",function(event)
{HideContextMenu();});if("dataentry"==thisEditor.ekParameters.editMode)
{this.AttachEventHandler("onfocus",function(event)
{var doc=("#document"==event.target.nodeName?event.target:event.target.ownerDocument);var win=(doc.defaultView?doc.defaultView:doc.parentWindow);EktronContentDesignerNS.onContentWindowChange(win,event.target,{editorId:thisEditor.Id});});}}
function HideContextMenu()
{var popup=window["RadEditorPopupInstance"];if(popup)
{popup.Hide();}}
this.setStatusMessage(this.Localization["StatusOK"]);}
function EkRadEditor_isSelectionEditable()
{var oSelElem=this.GetSelectedElement();if(!oSelElem)oSelElem=this.Document.body;return $ektron.isEditableElement(oSelElem);}
function EkRadEditor_GetDialogUrl(dialogName)
{var result=this.RadEditor_GetDialogUrl(dialogName);result+="&AccessChecks="+this.ekParameters.AccessChecks;result+="&LibraryAllowed="+this.ekParameters.LibraryAllowed;result+="&FolderId="+this.ekParameters.FolderId;result+="&CanModifyImg="+this.ekParameters.CanModifyImg;return result;}
function EkRadEditor_getContentElement()
{var oElem=null;if(this.EkScriptWindow&&"function"==typeof this.EkScriptWindow.design_getContentElement)
{oElem=this.EkScriptWindow.design_getContentElement();}
return oElem;}
function EkRadEditor_InsertImage(url,oImgVal)
{var strImg="<img src=\""+url+"\" data-ektron-url=\""+url+"\"";var strAlt="";if(oImgVal&&"string"==typeof oImgVal.imageAltText&&oImgVal.imageAltText.length>0)
{strAlt=oImgVal.imageAltText;}
else
{strAlt=url;}
strAlt=$ektron.htmlEncode(strAlt);strImg+=" alt=\""+strAlt+"\" title=\""+strAlt+"\" />";var sTitle=this.Localization[RadEditorNamespace.RADCOMMAND_INSERT_IMAGE];this.PasteHtml(strImg,sTitle,false,true,true);}
function EkRadEditor_ExecuteBrowserCommand(sCmdID,bCanUnexecute,value,selChanged)
{var sTitle=this.Localization[sCmdID];this.ExecuteCommand(RadEditorNamespace.RadBrowserCommand.New(sTitle,sCmdID,this.ContentWindow,value),(RadEditorNamespace.RADCOMMAND_DELETE==sCmdID?false:true));this.SetActive();this.SetFocus();if(true==selChanged)this.FireEvent(RadEditorNamespace.RADEVENT_SEL_CHANGED,null);}
function EkRadEditor_isTextNeeded(oElem)
{var bNeeded;var sTag=oElem.tagName;if("undefined"==typeof sTag)
{sTag=$ektron(oElem).get(0).tagName;}
switch(sTag)
{case"A":case"DIV":case"FIELDSET":case"FORM":case"INPUT":case"LABEL":case"SELECT":case"SPAN":case"TABLE":case"TEXTAREA":bNeeded=true;break;default:bNeeded=false;break;}
return bNeeded;}
function EkRadEditor_getNodeToClick(oNode)
{var oRetNode=null;if(oNode!=null)
{if(this.isTextNeeded(oNode))
{oRetNode=oNode.ownerDocument.createTextNode("\xa0");}}
return oRetNode;}
function EkRadEditor_getHtmlToClick(oElem)
{var sHtml="";if(oElem!=null)
{if(this.isTextNeeded(oElem))
{sHtml="&#160;";}}
return sHtml;}
function EkRadEditor_ExecuteInsertObjectCommand(oObject,sTitle)
{this.SetFocus();var sToken=this.getHtmlToClick(oObject);var sPasteString=sToken+RadEditorNamespace.Utils.GetOuterHtml(oObject)+sToken;return this.ExecuteCommand(RadEditorNamespace.RadPasteHtmlCommand.New(sTitle,this.ContentWindow,sPasteString));}
function EkRadEditor_validateContent()
{if("dataentry"==this.ekParameters.editMode)
{return this.validateXmlContent();}
else
{return this.validateDesign();}}
function EkRadEditor_validateDesign()
{try
{var strContent=this.getContent();if(strContent.length>0&&-1==strContent.indexOf("<"))
{strContent=["<p>",strContent,"</p>"].join("");}
if(strContent.length>0)
{var strSchema=this.ekXml.xslTransform(strContent,"[srcPath]DesignToSchema.xslt",null,Ektron.OnException.returnException);var err=null;if(strSchema.length>0&&strSchema.indexOf("<xs:schema")>=0)
{err=this.ekXml.validateXsd(strSchema);}
else if(strSchema.length>0)
{err=strSchema;}
if(null==err)
{err=this.validateSchemaDesign(strSchema);}
if(null==err&&this.ekParameters.SchemaFiles!=null&&this.ekParameters.SchemaFiles.length>0&&false==canValidateContent(strContent))
{var schemalFiles=getSchemaParam(this.ekParameters.SchemaFiles);var schemaNamespaces=getSchemaParam(this.ekParameters.SchemaNamespaces);err=this.ekXml.validateXml(createContentPage(strContent),schemalFiles,schemaNamespaces);}
if(null==err)
{err=this.validateContentXPathExpr(strContent);}
if(null==err)
{err=this.validateAccessibility(strContent);}
if(err!=null)
{this.contentCache=null;}
return err;}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}
function getSchemaParam(arySchema)
{var schemalParam=arySchema;schemalParam=schemalParam.substr(1,schemalParam.length-2);var arySchemalParam=schemalParam.split(",");schemalParam=arySchemalParam[0];if(arySchemalParam.length>1)
{schemalParam=arySchemalParam;}
return schemalParam;}
function canValidateContent(strContent)
{var bIsSmartForm=false;if(strContent.indexOf("ektdesignns_")>-1)
{bIsSmartForm=true;}
return bIsSmartForm;}
function createContentPage(strContent)
{return"<body> "+strContent+" </body>";}}
function EkRadEditor_validateSchemaDesign(strSchema)
{var bValid=true;var validationMsg=[];var xmlDoc=this.ekXml.loadXml(strSchema);if(xmlDoc.hasChildNodes()&&xmlDoc.childNodes.length>0)
{for(var i=0;i<xmlDoc.childNodes.length;i++)
{var objNode=xmlDoc.childNodes[i];bValid=rfnValidateSchemaDOM(objNode);if(validationMsg.length>0)
{return validationMsg;}}}
return null;function rfnValidateSchemaDOM(objParentNode)
{var bValid=true;if(null==objParentNode)return null;if(!objParentNode.hasChildNodes())return null;if(0==objParentNode.childNodes.length)return null;var aryFieldNames=[];var strFieldName="";for(var j=0;j<objParentNode.childNodes.length;j++)
{var objNode=objParentNode.childNodes[j];if(objNode!=null)
{if("xs:element"==objNode.nodeName)
{var objAttr=objNode.attributes.getNamedItem("name");if(objAttr)
{strFieldName=objAttr.nodeValue;if(strFieldName&&strFieldName.length>0)
{if(true==aryFieldNames[strFieldName])
{validationMsg[validationMsg.length]="Fields within the same group must have unique names."+" "+"Duplicate field name:"+" "+strFieldName;bValid=false;break;}
else
{aryFieldNames[strFieldName]=true;}}}}
if(rfnValidateSchemaDOM(objNode)!=null)
{bValid=false;break;}}}
return bValid;}}
function EkRadEditor_validateContentXPathExpr(strContent)
{var strErrorMessage=this.ekXml.xslTransform(strContent,"[srcPath]ValidateDesign.xslt",null,Ektron.OnException.returnException);if(0==strErrorMessage.length)
{return null;}
else
{return(strErrorMessage.split("\n\n\n"));}}
function EkRadEditor_validateAccessibility(strContent)
{var err=null;try
{var xmlDoc=this.ekXml.loadXml("[srcPath]ValidateSpec.xml");var editor=this;$ektron("datadesign>validate",xmlDoc).children("[enabled='true']").each(function()
{try
{var name=this.getAttribute("name");var id=this.getAttribute("id");var validationType=this.tagName;if(editor.ekParameters.AccessChecks.toLowerCase()!="none")
{var returnMsg="";if("xslt"==validationType)
{var args=[{name:"baseURL",value:""},{name:"outputFormat",value:"text"}];var baseURL=editor.ekParameters.ImagePaths;if(-1==baseURL.indexOf(","))
{baseURL=baseURL.replace(/\~/,editor.ApplicationPath);baseURL=baseURL.replace(/\/{2}/,"/");args=[{name:"baseURL",value:location.protocol+"//"+location.host+baseURL},{name:"outputFormat",value:"text"}];}
var xslt=this.getAttribute("src");var sPreHtml="<html><head></head><body>";var sPostHtml="</body></html>";strContent=sPreHtml+strContent+sPostHtml;try
{returnMsg=editor.ekXml.xslTransform(strContent,xslt,args);}
catch(ex){}
if(returnMsg.length>0)
{err={code:-1000,msg:returnMsg,doctype:""};}}}}
catch(ex)
{Ektron.OnException(editor,EktronContentDesignerNS.onexception,ex,arguments);}});}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}
return err;}
function EkRadEditor_validateXmlContent()
{var err=null;try
{if(!this.EkScriptWindow.design_validateForm("design_content"))
{var oInvalidElem=this.EkScriptWindow.document.getElementById('dsg_validate');if(oInvalidElem)
{err=oInvalidElem.title;}
else
{err="Content is not valid";}}
else
{var strXml=this.getContent();if(strXml.length>0&&-1==strXml.indexOf("<"))
{strXml=["<p>",strXml,"</p>"].join("");}
if(this.dataSchema)
{err=this.ekXml.validateXml(strXml,this.dataSchema,"");}
if(null==err)
{err=this.validateAccessibility(strXml);}}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}
if(err!=null)
{this.contentCache=null;}
return err;}
function EkRadEditor_SetFocusIE()
{try
{if(this.Mode==RadEditorNamespace.RADEDITOR_DESIGN_MODE)
{var oSelElem=null;if(this.Document)
{if(this.Document.selection&&("None"==this.Document.selection.type||"Control"==this.Document.selection.type))
{return;}
oSelElem=getSelectionElement(this.Document);if(null==oSelElem)
{oSelElem=this.Document.activeElement;}
if(oSelElem!=null)
{if(oSelElem.isContentEditable)
{if("dataentry"==this.ekParameters.editMode)
{if(oSelElem!=null)
{var joSelElem=$ektron(oSelElem);var joParent=joSelElem.parent();while(joParent.length>0&&joParent.get(0).isContentEditable)
{joSelElem=joParent;joParent=joSelElem.parent();}
oSelElem=joSelElem.get(0);}}}
else
{var objEkContentArea=this.getContentElement();if(null==objEkContentArea)
{objEkContentArea=this.ContentArea;}
oSelElem=null;if(objEkContentArea.isContentEditable)
{oSelElem=objEkContentArea;}
else
{for(var i=0;i<objEkContentArea.all.length;i++)
{oSelElem=objEkContentArea.all[i];if(oSelElem.isContentEditable)
{break;}}}}}}
try
{this.ContentWindow.focus();}
catch(ex)
{}
if(oSelElem!=null)
{oSelElem.setActive();}}
else if(this.Mode==RadEditorNamespace.RADEDITOR_HTML_MODE)
{try
{this.ContentTextarea.focus();}
catch(ex)
{}}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}}
function EkRadEditor_private_SetPageHtml(newContent,forceNewDocument,callback)
{if(-1!=newContent.toLowerCase().indexOf("<html"))
{newContent=newContent.replace(/[\w\W]*?<body[^>]*>([\w\W]*?)<\/body>[\w\W]*/i,"$1");newContent=newContent.replace(/[\w\W]*?<html[^>]*>([\w\W]*?)<\/html>[\w\W]*/i,"$1");}
if(forceNewDocument)
{var bIsInitialized=false;var me=this;function initContentAreaElement()
{if(bIsInitialized)return;var oIFrame=me.ContentAreaElement;if(!oIFrame)return;var oWin=oIFrame.contentWindow;if(!oWin)return;var oDoc=oWin.document;if(!oDoc)return;var oBody=oDoc.body;if(!oBody)return;var oHead=oDoc.getElementsByTagName("HEAD")[0];if(!oHead||!oHead.hasChildNodes())return;bIsInitialized=true;me.ContentWindow=oWin;me.Document=oDoc;me.ContentArea=oBody
me.InitRadEvents();me.EnableEnhancedEdit=!me.EnableEnhancedEdit;me.ToggleEnhancedEdit();me.SetContentAreaHtml(newContent,callback);};RadEditorNamespace.Utils.AttachEventEx(this.ContentAreaElement,"load",initContentAreaElement);initContentAreaElement();}
if(this.IsSafari)
{if(this.Height&&this.Height.indexOf("%")==-1)
{this.ContentAreaElement.style.height=this.Height;}
else
{try
{var oTd=this.ContentAreaElement.parentNode;var oDiv=this.Document.createElement("div");oDiv.style.height="100%";oDiv.innerHTML="&nbsp;";oTd.appendChild(oDiv);var oHeight=RadEditorNamespace.Utils.GetRect(oTd).height;oDiv.parentNode.removeChild(oDiv);this.ContentAreaElement.style.height=oHeight;}
catch(ex)
{this.ContentAreaElement.style.height=this.Height;}}}
if(!forceNewDocument)
{this.SetContentAreaHtml(newContent,callback);}}
function EkRadEditor_SetContentAreaHtml(newContent,callback)
{var objEkContentArea=this.getContentElement();if(null==objEkContentArea)
{var srcPath=this.ekParameters.srcPath;var resPath=this.ekParameters.resPath;var skinPath=this.ekParameters.skinPath;var editorSkinPath=this.ekParameters.editorSkinPath;if(""==newContent&&false==this.NewLineBr)
{newContent="<p>&#160;</p>";}
if("dataentry"==this.ekParameters.editMode)
{newContent="<div id=\"design_content\" class=\"design_mode_entry\" contentEditable=\"false\">"+newContent+"</div>";}
else
{newContent="<div id=\"design_content\" class=\"design_mode_design\" contentEditable=\"true\">"+newContent+"</div>";}
newContent=newContent.replace(/(\"|\')[^\[\"\']*\[skinpath\]/g,"$1"+skinPath);newContent=newContent.replace(/(\"|\')[^\[\"\']*\[srcpath\]btn/g,"$1"+skinPath+"btn");newContent=newContent.replace(/(\"|\')[^\[\"\']*\[srcpath\]additem.gif/g,"$1"+skinPath+"additem.gif");newContent=newContent.replace(/(\"|\')[^\[\"\']*\[srcpath\]designmenu.gif/g,"$1"+skinPath+"designmenu.gif");newContent=newContent.replace(/(\"|\')[^\[\"\']*\[srcpath\]/g,"$1"+srcPath);this.RadEditor_SetContentAreaHtml(newContent);var me=this;var objScriptDoc=this.EkScriptDocument;var objHeadElem=objScriptDoc.getElementsByTagName("HEAD")[0];if(!objHeadElem.hasChildNodes())
{alert("ERROR: the HEAD element was empty when attempting to set the content.");throw new Error("The HEAD element is empty.");}
function includeStyle(url)
{var objLink=objScriptDoc.createElement("link");objLink.rel="Stylesheet";objLink.type="text/css";objLink.href=url;objHeadElem.appendChild(objLink);};function appendScript(code)
{var objScript=objScriptDoc.createElement("script");objScript.type="text/javascript";if($ektron.browser.msie)
{objScript.text=code;}
else
{objScript.appendChild(objScriptDoc.createTextNode(code));}
objHeadElem.appendChild(objScript);};function includeScript(url,callback)
{var objScript=objScriptDoc.createElement("script");objHeadElem.appendChild(objScript);objScript.type="text/javascript";if("function"==typeof callback)
{var done=false;function callbackOnce()
{if(!done)
{done=true;try
{callback();}
catch(ex)
{Ektron.OnException(me,EktronContentDesignerNS.onexception,ex,[],callback);}}};objScript.onload=objScript.onreadystatechange=function()
{var state=this.readyState;if(!state||"loaded"==state)
{setTimeout(callbackOnce,1);}
else if("complete"==state)
{setTimeout(function()
{if(!done)
{EktronContentDesignerNS.onexception(new Error(Ektron.String.format("Timed out waiting for readyState 'loaded' when loading {0}.",url)),arguments);callbackOnce();}},500);}};setTimeout(function()
{if(!done)
{includeScript.failed.push(url);includeScript.timeoutLimit=2500;callbackOnce();}},includeScript.timeoutLimit);}
objScript.src=url;};includeScript.timeoutLimit=8000;includeScript.failed=[];includeStyle(skinPath+"ekforms.css");includeScript(srcPath+"HTMLElement.js",function(){includeScript(resPath+"ektron.js",function(){includeScript(resPath+"plugins/autoheight/ektron.autoheight.js",function(){includeScript(resPath+"plugins/string/ektron.string.js",function(){includeScript(resPath+"ektron.xml.js",function(){includeScript(srcPath+"platforminfo.js",function(){includeScript(srcPath+"ekxbrowser.js",function(){includeScript(srcPath+"ekutil.js",function(){includeScript(srcPath+"ekforms.js",function()
{if(includeScript.failed.length>0)
{alert("ERROR: The following JavaScript files failed to load:\n"+includeScript.failed.join("\n"));throw new Error("JavaScript files failed to load in the content layer.");}
appendScript(["var g_design_localizedStrings = ","{ stdOK: \"OK\"",", stdCancel: \"Cancel\"",", mnuInsAbv: \"Insert Above\"",", mnuInsBel: \"Insert Below\"",", mnuDupl: \"Duplicate\"",", mnuMvUp: \"Move Up\"",", mnuMvDn: \"Move Down\"",", mnuRem: \"Remove\"",", sFld: \"Field\"",", sInvFld: \"At least one field is not valid. Please correct it and try again.\"",", sShow: \"Show\"",", sHide: \"Hide\"","};","var settings = {","    srcPath:\""+srcPath+"\",","    skinPath:\""+skinPath+"\",","    editorSkinPath:\""+editorSkinPath+"\",","    langType:"+me.ekParameters.contentLanguage+",","    editorId:\""+me.Id+"\",","    CssFilesArray:"+$ektron.toLiteral(me.CssFilesArray),"};","try {","    design_init(settings);","    design_onload(settings);","} catch (ex) {","    alert('Error initializing smart form: ' + ex.message);","}"].join("\n"));if("function"==typeof callback)
{try
{callback();}
catch(ex)
{Ektron.OnException(me,EktronContentDesignerNS.onexception,ex,[],callback);}}});});});});});});});});});}
else
{try
{if(""==newContent&&false==this.NewLineBr)
{newContent="<p>&#160;</p>";}
RadEditorNamespace.SetElementInnerHTML(objEkContentArea,newContent);this.EkScriptWindow.design_onload();}
catch(e){;}
if("function"==typeof callback)
{try
{callback();}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,[],callback);}}}
this.contentCache=null;}
function EkRadEditor_setContent(setType,newContent)
{switch(setType)
{case"text":this.SetHtml($ektron.htmlEncode(newContent));break;case"dataentryxslt":this.dataEntryXslt=newContent;this.dataEntryXsltArgs=[{name:"baseURL",value:location.protocol+"//"+location.host},{name:"LangType",value:this.ekParameters.contentLanguage}];if(this.FiltersManager&&this.FiltersManager.Filters)
{for(var i=0;i<this.FiltersManager.Filters.length;i++)
{if("EkDataEntryFilter"==this.FiltersManager.Filters[i].Name)
{this.FiltersManager.Filters[i]=new EkDataEntryFilter(this,this.dataEntryXslt,this.dataEntryXsltArgs);break;}}}
break;case"dataschema":this.dataSchema=newContent;break;default:this.SetHtml(newContent);break;}}
function EkRadEditor_getContent(getType)
{switch(getType)
{case"text":return this.GetText();break;case"dataentryxslt":return this.dataEntryXslt;break;case"dataschema":return this.dataSchema;break;default:return this.GetHtml(true);break;}}
function EkRadEditor_GetHiddenTextareaValue()
{var oDataDocXml=this.FindElement("DataDocumentXml");if(oDataDocXml)
{var oDataEntryXslt=this.FindElement("DataEntryXslt");if(oDataEntryXslt)
{if(oDataEntryXslt.value.length>0)
{this.setContent("dataentryxslt",oDataEntryXslt.value);var strXml=oDataDocXml.value;if(0==strXml.length)
{strXml="<root></root>";}
this.SetHiddenTextareaValue(strXml);}
oDataDocXml.value="";oDataEntryXslt.value="";}
var oDataSchema=this.FindElement("DataSchema");if(oDataSchema&&oDataSchema.value.length>0)
{this.setContent("dataschema",oDataSchema.value);oDataSchema.value="";}}
return this.RadEditor_GetHiddenTextareaValue();}
function EkRadEditor_GetHtml(isFiltered)
{if(this.contentCache)return this.contentCache;var content="";try
{if(this.Mode==RadEditorNamespace.RADEDITOR_DESIGN_MODE||this.Mode==RadEditorNamespace.RADEDITOR_PREVIEW_MODE)
{this.EkScriptWindow.design_onbeforesave();var objEkContentArea=this.getContentElement();if(null==objEkContentArea)
{objEkContentArea=this.ContentArea;}
content=Ektron.Xml.serializeXhtml(objEkContentArea.childNodes);this.EkScriptWindow.design_onaftersave();var reWhiteSpace=new RegExp("^([\\s]+|&nbsp;|&#160;|\xA0)$","i");var reBlankPara=new RegExp("^[\\s]*<p>(\\s|&nbsp;|&#160;|\xA0)?<\/p>[\\s]*$","i");var reBreakTagOnly=new RegExp("^[\\s]*<br\s?\/?>[\\s]*$","i");if(reWhiteSpace.test(content)||reBlankPara.test(content)||reBreakTagOnly.test(content))
{content="";}
if(true==isFiltered)
{content=this.FiltersManager.GetHtmlContent(content);}}
else if(this.Mode==RadEditorNamespace.RADEDITOR_HTML_MODE)
{this.CleanIndent();content=this.ContentTextarea.value;content=this.ekXml.fixXml(content);}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}
this.contentCache=content;return content;}
function EkRadEditor_GetText()
{return $ektron.removeTags(this.getContent());}
function EkRadEditor_OnContentError(ex)
{var msg="An error occurred when processing the content. \n\n";alert(msg+ex.message);this.contentCache=null;}
function EkRadEditor_OnBeforePaste(oEvent)
{try
{this.RadEditor_OnBeforePaste(oEvent);}
catch(ex)
{}}
function EkRadEditor_autoheight()
{var bindEvents=!this.autoheightActive;this.autoheightActive=true;if(bindEvents)
{var me=this;$ektron().bind($ektron.fn.autoheight.triggerName,function()
{var ht=$ektron(me.ContentAreaElement).height();$ektron("#RadEWrapper"+me.Id).height(ht);});}
if(this.ContentAreaElement)
{$ektron(this.ContentAreaElement).autoheight({bindEvents:bindEvents});}
if(this.EkScriptWindow&&"function"==typeof this.EkScriptWindow.design_autoheight)
{this.EkScriptWindow.design_autoheight();}}
function EkRadEditor_getToolbarFlavor(oManager)
{var ToolbarFlavors=oManager.ToolbarFlavors;for(var i=0;i<ToolbarFlavors.length;i++)
{if(this==ToolbarFlavors[i].Editor)
{return ToolbarFlavors[i];}}
return null;}
function EkRadEditor_activateToolbar()
{if(true==this.IsToolbarModeEnabled(RadEditorNamespace.ToolbarModesEnum.ShowOnFocus))
{var oManager=RadEditorNamespace.GetShowOnFocusToolbarManager();if(oManager)
{var oFlavorObject=this.getToolbarFlavor(oManager);oManager.SetEditorFocus(oFlavorObject);var oHolder=oManager.ToolbarHolder[this.Id];if(oHolder)
{$ektron(".RadEToolbar",oHolder).css("float","left").filter(":last").css("float","right");}}}}
function EkRadEditor_destroyEditor()
{try
{$ektron("body .RadERadWindowButtonClose").click();}
catch(ex){}
this.destroyToolbar();}
function EkRadEditor_destroyToolbar()
{if(true==this.IsToolbarModeEnabled(RadEditorNamespace.ToolbarModesEnum.ShowOnFocus))
{var oManager=RadEditorNamespace.GetShowOnFocusToolbarManager();if(oManager)
{var oHolder=oManager.ToolbarHolder[this.Id];if(oHolder)
{oHolder.parentNode.removeChild(oHolder);oManager.ToolbarHolder[this.Id]=null;}
var oOverlay=oManager.OverlayFrame[this.Id];if(oOverlay)
{oOverlay.parentNode.removeChild(oOverlay);oManager.OverlayFrame[this.Id]=null;}}}}
function EkRadEditor_onContentPaste()
{var cleanedText=this.getContent();this.setContent("document",cleanedText);}
function EkRadOnClientInit(editor)
{var params=window["Ek"+editor.Id+"Params"];editor.ekParameters=params;editor.workareaPath=editor.ekParameters.workareaPath;editor.ekXml=new Ektron.Xml({srcPath:editor.ekParameters.srcPath});if(params.EkRadOnClientInit)editor.AttachClientEvent("EkRadOnClientInit",params.EkRadOnClientInit);editor.ExecuteClientEvent("EkRadOnClientInit");if(params.EkRadOnClientLoad)editor.AttachClientEvent("EkRadOnClientLoad",params.EkRadOnClientLoad);if(params.EkRadOnClientCommandExecuting)editor.AttachClientEvent("EkRadOnClientCommandExecuting",params.EkRadOnClientCommandExecuting);if(params.EkRadOnClientCommandExecuted)editor.AttachClientEvent("EkRadOnClientCommandExecuted",params.EkRadOnClientCommandExecuted);if(params.EkRadOnClientModeChange)editor.AttachClientEvent("EkRadOnClientModeChange",params.EkRadOnClientModeChange);if(params.EkRadOnClientSubmit)editor.AttachClientEvent("EkRadOnClientSubmit",params.EkRadOnClientSubmit);if(params.EkRadOnClientCancel)editor.AttachClientEvent("EkRadOnClientCancel",params.EkRadOnClientCancel);EkRadEditor.overrides(editor);Ektron.Class.overrides("RadEditorNamespace",["CleanPastedContent","SetElementInnerHTML"]).call(function()
{this.CleanPastedContent=function(editor,dirtyText)
{var cleanedText=this.RadEditorNamespace_CleanPastedContent(editor,dirtyText);cleanedText=cleanedText.replace(/\b(onabort|onactivate|onafter\w+|onbefore\w+|onblur|onchange|onclick|oncontextmenu|ondblclick|ondeactivate|ondrag\w*|ondrop|onerror\w*|onfocus\w*|onhelp|onkey\w+|onload|onmouse\w+|onmove\w*|onpaste|onreadystatechange|onreset|onresize\w*|onscroll|onselect\w*|onstop|onsubmit|onunload)(?=[^<>]*>)/ig,"ektron35383_$1");return cleanedText;};this.SetElementInnerHTML=function(elem,content)
{if("string"==typeof content)
{content=content.replace(/\xa0/g,"&#160;");}
return this.RadEditorNamespace_SetElementInnerHTML(elem,content);};},RadEditorNamespace);Ektron.Class.overrides("RadSelection",["IsControl"]).call(function()
{this.IsControl=function()
{try
{return this.RadSelection_IsControl.apply(this,arguments);}
catch(ex)
{return false;}};},RadEditorNamespace.RadSelection);}
function EkRadOnClientLoad(editor)
{return editor.ExecuteClientEvent("EkRadOnClientLoad");}
function EkRadOnClientCommandExecuting(editor)
{return editor.ExecuteClientEvent("EkRadOnClientCommandExecuting");}
function EkRadOnClientCommandExecuted(editor)
{return editor.ExecuteClientEvent("EkRadOnClientCommandExecuted");}
function EkRadOnClientModeChange(editor)
{return editor.ExecuteClientEvent("EkRadOnClientModeChange");}
function EkRadOnClientSubmit(editor)
{return editor.ExecuteClientEvent("EkRadOnClientSubmit");}
function EkRadOnClientCancel(editor)
{return editor.ExecuteClientEvent("EkRadOnClientCancel");}
function EkDataEntryFilter(editor,dataEntryXslt,xsltArgs)
{Ektron.Class.inherits(this,new EkContentFilter(editor));this.Name="EkDataEntryFilter";this.IsDom=true;this.Description="Converts between data entry view and XML data view";this.HtmlContentCache="";this.GetHtmlContent=function(initContent)
{if(!initContent)return"";this.HtmlContentCache=initContent;initContent=this.EkContentFilter_GetHtmlContent(initContent);initContent=editor.ekXml.xslTransform(initContent,"[srcPath]PresentationToData.xslt");return initContent;}
this.GetDesignContent=function(initContent)
{if(dataEntryXslt)
{initContent=editor.ekXml.xslTransform(initContent,dataEntryXslt,xsltArgs);initContent=this.EkContentFilter_GetDesignContent(initContent);return initContent;}
else
{return this.HtmlContentCache;}}}
function EkContentFilter(editor)
{try
{this.Name="EkContentFilter";this.Description="Converts between WYSIWYG view and source view";var strHost=location.protocol+"//"+location.host;var lenHost=strHost.length;var skinPath=editor.ekParameters.skinPath;if(strHost.toLowerCase()==skinPath.substr(0,lenHost).toLowerCase())
{skinPath=skinPath.substr(lenHost);}
var srcPath=editor.ekParameters.srcPath;if(strHost.toLowerCase()==srcPath.substr(0,lenHost).toLowerCase())
{srcPath=srcPath.substr(lenHost);}
var args=[{name:"skinPath",value:skinPath},{name:"srcPath",value:srcPath},{name:"baseURL",value:strHost},{name:"LangType",value:editor.ekParameters.contentLanguage},{name:"mode",value:editor.ekParameters.editMode}];this.GetHtmlContent=function(initContent)
{if(!initContent)return"";if(-1==initContent.indexOf("<"))
{initContent="<p>"+initContent+"</p>";}
initContent=initContent.replace(/ektron35383_/g,"");return editor.ekXml.xslTransform(initContent,"[srcPath]ContentOutGoing.xslt",args);}
this.GetDesignContent=function(initContent)
{if(!initContent)return"";if(-1==initContent.indexOf("<"))
{initContent="<p>"+initContent+"</p>";}
else
{var options={preserveWordClasses:((RadEditorNamespace.CLEAR_PASTE_FORMATTING_WORD_PRESERVE_CLASSES&editor.ClearPasteFormatting)==RadEditorNamespace.CLEAR_PASTE_FORMATTING_WORD_PRESERVE_CLASSES),preserveWordStyles:((RadEditorNamespace.CLEAR_PASTE_FORMATTING_WORD_PRESERVE_STYLES&editor.ClearPasteFormatting)==RadEditorNamespace.CLEAR_PASTE_FORMATTING_WORD_PRESERVE_STYLES)};var clearValue="WORDML";if(initContent.match(/style="[^"]*?mso[^"]*?"/ig)||initContent.match(/class="?[^"]*?mso[^"]*?"?/ig))
{clearValue="WORD";}
initContent=RadEditorNamespace.StripWordFormatting(initContent,clearValue,options);}
return editor.ekXml.xslTransform(initContent,"[srcPath]ContentInComing.xslt",args,Ektron.OnException.throwException);}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}}
function EkRadEditorDomInspector(moduleArgs)
{Ektron.Class.inherits(this,new RadEditorDomInspector(moduleArgs),"RadEditorDomInspector");this.CreatePath=EkRadEditorDomInspector_CreatePath;}
function EkRadEditorDomInspector_CreatePath()
{this.RadEditorDomInspector_CreatePath();var links=this.ModuleElement.getElementsByTagName("A");if(links)
{for(var i=0;i<links.length;i++)
{var link=links[i];if(link.Parent)
{var oElem=link.Parent.DomElement;if(oElem)
{if("design_content"==oElem.id)
{this.ModuleElement.removeChild(link.nextSibling);this.ModuleElement.removeChild(link);}}}}}}
function EkRadEditorXhtmlValidator(moduleArgs)
{Ektron.Class.inherits(this,new RadEditorXhtmlValidator(moduleArgs),"RadEditorXhtmlValidator");this.Id="EkRadEditorXhtmlValidator";this.Validate=EkRadEditorXhtmlValidator_Validate;this.CreateHeader=EkRadEditorXhtmlValidator_CreateHeader;this.prepareResultPane=EkRadEditorXhtmlValidator_prepareResultPane;this.getActionPage=EkRadEditorXhtmlValidator_getActionPage;}
function EkRadEditorXhtmlValidator_Validate()
{try
{if(this.DoctypeSelect)
{var sHtml=this.Editor.getContent();this.ValidateForm.action=this.getActionPage();this.prepareResultPane();var bCustomSelect=false;switch(this.DoctypeSelect.value)
{case"ektaccesseval":try
{var sPreHtml="<html><head></head><body>";var sPostHtml="</body></html>";sHtml=sPreHtml+sHtml+sPostHtml;var baseURL=this.Editor.ekParameters.ImagePaths;var args=[{name:"baseURL",value:""}];if(-1==baseURL.indexOf(","))
{baseURL=baseURL.replace(/\~/,this.Editor.ApplicationPath);baseURL=baseURL.replace(/\/{2}/,"/");args=[{name:"baseURL",value:location.protocol+"//"+location.host+baseURL}];}
try
{var newDocument=this.Editor.ekXml.xslTransform(sHtml,"[srcpath]ektaccesseval.xslt",args);if(newDocument.indexOf("<html>")>-1)
{this.ContentField.value=newDocument;}
else
{this.ContentField.value=sPreHtml+"<li>Error in Transform.</li>"+sPostHtml;}}
catch(ex)
{this.ContentField.value=sPreHtml+"<li>Error in Transform: "+ex.message+"</li>"+sPostHtml;}
this.DoctypeField.value="";bCustomSelect=true;}
catch(ex)
{}
break;case"schema":var err=this.Editor.validateDesign();var doctype="";if(err!=null)
{if("object"==typeof err&&typeof err.msg!="undefined")
{doctype=err.doctype;err=err.msg;}
else if("object"==typeof err)
{err="<ul><li>"+err.join("</li><li>")+"</li></ul>";}
else
{err="<ul><li>"+err+"</li></ul>";}}
else
{err="";}
this.ContentField.value=err;this.DoctypeField.value=doctype;bCustomSelect=true;break;case"xmlcontent":var err=this.Editor.validateXmlContent();var doctype="";if(err!=null)
{if("object"==typeof err&&typeof err.msg!="undefined")
{doctype=err.doctype;err=err.msg;}
else if("object"==typeof err)
{err="<ul><li>"+err.join("</li><li>")+"</li></ul>";}
else
{err="<ul><li>"+err+"</li></ul>";}}
else
{err="";}
this.ContentField.value=err;this.DoctypeField.value=doctype;bCustomSelect=true;break;default:if("!DOCTYPE "==this.DoctypeSelect.value.substr(0,9).toUpperCase())
{this.RadEditorXhtmlValidator_Validate();bCustomSelect=false;}
else
{if("reportresult="==this.DoctypeSelect.value.substr(0,13))
{this.DoctypeField.value=this.DoctypeSelect.value;}
else
{this.ContentField.value="<div>"+sHtml+"</div>";this.DoctypeField.value=this.DoctypeSelect.value;}
bCustomSelect=true;}
break;}
if(true==bCustomSelect)
{this.ValidateForm.submit();}}}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}}
function EkRadEditorXhtmlValidator_CreateHeader()
{try
{this.RadEditorXhtmlValidator_CreateHeader();this.ValidateButton.value=this.GetLocalizedString("ValidateContent","Validate Content");}
catch(ex)
{Ektron.OnException(this,EktronContentDesignerNS.onexception,ex,arguments);}}
function EkRadEditorXhtmlValidator_prepareResultPane()
{this.ShowIframe(true);if(this.ToggleCheckbox&&!this.ToggleCheckbox.checked)this.ToggleCheckbox.checked=true;}
function EkRadEditorXhtmlValidator_getActionPage()
{return location.protocol+"//"+location.host+this.Editor.RadControlsDir+"Editor/Xhtml/XhtmlValidator.aspx";}
function EkRadEditorSpellEngineUI(editor)
{Ektron.Class.inherits(this,new RadEditorSpellEngineUI(editor),"RadEditorSpellEngineUI");this.ClearWrongWords=EkRadEditorSpellEngineUI_ClearWrongWords;this.MoveToNextWrongWord=EkRadEditorSpellEngineUI_MoveToNextWrongWord;this.IsHighlightedRemaining=EkRadEditorSpellEngineUI_IsHighlightedRemaining;this.LoopIntoIFrames=EkRadEditorSpellEngineUI_LoopIntoIFrames;}
function EkRadEditorSpellEngineUI_ClearWrongWords(wrongWord,correctWord)
{this.LoopIntoIFrames(function(obj)
{obj.RadEditorSpellEngineUI_ClearWrongWords(wrongWord,correctWord);});}
function EkRadEditorSpellEngineUI_MoveToNextWrongWord()
{this.LoopIntoIFrames(function(obj)
{var oMatch=null;oMatch=obj.RadEditorSpellEngineUI_MoveToNextWrongWord();if(oMatch)
{return false;}});}
function EkRadEditorSpellEngineUI_IsHighlightedRemaining()
{var IsHighlightedRemaining=false;this.LoopIntoIFrames(function(obj)
{IsHighlightedRemaining=obj.RadEditorSpellEngineUI_IsHighlightedRemaining();if(true==IsHighlightedRemaining)
{return false;}});return IsHighlightedRemaining;}
function EkRadEditorSpellEngineUI_LoopIntoIFrames(coreFunction)
{var oIFrame=$ektron("iframe.contenteditable",this.Editor.getContentElement());if(oIFrame&&oIFrame.length>1)
{var tmpContentWindow=this.Editor.ContentWindow;var tmpDocument=this.Editor.Document;var tmpContentArea=this.Editor.ContentArea;var oEngine=this;oIFrame.each(function()
{oEngine.Editor.ContentWindow=this.contentWindow;oEngine.Editor.Document=oEngine.Editor.ContentWindow.document;oEngine.Editor.ContentArea=oEngine.Editor.Document.body;if(false===coreFunction(oEngine))
{return false;}});this.Editor.ContentWindow=tmpContentWindow;this.Editor.Document=tmpDocument;this.Editor.ContentArea=tmpContentArea;}
else
{coreFunction(this);}}
