///редактор
function reDrow()
{
window.close();
LookUp();
}
function preView(img)
{
document.getElementById('preView').innerHTML='
';
}
function LookImgUp()
{
win=window.open('editer/getImgList.php','','toolbar=0,location=0,directories=0,menubar=0,scrollbar=1,resizble=0,width=710,height=500,left=100,top=50,fullscreen=0');
}
function LookFileUp()
{
win=window.open('editer/getFileList.php','','toolbar=0,location=0,directories=0,menubar=0,scrollbar=1,resizble=0,width=710,height=500,left=100,top=50,fullscreen=0');
}
function insertImg(url)
{
window.opener.document.getElementById("nicImageForm").url.value=url;
window.close();
}
function insertFile(url)
{
window.opener.document.getElementById("nicLinkURL").value=url;
window.close();
}
function delImg(img)
{
window.close();
win=window.open('delImg.php?img='+img,'','toolbar=0,location=0,directories=0,menubar=0,scrollbar=0,resizble=0,width=500,height=200,left=150,top=150,fullscreen=0');
}
var nicEditorConfig = {
buttons : {
'save' : {name : 'Сохранить', type : 'nicEditorSaveButton', tile : 1},
'bold' : {name : 'Жирный', command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, tile : 2},
'italic' : {name : 'Курсивный', command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, tile : 3},
'underline' : {name : 'Подчеркнутый', command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, tile : 4},
'left' : {name : 'Выравнивание по левому краю', command : 'justifyleft', noActive : true, tile : 8},
'center' : {name : 'Выравнивание по центру', command : 'justifycenter', noActive : true, tile : 9},
'right' : {name : 'Выравнивание по правому краю', command : 'justifyright', noActive : true, tile : 10},
'ol' : {name : 'Нумерованный список', command : 'insertorderedlist', tags : ['OL'], tile : 12},
'ul' : {name : 'Ненумерованный список', command : 'insertunorderedlist', tags : ['UL'], tile : 13},
'fontSize' : {name : 'Изменить размер шрифта', type : 'nicEditorFontSizeSelect', command : 'fontsize'},
'fontFamily' : {name : 'Изменить шрифт', type : 'nicEditorFontFamilySelect', command : 'fontname'},
'subscript' : {name : 'Нижний индекс', command : 'subscript', tags : ['SUB'], tile : 6, disabled : true},
'superscript' : {name : 'Верхний индекс', command : 'superscript', tags : ['SUP'], tile : 5, disabled : true},
'strikeThrough' : {name : 'Зачеркнутый', command : 'strikeThrough', css : {'text-decoration' : 'line-through'}, tile : 7, disabled : true},
'indent' : {name : 'Сделать отступ', command : 'indent', noActive : true, tile : 20},
'unindent' : {name : 'Убрать отступ', command : 'outdent', noActive : true, tile : 21},
'image' : {name : 'Вставить картинку', type : 'nicEditorImageButton', tile : 14},
'link' : {name : 'Вставить ссылку', type : 'nicEditorLinkButton', tile : 17}
},
iconsPath : '/modules/main/editer/nicEditorIcons.gif',
fullPanel : true,
onSubmit : null,
buttonList : ['bold','italic','underline','left','center','right','ol','ul','indent','unindent','fontSize','fontFamily','image','link']
};
function bkClass(){}bkClass.prototype.construct=function(){};bkClass.extend=function(E){var A=function(){if(arguments[0]!==bkClass){this.construct.apply(this,arguments)}};var D=new this(bkClass);var B=this.prototype;for(var F in E){var C=E[F];if(C instanceof Function){C.$=B}D[F]=C}A.prototype=D;A.extend=this.extend;return A};Function.prototype.closure=function(){var A=this,B=bkLib.toArray(arguments),C=B.shift();return function(){return A.apply(C,B.concat(bkLib.toArray(arguments)))}};Function.prototype.closureListener=function(){var A=this,C=bkLib.toArray(arguments),B=C.shift();return function(E){E=E||window.event;if(E.target){var D=E.target}else{var D=E.srcElement}return A.apply(B,[E,D].concat(C))}};function $N(A){return document.getElementById(A)}var bkLib={getStyle:function(B,A,D){var C=(!D)?document.defaultView:D;return(C&&C.getComputedStyle)?C.getComputedStyle(B,"").getPropertyValue(A):B.currentStyle[A]},setStyle:function(B,A){var C=B.style;for(itm in A){switch(itm){case"float":C["cssFloat"]=C["styleFloat"]=A[itm];break;case"opacity":C.opacity=A[itm];C.filter="alpha(opacity="+Math.round(A[itm]*100)+")";break;case"className":B.className=A[itm];break;default:if(document.compatMode||itm!="cursor"){C[itm]=A[itm]}}}},cancelEvent:function(A){A=A||window.event;if(A.preventDefault&&A.stopPropagation){A.preventDefault();A.stopPropagation()}return false},domLoad:[],domLoaded:function(){if(arguments.callee.done){return }arguments.callee.done=true;for(i=0;i<\/scr"+"ipt>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
bkLib.domLoaded();
}
};
/*@end @*/}window.onload=bkLib.domLoaded},addEvent:function(C,B,A){(C.addEventListener)?C.addEventListener(B,A,false):C.attachEvent("on"+B,A)},elmPos:function(B){var C=curtop=0;var A=B.offsetHeight;if(B.offsetParent){C=B.offsetLeft;curtop=B.offsetTop;while(B=B.offsetParent){C+=B.offsetLeft;curtop+=B.offsetTop}}return[C,curtop+A]},mousePos:function(A){return[A.pageX||A.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,A.pageY||A.clientY+document.body.scrollTop+document.documentElement.scrollTop]},getElementsByClassName:function(F){if(document.getElementsByClassName){return document.getElementsByClassName(F)}var A=[];var E=new RegExp("\\b"+F+"\\b");var D=document.getElementsByTagName("*");for(var C=0,B=D.length;C")}this.elm.className="nicEdit";bkLib.addEvent(this.elm,"mousedown",this.mouseDown.closureListener(this))},getSel:function(){return(window.getSelection)?window.getSelection():document.selection},getRng:function(){var A=this.getSel();if(!A){return null}return(A.rangeCount>0)?A.getRangeAt(0):A.createRange()},selRng:function(A,B){if(window.getSelection){B.removeAllRanges();B.addRange(A)}else{A.select()}},saveRng:function(){this.savedRange=this.getRng();this.savedSel=this.getSel()},restoreRng:function(){if(this.savedRange){this.selRng(this.savedRange,this.savedSel)}},mouseDown:function(B,A){if(this.nicEditor.selectedInstance!=this){this.nicEditor.fireEvent("noInstanceSelect",A)}this.nicEditor.selectedInstance=this;this.nicEditor.fireEvent("instanceSelect",A);this.selected()},selected:function(){this.isSelected=true;bkLib.setStyle(this.elm,{className:"nicEdit nicEdit-instanceSelect"});if(this.toolTip){this.toolTip.remove();this.toolTip=null}},unselected:function(){this.isSelected=false;bkLib.setStyle(this.elm,{className:"nicEdit nicEdit-noInstanceSelect"});if(!this.toolTip&&(this.nicEditor.options.toolTipOn||this.options.toolTipOn)){this.addTooltip();this.toolTip.setContent((this.options.toolTipText)?this.options.toolTipText:this.nicEditor.options.toolTipText)}},addTooltip:function(){this.toolTip=new nicEditorTooltip(this.elm,this.nicEditor,this.getTipStyle())},saveContent:function(){if(this.copyElm){this.copyElm.value=this.getContent()}},getContent:function(){return this.elm.innerHTML},setContent:function(A){this.elm.innerHTML=A},getTipStyle:function(){return{padding:"3px",backgroundColor:"#ffffc9",fontSize:"12px",border:"1px solid #ccc",className:"nicEdit-instanceTip"}},getDoc:function(){return document.defaultView},nicCommand:function(B,A){document.execCommand(B,false,A)}});var nicEditorIFrameInstance=nicEditorInstance.extend({elm:null,init:function(){this.elmFrame=document.createElement("iframe");this.elmFrame.setAttribute("frameBorder","0");this.elmFrame.setAttribute("allowTransparency","true");this.elmFrame.setAttribute("scrolling","no");bkLib.setStyle(this.elmFrame,{width:"100%",overflow:"hidden",className:"nicEdit-frame"});if(this.copyElm){this.elmFrame.style.width=(this.elm.offsetWidth-4)+"px"}this.initialFontSize=bkLib.getStyle(this.elm,"font-size");this.initialFontFamily=bkLib.getStyle(this.elm,"font-family");this.initialFontWeight=bkLib.getStyle(this.elm,"font-weight");this.initialFontColor=bkLib.getStyle(this.elm,"color");this.initialContent=this.elm.innerHTML;if(this.initialContent==""){this.initialContent="
"}if(!this.copyElm){this.initialHeight=0}this.elm.innerHTML="";this.elm.appendChild(this.elmFrame);this.initFrame();this.heightUpdate();bkLib.addEvent(this.elmFrame.contentWindow.document,"mousedown",this.mouseDown.closureListener(this));bkLib.addEvent(this.elmFrame.contentWindow.document,"keyup",this.heightUpdate.closureListener(this))},initFrame:function(){this.frameDoc=this.elmFrame.contentWindow.document;this.frameDoc.open();this.frameDoc.write('');this.frameDoc.write(this.initialContent);this.frameDoc.write("");this.frameDoc.close();this.frameDoc.designMode="on";this.frameContent=this.elmFrame.contentWindow.document.body;bkLib.setStyle(this.frameContent,{fontSize:this.initialFontSize,fontFamily:this.initialFontFamily,fontWeight:this.initialFontWeight,color:this.initialFontColor})},getContent:function(){return this.frameContent.innerHTML},addTooltip:function(A){this.toolTip=new nicEditorTooltip(this.elmFrame,this.nicEditor,this.getTipStyle())},setContent:function(A){this.frameContent.innerHTML=A},getDoc:function(){return this.elmFrame.contentWindow.document.defaultView},getSel:function(){return(this.elmFrame.contentWindow)?this.elmFrame.contentWindow.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=(this.frameContent.offsetHeight'+this.selConfig[itm]+"")}}});var nicEditorFontFamilySelect=nicEditorSelect.extend({selConfig:{"arial":"Arial","comic sans ms":"Comic Sans","courier new":"Courier New","georgia":"Georgia","helvetica":"Helvetica","impact":"Impact","times new roman":"Times","trebuchet ms":"Trebuchet","verdana":"Verdana"},init:function(){this.setDisplay("Шрифт...");for(itm in this.selConfig){this.add(itm,''+this.selConfig[itm]+"")}}});var nicEditorFontFormatSelect=nicEditorSelect.extend({selConfig:{"p":"Параграф","pre":"Форматированный","h6":"Заголовок 6","h5":"Заголовок 5","h4":"Заголовок 4","h3":"Заголовок 3","h2":"Заголовок 2","h1":"Заголовок 1"},init:function(){this.setDisplay("Формат шрифта...");for(itm in this.selConfig){var A=itm.toUpperCase();this.add("<"+A+">","<"+itm+' style="padding: 0px; margin: 0px;">'+this.selConfig[itm]+""+A+">")}}});var nicEditorSaveButton=nicEditorButton.extend({onSave:null,init:function(){this.onSave=this.nicEditor.options.onSave;if(!this.onSave){this.hideButton()}},mouseClick:function(){if(this.nicEditor.options.onSave){this.nicEditor.options.onSave(this.nicEditor.nicInstances)}}});var nicEditorPane=bkClass.extend({nicPane:null,options:null,isVisible:true,isOver:true,construct:function(E,B,A){this.options=A;this.nicEditor=B;this.elm=E;var C=this.nicEditor.nicPanel.panelElm;this.nicPane=document.createElement("DIV");this.pos=bkLib.elmPos(E);bkLib.setStyle(this.nicPane,{position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px",className:"nicEdit-pane"});bkLib.setStyle(this.nicPane,A);document.body.appendChild(this.nicPane);panelPos=bkLib.elmPos(C);var D=panelPos[0]+C.offsetWidth;xPos=this.pos[0]+this.nicPane.offsetWidth;if(xPos>D){bkLib.setStyle(this.nicPane,{left:(this.pos[0]-(xPos-D+1))+"px"})}this.init();bkLib.unselectAble(this.nicPane)},init:function(){},hide:function(){this.nicPane.style.display="none";this.isVisible=false},show:function(){if(this.isOver){this.nicPane.style.display="block";this.isVisible=true}},remove:function(){if(this.nicPane){document.body.removeChild(this.nicPane)}},append:function(A){this.nicPane.appendChild(A)},setContent:function(A){this.nicPane.innerHTML=A}});var nicEditorTooltip=nicEditorPane.extend({init:function(){bkLib.addEvent(this.elm,"mouseover",this.mouseOver.closureListener(this));bkLib.addEvent(this.elm,"mouseout",this.mouseOut.closureListener(this));bkLib.addEvent((this.elm.nodeName=="IFRAME")?this.elm.contentWindow.document:this.elm,"mousemove",this.mouseMove.closureListener(this));this.hide()},mouseMove:function(C){var E=bkLib.mousePos(C);var A=(this.elm.nodeName=="IFRAME");var B=A?E[0]+this.pos[0]:E[0];var D=A?E[1]+this.pos[1]-this.elm.offsetHeight:E[1];bkLib.setStyle(this.nicPane,{left:(B+10)+"px",top:(D+10)+"px"})},mouseOver:function(C,B){var A=(C.relatedTarget)?C.relatedTarget:C.toElement;while(A&&A!=this.elm){A=A.parentNode}if(A==this.elm){return }if(!this.isVisible){this.toolTimer=setTimeout(this.show.closure(this),400)}this.isOver=true},mouseOut:function(C,B){var A=(C.relatedTarget)?C.relatedTarget:C.toElement;while(A&&A!=this.elm){A=A.parentNode}if(A==this.elm){return }if(this.toolTimer){clearTimeout(this.toolTimer)}this.hide();this.isOver=false}});var nicEditorImageButton=nicEditorButton.extend({addPane:function(){this.removeTooltip();this.nicEditor.selectedInstance.saveRng();this.buttonPane=new nicEditorPane(this.buttonContain,this.nicEditor,this.getPaneStyle());var A='';this.buttonPane.setContent(A);this.imgURL=$N("nicImageURL");this.imgURL.focus();bkLib.addEvent($N("nicImageForm"),"submit",this.paneSubmit.closure(this))},paneSubmit:function(){var B=this.nicEditor.selectedInstance;if(B){B.restoreRng();var A=this.imgURL.value;if(A=="http://"||A==""){alert("Вы должны указать адрес картинки");return false}this.nicEditor.nicCommand("insertImage",A);this.removePane()}}});var nicEditorLinkButton=nicEditorButton.extend({addPane:function(){this.removeTooltip();this.nicEditor.selectedInstance.saveRng();this.buttonPane=new nicEditorPane(this.buttonContain,this.nicEditor,this.getPaneStyle());var A='';this.buttonPane.setContent(A);this.linkURL=$N("nicLinkURL");this.linkURL.focus();bkLib.addEvent($N("nicLinkForm"),"submit",this.paneSubmit.closure(this))},paneSubmit:function(){var B=this.nicEditor.selectedInstance;if(B){this.nicEditor.selectedInstance.restoreRng();var A=this.linkURL.value;if(A=="http://"||A==""){alert("Вы должны указать адрес");return false}this.nicEditor.nicCommand("createlink",A)}this.removePane()}});var nicEditorHTMLButton=nicEditorButton.extend({addPane:function(){this.removeTooltip();this.buttonPane=new nicEditorPane(this.buttonContain,this.nicEditor,{width:(this.nicEditor.nicPanel.panelElm.offsetWidth-12)+"px",textAlign:"left",border:"1px solid #ccc",zIndex:"9999",backgroundColor:"#fff"});paneContent='';this.buttonPane.setContent(paneContent);bkLib.addEvent($N("nicHTMLForm"),"submit",this.paneSubmit.closure(this));$N("nicHTMLArea").value=this.nicEditor.selectedInstance.getContent()},paneSubmit:function(){var A=this.nicEditor.selectedInstance;if(A){A.restoreRng();A.setContent($N("nicHTMLArea").value)}this.removePane()}});var nicEditorColorButton=nicEditorButton.extend({addPane:function(){this.removeTooltip();this.buttonPane=new nicEditorPane(this.buttonContain,this.nicEditor,this.getPaneStyle());var D={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"};var H=document.createElement("DIV");bkLib.setStyle(H,{width:"270px"});for(var A in D){for(var F in D){for(var E in D){var C=document.createElement("DIV");var G=document.createElement("DIV");var B=document.createElement("DIV");var I="#"+D[A]+D[E]+D[F];bkLib.setStyle(C,{"cursor":"pointer","height":"15px","float":"left"});bkLib.setStyle(G,{border:"2px solid "+I});bkLib.setStyle(B,{backgroundColor:I,overflow:"hidden",width:"11px",height:"11px"});bkLib.addEvent(C,"click",this.colorSelect.closure(this,I));bkLib.addEvent(C,"mouseover",this.borderOn.closure(this,G));bkLib.addEvent(C,"mouseout",this.borderOff.closure(this,G,I));if(!window.opera){C.onmousedown=bkLib.cancelEvent;B.onmousedown=bkLib.cancelEvent}C.appendChild(G);G.appendChild(B);H.appendChild(C)}}}bkLib.unselectAble(H);this.buttonPane.append(H)},colorSelect:function(A){this.nicEditor.nicCommand("foreColor",A);this.removePane()},borderOn:function(A){bkLib.setStyle(A,{border:"2px solid #000"})},borderOff:function(A,B){bkLib.setStyle(A,{border:"2px solid "+B})}})