var close;function chooseimage(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showiFrameDialog("imagebrowser.php?root=$cosmos_imagesURI",795,600)}function chooseflash(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showiFrameDialog("flashbrowser.php",795,600)}function choosevideo(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showvideopopup()}function chooselink(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showlinkpopup()}function chooseanchor(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showanchorpopup()}function chooseform(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showiFrameDialog("formbrowser.php",795,600)}function choosepoll(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();showiFrameDialog("pollbrowser.php",795,600)}function openIconBrowser(){hideEditorLayers();currentselection=createRange(editorname,getSelection(editorname));showiFrameDialog("iconbrowser.php?targettype=document",795,600)}function spellCheck(a){currenteditor=a;currentselection=createRange(a,getSelection(a));hideEditorLayers();startSpellCheck()}function checkDates(){var a=new Date();var b="";var g=document.forms.documentform.startdated.value;var d=document.forms.documentform.startdatem.value-1;var f=document.forms.documentform.startdatey.value;var e=document.forms.documentform.enddated.value;var i=document.forms.documentform.enddatem.value-1;var h=document.forms.documentform.enddatey.value;if(g!=""&&(d!=""||d==0)&&f!=""){var c=new Date(f,d,g);if(f==c.getFullYear()&&d==c.getMonth()&&g==c.getDate()){b+=""}else{if(b!=""){b+=", "}b+="Invalid Start Date"}}if(e!=""&&(i!=""||i==0)&&h!=""){var c=new Date(h,i,e);if(h==c.getFullYear()&&i==c.getMonth()&&e==c.getDate()&&c>=a){b+=""}else{if(b!=""){b+=", "}b+="Invalid End Date"}}if(b){alert(b);return false}else{return true}}function checkLength(a,b){if(document.forms.documentform[a].value.length==0){alert("The "+b+" is required and cannot be emtpy.");document.forms.documentform[a].focus();return false}return true}function setClose(){document.forms.documentform.close.value=1}function setImage(idImage,url){if(ng5){document.getElementById(idImage).src=url}else{if(ie4){eval("document.all."+idImage+'.src = "'+url+'" ;')}}}function pasteTextIntoHTML(k){var d=getEditor(currenteditor);var h;var j;var b;var f=false;var l;if(ie4){l=d.document}else{if(ng5){l=d.contentWindow.document}}for(var c=0;c<currentelementlist.length;c++){if(currentelementlist[c].nodeName=="UL"||currentelementlist[c].nodeName=="OL"){h=currentelementlist[c];j=null;b="li";f=true;break}if(currentelementlist[c].nodeName=="LI"){h=currentelementlist[c].parentNode;b="li";f=true;break}if(currentelementlist[c].nodeName=="P"){h=currentelementlist[c].parentNode;b="p";f=true;break}}if(b==undefined){b="p"}k=k.replace(/\n\r/g,"\n");k=k.replace(/\r\n/g,"\n");k=k.replace(/\r/g,"\n");k=k.replace(/\n+/g,"\n");var e=k.split("\n");var a="";for(var c=0;c<e.length;c++){a=a+"<"+b+">"+e[c]+"</"+b+">\n"}if(ie4){pasteHTML(a)}else{if(ng5){if(f){pasteHTML(a+"<"+b+' id="RendiliCosmosPasteTextTool"></'+b+">")}else{pasteHTML(a)}var g=l.body.innerHTML;l.body.innerHTML=g.replace(' id="RendiliCosmosPasteTextTool"></'+b,"")}}}function removeElement(a){var d=getEditor(currenteditor);var e;if(ie4){e=d.document}else{if(ng5){e=d.contentWindow.document}}var c=e.createDocumentFragment();for(var b=0;b<a.childNodes.length;b++){c.appendChild(a.childNodes[b])}a.parentNode.replaceChild(c,a)}function dialog_box(c,f,e,b,a,d){this.box=c;this.shadow=f;this.header=e;this.content=b;this.width=a;this.title=d;if(getItemFromId(this.content).nodeName=="IFRAME"){this.is_iFrame=true}addListener(getItemFromId(this.header),"mousedown",this.startDrag.bindEventListener(this))}dialog_box.prototype.setiFrameURL=function(a){getItemFromId(this.content).src=a};dialog_box.prototype.setDimensions=function(b,a){this.width=b;this.height=a};dialog_box.prototype.show=function(){setItemWidth(this.header,this.width);setItemWidth(this.content,this.width);if(this.is_iFrame){setItemHeight(this.content,this.height);getItemFromId(this.content).contentWindow.document.open();getItemFromId(this.content).contentWindow.document.close();this.setTitle("Loading...")}centerItem(this.box);setItemWidth(this.shadow,getItemWidth(this.box));setItemHeight(this.shadow,getItemHeight(this.box));setItemPos(this.shadow,getItemX(this.box)+8,getItemY(this.box)+8);closepopups();if(ie4){selectBoxHidden(true);this.setBrowser("100%","hidden")}objectDisplayStyle("dialog_mask","block");objectVisible(this.box,true);objectVisible(this.shadow,true)};dialog_box.prototype.setBrowser=function(a,b){document.body.style.height=a;document.body.style.overflow=b};dialog_box.prototype.hide=function(){if(this.is_iFrame){this.setiFrameURL("empty.php")}if(ie4){selectBoxHidden(false);this.setBrowser("auto","auto")}objectDisplayStyle("dialog_mask","none");objectVisible(this.box,false);objectVisible(this.shadow,false)};dialog_box.prototype.setTitle=function(a){getItemFromId(this.title).innerHTML=a};dialog_box.prototype.startDrag=function(a){this.xOffset=getItemX(this.box)-mousex;this.yOffset=getItemY(this.box)-mousey;this.moveFP=this.move.bindEventListener(this);this.stopDragFP=this.stopDrag.bindEventListener(this);addListener(document,"mousemove",this.moveFP);addListener(document,"mouseup",this.stopDragFP);if(this.is_iFrame){this.moveFromContentFP=this.moveFromContent.bindEventListener(this);addListener(getItemFromId(this.content).contentWindow.document,"mousemove",this.moveFromContentFP);addListener(getItemFromId(this.content).contentWindow.document,"mouseup",this.stopDragFP)}this.oldOnSelect=document.onselectstart;document.onselectstart=function(){return false}};dialog_box.prototype.move=function(a){setItemPos(this.box,mousex+this.xOffset,mousey+this.yOffset);setItemPos(this.shadow,mousex+this.xOffset+8,mousey+this.yOffset+8)};dialog_box.prototype.moveFromContent=function(a){if(ie4){currmousex=getItemFromId(this.content).contentWindow.event.clientX;+document.body.scrollLeft;currmousey=getItemFromId(this.content).contentWindow.event.clientY;+document.body.scrollTop}else{currmousex=a.pageX;currmousey=a.pageY}setItemPos(this.box,currmousex+getItemX(this.content)+this.xOffset,currmousey+getItemY(this.content)+this.yOffset);setItemPos(this.shadow,currmousex+getItemX(this.content)+this.xOffset+4,currmousey+getItemY(this.content)+this.yOffset+4)};dialog_box.prototype.stopDrag=function(a){if(this.is_iFrame){removeListener(getItemFromId(this.content).contentWindow.document,"mousemove",this.moveFromContentFP);removeListener(getItemFromId(this.content).contentWindow.document,"mouseup",this.stopDragFP)}removeListener(document,"mousemove",this.moveFP);removeListener(document,"mouseup",this.stopDragFP);document.onselectstart=this.oldOnSelect};function closepopups(){objectDisplayStyle("dialog_mask","none");if(ie6){selectBoxHidden(false)}for(var a=0;a<popuplist.length;a++){popuplist[a].hide()}try{if(currenteditor){updateElementList(currenteditor)}}catch(b){}}var popuplist=new Array();