//в 6м кодексе нет возможности работать с кукисами, //все хранится в базе function DoSearch() { // без этого костыля поиск по сборникам в клиенте не работает if (null != window.getSearchFormLength) { var len = window.getSearchFormLength(); if (len > 400) { alert('Для выполнения поиска, пожалуйста, конкретизируйте запрос путем уменьшения поисковых условий.'); return false; } } //window.clearSearchFormLabels(); document.forms[0].submit(); return true; } function el(p) { if('string' == typeof p) { return document.getElementById(p); } return p; } function getCookies() { var result = document.cookie; if ('' == result && null != window.biscuit) { result = window.biscuit; } return result; } function cutSecInfoFromURL() { var url = window.location.href; //alert(url); } function createSpinner(serverPath) { var div = document.createElement('div'); div.id = 'spinner'; div.className = 'spinner'; div.style.textAlign = 'center'; div.style.width = '100%'; div.style.marginTop = '20%'; var img = document.createElement('img'); img.src = serverPath + 'spinner.gif'; img.align = 'absmiddle'; div.appendChild(img); var span = document.createElement('span'); span.innerHTML = 'Загрузка полного текста документа'; div.appendChild(span); return div; } /*** Тэги
или
делят текст с разной ориентацией страниц. По ним и ориентируемся. Ставим этому диву большую ширину, если в нем найдены широкие таблицы. Или если это псевдографическая таблица. ***/ function setLandscape () { //debugger; var psevdoLines = [ "----------", "----------", "——————————" ]; try{ var divContent = document.getElementById("doc_content"); var divs = divContent.getElementsByTagName("div"); for (var i = 0; i < divs.length; ++i) { if ((divs[i].className + "").indexOf("Section") != -1) { var innerText = divs[i].innerText + ""; for (var j = 0; j < psevdoLines.length; ++j) { if (innerText.indexOf(psevdoLines[j]) == -1) continue; var lines = innerText.split('\n'); for (var k = 0; k < lines.length; ++k) { if (lines[k].indexOf(psevdoLines[j]) != -1) { if (lines[k].length > 122) { divs[i].style.width = 1800; break; } else if (lines[k].length > 81) { divs[i].style.width = 1020; } } } } } } var tables = document.getElementById("doc_content").getElementsByTagName("TABLE"); for (var i = 0; i < tables.length; ++i) { if(tables.item(i).clientWidth > 750) { var parentDiv = tables.item(i).parentNode; while (parentDiv != null && parentDiv.tagName.toUpperCase() != "DIV") parentDiv = parentDiv.parentNode; if (parentDiv != null) { var width = tables.item(i).clientWidth; if (width == 0 || width > 1020) width = 1020; if (parentDiv.style.width < width) parentDiv.style.width = width; } } if (tables.item(i).style.marginLeft.charAt(0) == '-') tables.item(i).style.marginLeft = 0; } } catch (err) { // На огромных документах может появиться ошибка, связанная с нехваткой памяти } } function iePrint() { cutSecInfoFromURL(); if (navigator.appName.indexOf('Internet Explorer') >= 0) { try { var timeId = setTimeout('document.parentWindow.close()', 1000); var obj = document.createElement('div'); obj.innerHTML += ''; document.body.appendChild(obj); document.getElementById("webBrowser").ExecWB(7,1); obj.innerHTML = ""; } catch(e) { clearTimeout(timeId); window.print(); } } else { if ( window.print ) window.print(); } } function winPathSlice(win) { this.result = win; this.nextStep = function(step) { if (step == '') return new docPathSlice(this.document); if (step == '..') return new winPathSlice(this.result.parent); if (step.charAt(0) == '*') return new collPathSlice(this.result.document.getElementsByTagName(step.substring(1))); return new elemPathSlice(this.result.document.getElementById(step)); } } function docPathSlice(doc) { this.result = doc; this.nextStep = function(step) { if (step.charAt(0) == '*') return new collPathSlice(this.result.getElementsByTagName(step.substring(1))); return new elemPathSlice(this.result.getElementById(step)); } } function elemPathSlice(elem) { this.result = elem; this.nextStep = function(step) { if (step == '') return new elemPathSlice(this.result.contentWindow.document); if (step == '.') return new winPathSlice(this.result.contentWindow); if (step.charAt(0) == '*') return new collPathSlice(this.result.getElementsByTagName(step.substring(1))); return new elemPathSlice(this.result.contentWindow.document.getElementById(step)); } } function collPathSlice(coll){ this.result = coll; this.nextStep = function(step) { return new elemPathSlice(this.result[step]); } } function framePath(path, start){ var pathElems = path.split("/"); var currentElem; if (pathElems[0] == '') { currentElem = new winPathSlice(top); pathElems.splice(0,1); } else if (start != null) { if (start.document && start.location) currentElem = new docPathSlice(start.document); else if (start.location) currentElem = new docPathSlice(start); else currentElem = new elemPathSlice(start); } else { currentElem = new winPathSlice(window); } for (var i = 0; i < pathElems.length; i++) { if (currentElem.result == null) break; currentElem = currentElem.nextStep(pathElems[i]); } return currentElem.result; } function pair(x,y){return function(f){return f(x,y)}} function fst(p){return p(function(x,y){return x})} function snd(p){return p(function(x,y){return y})} Array.prototype.concat = Array.prototype.concat || function (arr) { for (var i = 0; i < arr.length; i++) this.push(arr[i]); return this; } Array.prototype.indexOf = Array.prototype.indexOf || function (elem) { for (var i = 0; i < this.length; i++) if (this[i] == elem) return i; return -1; } Array.prototype.map = function (callback){return this.zipWithIndices(function(i,v){return callback(v);});} Array.prototype.zipWithIndices = function (callback){ var list = new Array(); for (var i = 0; i < this.length; i++) list[i] = callback(i,this[i]); return list; } Array.prototype.filter = function (predicate){ var list = new Array(); for (var i = 0; i < this.length; i++) if (predicate(this[i])) list.push(this[i]); return list; } Array.prototype.foldr = function (callback,init){ var value = init; for (var i = this.length - 1; i >= 0; i--) value = callback(this[i],value); return value; } Array.prototype.foldlM = function (init,callback){ var list = new Array(); var result = init; for (var i = 0; i < this.length; i++){ result = callback(result,this[i])(function(lst,res){list.concat(lst); return res}); } return pair(list,result); } function toArray(arg) { //jack_smith пытаемся создать массивы на основе object, в которых есть [0], [1] и т.д. var length = arg.length; if (null == length) { length = 0; while (null != arg[length]) { length++; } } var result = new Array(); for (var i = 0; i < length; i++) { result.push(arg[i]); } return result; } function htmlZipper(lastTableNode){ this.lastTableNode = lastTableNode; this.count = 0; } function toHtml(zipper,obj){ switch(typeof(obj)){ case "string": case "number": return document.createTextNode(obj); case "object": if (obj instanceof Array) return obj.map(function(element){return toHtml(zipper,element)}) else { var tagName = obj.tagName; var element; var newZipper = zipper; switch(tagName.toUpperCase()){ case "TR": element = zipper.lastTableNode.insertRow(zipper.count); zipper.count++; newZipper = new htmlZipper(element); break; case "TD": element = zipper.lastTableNode.insertCell(zipper.count); zipper.count++; break; case "TABLE": element = document.createElement(tagName); newZipper = new htmlZipper(element); break; default: element = document.createElement(tagName); } for (var i in obj) switch(i){ case "tagName": break; case "childNodes": appendElements(element,toHtml(newZipper,obj[i])); break; default: appendAttrib(element,i,obj[i]); } return element; } break; default: return null; } } function appendAttrib(element,name,value){ switch(typeof(value)){ case "string": case "number": case "function": element[name] = value; break; case "object": if (value instanceof Array){ if (element[name] == null) element[name] = []; for (var i = 0; i < value.length; i++) appendAttrib(element[name],i,value[i]); } else { if (element[name] == null) element[name] = {}; for (var i in value) appendAttrib(element[name],i,value[i]); } break; } } function appendElements(element,objs){ if (objs instanceof Array) for (var i = 0; i < objs.length; i++) appendElements(element,objs[i]) else if (objs.tagName == null) element.appendChild(objs) else switch(objs.tagName.toUpperCase()){ case "TD": case "TR": break; default: element.appendChild(objs); } } function appendJS(element,objs){ var zipper = null; switch (element.tagName){ case "TABLE": zipper = new htmlZipper(element); zipper.count = element.rows.length; break; case "TR": zipper = new htmlZipper(element); zipper.count = element.cells.length; break; default: } appendElements(element,toHtml(zipper,objs)); } function partialDate(str){ var pD = new partialDateObject(); str.split("").filter(function (chr) {return (chr == "." || isFinite(parseInt(chr)))}).map(function (digit){pD.step(digit)}); return pD; } function partialDateObject(){ this.day = ""; this.month = ""; this.year = ""; this.dot = 0; this.step = function(digit){ if (digit == "."){ switch(this.dot){ case 1: var monthDaysCount = [31,31,29,31,30,31,30,31,31,30,31,30,31][parseInt(this.month)]; if (parseInt(this.day,10) > monthDaysCount) this.day = monthDaysCount.toString(); case 0: this.dot += 1; } return; } var value = this[["day","month","year"][this.dot]]; if ((value.length == 2 && this.dot < 2)){ this.step("."); this.step(digit); return; } value += digit; if (this.dot < 2 && parseInt(value,10) > [31,12][this.dot]){ this.step("."); this.step(digit); return; } this[["day","month","year"][this.dot]] = value; } this.lastStep = function(){ if (this.day.length == 0) return ""; switch(this.year.length){ case 1: this.year = "200" + this.year; break; case 2: this.year = "19" + this.year; break; } var day = parseInt(this.day,10); var month = parseInt(this.month,10); var year = parseInt(this.year,10); if (day == 0 || isNaN(day)) day = 1; if (month == 0 || isNaN(month)) month = 1; if (year == 0 || isNaN(year)) year = 1900; year = year % 10000; if ((year % 4 != 0 || year % 400 == 0) && month == 2 && day == 29) day = 28; var day_str = day.toString(); var month_str = month.toString(); var year_str = year.toString(); if(day_str.length == 1) day_str = "0" + day_str; if(month_str.length == 1) month_str = "0" + month_str; return day_str + "." + month_str + "." + year_str; } this.toString = function(){ return this.day + (this.dot > 0 ? "." : "") + this.month + (this.dot > 1 ? "." : "") + this.year; } } function hideBlock(bid) { var block = framePath(bid); if (block == null) return; if (block.className == 'vis') block.className='inv'; else block.style.visibility = 'hidden'; } function viewBlock(bid) { var block = framePath(bid); if (null == block) return; if (block.className == 'inv') block.className='vis'; else block.style.visibility = 'visible'; } function killBlock(bid) { if(bid == 'dd_dbs_link' && document.getElementById("a7type") != null){ document.getElementById("a7type").disabled = false; } var block = framePath(bid); if ( block ) block.style.display='none'; } function showBlock(bid, doc) { if(bid == 'dd_dbs_link' && document.getElementById("a7type") != null){ document.getElementById("a7type").disabled = true; } framePath(bid, doc || document).style.display='block'; } function switchBlockView(bid){ var elemStyle = framePath(bid).style; if (elemStyle.display == 'none') elemStyle.display = 'block'; else elemStyle.display = 'none'; } function softkillBlock(bid, doc) { framePath(bid, doc || document).style.display='none'; } function softshowBlock(bid, doc) { framePath(bid, doc || document).style.display=''; } var pCookies = new Array(); function parseCookies(){ var aCookies = document.cookie.split("; "); for (var i=0;i 0 ) selexist = '&selexist=1'; win = window.open(document.pPath + 'listselcombo.html' + selexist, "window_filter", "width=" + size.width + ",height=" + size.height + ",toolbar=no,resizable=yes"); } function findTextWindow(url){ size = {'width':540,'height':270}; win = window.open(url, "window_find", "width=" + size.width + ",height=" + size.height + ",toolbar=no,resizable=yes"); } function calculateDimDiff(){ var prefs = new cookiePrefs(); var size = prefs.wFilterSize; if (size == null) size = {'width':534,'height':513}; var innerSize = {}; if (navigator.appName.indexOf('Internet Explorer') >= 0) { innerSize.width = document.body.clientWidth; innerSize.height = document.body.clientHeight; } else { innerSize.width = window.innerWidth; innerSize.height = window.innerHeight; } window.diffX = size.width - innerSize.width; window.diffY = size.height - innerSize.height; if (window.diffX < 0) window.diffX = 0; if (window.diffY < 0) window.diffY = 0; } function saveDimensions(){ var prefs = new cookiePrefs; var size = {}; if (navigator.appName.indexOf('Internet Explorer') >= 0) { size.width = document.body.clientWidth; size.height = document.body.clientHeight; } else { size.width = window.innerWidth; size.height = window.innerHeight; } if (window.diffX != null) size.width += window.diffX; if (window.diffY != null) size.height += window.diffY; prefs.wFilterSize = size; prefs.save(); } function clearField(attr,type){ switch(type){ case "1": framePath('a' + attr + 'type').value = "1"; framePath('a' + attr + 'type').onchange(); framePath('a' + attr + 'from').value = ""; framePath('a' + attr + 'to').value = ""; framePath('a' + attr + 'date').value = ""; break; case "2": framePath('a' + attr).value = ""; break; case "3": framePath('a' + attr).value = ""; break; case "5": framePath('a' + attr).value = ""; framePath('a' + attr + 'type').value = ""; framePath('a' + attr + 'label').value = ""; break; } } function editField(attr){ var field = framePath("a" + attr + "label"); if (field.value == "") clearField(attr,5) else showPopupClassif(attr, 'bpa=' + pCookies['bpas'] +'&a' + attr + 'type=' + framePath('a' + attr +'type').value, document.pPath); } function clearQuery(){ var rows = framePath('searchfields/*TR'); for (var k = 0; k < rows.length; k++){ var clName = rows[k].className; if (clName != null){ var typeinfo = rows[k].className.split('_'); clearField(typeinfo[2],typeinfo[1]); } } } function reloadClear() { window.location.href = document.pPath + "start_search" + document.fattrib; } function printlist() { window.open(window.location.href.replace("?searchlist", "?find") + "&print=1"); } function MarkSelectedDocuments() { var cls = top.CurrentListSelection; if (null == cls) return; var listFrame = top.document.all["topmenu"].contentWindow.document.all["list"].contentWindow.document; var cBoxes = listFrame.getElementsByTagName("input"); for (var i = 0; i < cBoxes.length; i++){ var input = cBoxes[i]; var oidStr = input.name.replace('check_', ''); var oid = parseInt(oidStr); input.checked = cls.isSelected(oid); } } function firstLoad(num){ var firstA = document.getElementById('link_' + (num ? num : '0')); if (null != firstA) { var content = framePath("/contents/."); if (null == content) return; content.location.replace(firstA.href); setBorder(firstA, "cur"); } checkFrame(); } function lastLoad(){ var links = framePath('list_results/*A'); //var lastA = links[links.length-3]; 24.02.11 Nina: исправлено var lastA = links[links.length-5]; top.contents.location.replace(lastA.href); setBorder(lastA,"cur"); checkFrame(); } function maximizeFrame() { framePath('/*FRAMESET/0').cols='*,0'; killBlock('/topmenu/res_pic_frame_maximize'); showBlock('/topmenu/res_pic_frame_minimize'); } function restoreFrame() { if (null == framePath('/*FRAMESET/0')) return; if (framePath('/*FRAMESET/0').cols == '*,0') framePath('/*FRAMESET/0').cols='36%,*'; killBlock('/topmenu/res_pic_frame_minimize'); showBlock('/topmenu/res_pic_frame_maximize'); } function checkFrame() { var fs = framePath('/*FRAMESET/0'); if(fs != null){ if(fs.cols == "*,0") maximizeFrame(); if(fs.cols == "0,*") maximizeDocFrame(); } } function maximizeDocFrame(align) { var dir = (align == "top" || align == "bottom") ? "rows":"cols"; var val = (align == "left" || align == "top") ? "*,0" : "0,*"; framePath('/*FRAMESET/0')[dir] = val; killBlock('doc_pic_frame_maximize'); showBlock('doc_pic_frame_minimize'); } function restoreDocFrame(align) { var dir = (align == "top" || align == "bottom") ? "rows":"cols"; var val = (align == "") ? "36%,*" : "50%,*"; framePath('/*FRAMESET/0')[dir]=val; killBlock('doc_pic_frame_minimize'); showBlock('doc_pic_frame_maximize'); } function parentNodeTag(item,tag){ var upper=item.parentNode; while(upper.tagName.toUpperCase()!=tag){upper=upper.parentNode} return upper; } function setBorder(item,style){ if(null == top.topmenu) return; if(top.topmenu.selctdItem!=undefined && style=="cur"){setBorder(top.topmenu.selctdItem,top.topmenu.selctdClass);} top.topmenu.selctdItem=item; var divcell=parentNodeTag(parentNodeTag(item,"TABLE"),"TABLE"); top.topmenu.selctdClass=divcell.className.split(' ')[1]; divcell.className="list_elem " + style; if (style == "cur") moveToVisible(divcell,item); } function chrdk(r, params) { var rr = eval("new Array(" + r + ")"); window.location.href = "?docbody=&nd=" + rr[1] + "&rdk=" + rr[0] + (params || ""); return true; } function ChangeSelRDK(owner, last_select, params) { if(chrdk(owner.value, params)) { last_select.value = owner.value ; }else { //alert(last_select.value); return false;//owner.value = last_select.value ; } } function chrdk(r, params) { if (r != 'n') { var rr = eval("new Array(" + r + ")"); window.location.href = "?docbody=&nd=" + rr[1] + "&rdk=" + rr[0] + (params || ""); return true ; } else { alert("Выбранная редакция не готова"); return false ; } } function changeDocStyle(style){ killBlock('dd_style'); if (null == framePath('list/').body.className || "" == framePath('list/').body.className) { alert("Для данного документа изменение стилей невозможно"); return; } framePath('list/').body.className = style; var today = new Date(); today.setDate(today.getDate() + 7); document.cookie = 'theme-document=' + style + "; expires=" + today.toGMTString(); } function changeDocFont(fontstyle){ var menu = framePath('dd_font/*DIV'); if (null == menu) return; for (var i = 0; i < menu.length; i++) if (menu[i].className == 'font_cur') {menu[i].className = 'font';} try { // if (navigator.appName.indexOf('Internet Explorer') >= 0) { // framePath('list').contentWindow.fixDocDimensions(fontstyle); // } else { framePath('list/doc_content').className = fontstyle; // } } catch(e) { //!!! Если документ не HTML, то здесь будет ошибка alert("Для данного документа изменение стилей невозможно"); return; } framePath('font_menu_'+fontstyle).className = 'font_cur'; var today = new Date(); today.setDate(today.getDate() + 7); document.cookie = 'font-size-document=' + fontstyle + "; expires=" + today.toGMTString(); killBlock('dd_font'); } function changeListStyle(style){ framePath('list/list_results').className = style; var today = new Date(); today.setDate(today.getDate() + 7); document.cookie = 'theme-contents=' + style + "; expires=" + today.toGMTString(); } function changeListFont(fontstyle){ var menu = framePath('dd_sets1/*DIV'); if(menu==null)return; for (var i = 0; i < menu.length; i++) if (menu[i].className == 'font_cur') menu[i].className = 'font'; framePath('font_menu_'+fontstyle).className = 'font_cur'; var elem = framePath('list/list_results_4fontsize')//.className = fontstyle; //isClientList = false; var cookName = 'font-size-contents'; if (elem == null){ elem = document.getElementById('list_results_4fontsize'); //isClientList = true; cookName = 'font-size-list'; } elem.className = fontstyle; var today = new Date(); today.setDate(today.getDate() + 7); document.cookie = cookName + '=' + fontstyle + "; expires=" + today.toGMTString(); } function SetURLParam(url, name, value) { var arr = (url + "").split("&"); var found = false; for (var i in arr) { var paramStr = arr[i] + ""; var param = paramStr.split("="); found = (name == param[0]); if (found) { arr[i] = name + "=" + value; break; } } if ( !found ) { arr[arr.length] = name + "=" + value; } var result = arr.join("&"); return result; } function changeListSize(size){ var url = SetURLParam(window.location, "lstsize", size); url = SetURLParam(url, "start", 0) window.location.replace(url); } function dateSwitch(identTwo,identOne,attr,event){ var index = framePath("a" + attr + "type").options.selectedIndex; var showTwo = index >= 3; var divOne = framePath(identOne); var divTwo = framePath(identTwo); var divToShow = showTwo ? divTwo : divOne; var divToHide = showTwo ? divOne : divTwo; divToShow.style.display = 'inline'; divToHide.style.display = 'none'; var dateInput = framePath("a" + attr + "date"); var fromInput = framePath("a" + attr + "from"); var toInput = framePath("a" + attr + "to"); var sourceInput = index == 1 ? toInput : fromInput; if (sourceInput.value == '') sourceInput = index == 1 ? fromInput : toInput; if (sourceInput.value == '') sourceInput = dateInput; var targetInput = showTwo ? top.dateSwitchIndex == 1 ? toInput : fromInput : dateInput; targetInput.value = sourceInput.value; var inputs = framePath('*INPUT',divToHide); for (var i = 0; i < inputs.length; i++){ inputs[i].value = ''; } top.dateSwitchIndex = index; if (index > 3){ var readonly = "readOnly"; framePath("a" + attr + "from").readOnly = true; framePath("a" + attr + "to").readOnly = true; framePath("img_" + attr + "_from").style.display = 'none'; framePath("img_" + attr + "_to").style.display = 'none'; var today = new Date(); var month = today.getMonth(); var granularity = [12,6,3,1][index-4]; month = granularity * Math.floor(month / granularity); framePath("a" + attr + "from").value = "1." + (month + 1) + "." + today.getFullYear(); today.setMonth(month + granularity); today.setDate(0); framePath("a" + attr + "to").value = today.getDate() + "." + (month + granularity) + "." + today.getFullYear(); } else { framePath("a" + attr + "from").readOnly = false; framePath("a" + attr + "to").readOnly = false; framePath("img_" + attr + "_from").style.display = 'inline'; framePath("img_" + attr + "_to").style.display = 'inline'; } } function changeSortOrder(oldSort,newSort){ window.location.replace(window.location.href.replace('&sort='+oldSort,'&sort='+newSort)); } function showExAttribForm(elname, basePath, instring) { var url = basePath + 'exattribform&instring=' + escape(instring); var w = 610; var h = 480; if (window.showModalDialog){ var res = window.showModalDialog(url, document, 'dialogWidth:' + w + 'px;' + 'dialogHeight:' + h + 'px;' + 'status:no;resizable:on;scroll:no;help:no'); doAttribForm(res, elname); } else { //todo jack_smith это не работает winModalWindow = window.open(url + "&elname=" + elname, "ModalChild", "dependent=yes,status=no," + "width=" + w + "," + "height=" + h + "," + "screenX=" + (screen.width - w) / 2 + "," + "screenY=" + (screen.height - h) / 2); winModalWindow.focus(); } return false; } function doAttribForm(res, elname) { if (res!=null && res!=undefined) { document.getElementById(elname).value = res; } } function showPopupClassif(attr, param, basePath) { //==== Козарь 26.06.2007 используем списки из клиента //==== Miguel 05.07.2007 не используем списки из клиента //==== Kulch 07.08.07 все проще - если показываем "Отрасли зак-ва" или "Ключ. слова", то // используем списки из клиента (атрибуты соотв. 24 и 23) if(attr == 23 || attr == 24 || attr == 17){ var base_url = 'select_classif'; if (attr == 17) base_url = 'select_puplic'; var aname = 'a' + attr; if(document.getElementById(aname) != null){ var vSelected = document.getElementById(aname).value; var url = basePath + base_url + '&access=1&mclassif=' + attr + '&' + param + '&' + aname + '=' + vSelected + '&' + aname + 'area=110'; }else{ var url = basePath + 'mclassif&nclassif=' + attr + '&' + param; } } else { var url = basePath + 'mclassif&nclassif=' + attr + '&' + param; } var w = 700; var h = 650; //==== Козарь 26.06.2007 списки из клиента подглючивают в showModalDialog //==== Miguel 05.07.2007 можно подумать, они хоть где-то хоть как-то не подглючивают if (window.showModalDialog){ window.showModalDialog(url, document, 'dialogWidth:' + w + 'px;' + 'dialogHeight:' + h + 'px;' + 'status:no;resizable:on;scroll:no;help:no' ); } else { winModalWindow = window.open(url, "ModalChild", "dependent=yes,status=no,resizable=on," + "width=" + w + "," + "height=" + h + "," + "screenX=" + (screen.width - w) / 2 + "," + "screenY=" + (screen.height - h) / 2); if ( winModalWindow ) winModalWindow.focus(); } return false; } function clickAndGo(element,event){ if (getEventTarget(event).tagName == "INPUT") return; var a = framePath('*A/0',element); a.onclick(); if(framePath('/contents') != null) framePath('/contents').src = a.href; } function clickAndGoVKart(element){ var a = framePath('*A/0',element); unSelectText(); a.onclick(); framePath('/contents').src = a.href + '&vkart=card'; } function unSelectText(){ if (document.selection) if (document.selection.empty) document.selection.empty(); if (window.getSelection){ var sel = window.getSelection(); if (sel.removeAllRanges) sel.removeAllRanges(); } } function goToPrevDoc(){ if (document.isBodyLoaded != true) return; var link = framePath('/topmenu/list/link_' + (document.link_id - 1)); if (link){ top.contents.location.replace(link.href); setBorder(link,"cur"); checkFrame(); } else { goToPrevPage(); } } function goToNextDoc(){ if (document.isBodyLoaded != true) return; var link = framePath('/topmenu/list/link_' + (document.link_id + 1)); if (link){ top.contents.location.replace(link.href); setBorder(link,"cur"); checkFrame(); } else { goToNextPage(); } } function goToPrevPage(){ var menuwin = framePath('/topmenu/.'); var prevPageLink = framePath('prevPage',menuwin); if (prevPageLink) {menuwin.location.href = prevPageLink.href + '&llast=1'} } function goToNextPage(){ var menuwin = framePath('/topmenu/.'); var nextPageLink = framePath('nextPage',menuwin); if (nextPageLink) {menuwin.location.href = nextPageLink.href} } function printChecked(action, bpaList, empire, collection) { var cls = top.CurrentListSelection; var noneSelected = !cls.isAllSelected(); if (noneSelected) { var included = cls.getIncludedArray(); noneSelected = (0 == included.length); } if (noneSelected) { alert("Для выполнения операции, пожалуйста, отметьте нужные документы"); return; } var orderSelection = ""; if(included != null) orderSelection = included.toJSONString(); if ("txt" == action) { var title = "Экспорт списка документов в TXT"; } else if ("rtf" == action) { var title = "Экспорт списка документов в RTF"; } else { var title = "Печать списка документов"; } if (null == action) action = ''; else{ action = '&action=' + action; } var json = cls.getAsString(); var url = pPath() + 'docsexportdlg.html' + action + "&setname=" + top.setname + "&selection=" + json + "&title=" + escape(title) + "&bpalist=" + escape(bpaList) + "&order=" + escape(orderSelection) + "&" + empire + "&" + collection; var win = window.open(url, 'window_print', "width=" + 620 + ",height=" + 370 + ",toolbar=no,resizable=yes"); } function setHiddenFields(doc){ if (doc == null) doc = document; var hidden = doc.getElementById('print_form_hidden'); var len = hidden.childNodes.length; var top = window.opener.top; top.boxes = top.boxes || new Array(); if (top.inversed == null) top.inversed = false; for (var k = 0; k < len; k++){ hidden.removeChild(hidden.childNodes[0]); } for (var k = 0; k < top.plen; k++) appendJS(hidden,{ 'tagName':"INPUT", 'type':"hidden", 'name':top.pname[k], 'value':top.pvalue[k] }); if (top.boxes.length == 0 && !top.inversed){ doc.getElementById('print_checked').disabled='disabled'; doc.getElementById('print_not_checked').disabled='disabled'; doc.getElementById('print_all').checked='checked'; return; } doc.getElementById('print_checked').disabled=''; doc.getElementById('print_checked').checked='checked'; doc.getElementById('print_checked').value = top.inversed ? 'not_checked' : 'checked'; doc.getElementById('print_not_checked').value = top.inversed ? 'checked' : 'not_checked'; doc.getElementById('print_not_checked').disabled=''; var docsfield = '' + top.boxes[0]; for (i = 1; i < top.boxes.length; i++){ docsfield += ';' + top.boxes[i]; } appendJS(hidden,{ 'tagName':"INPUT", 'type':"hidden", 'name':"docs", 'value':docsfield }); } function showCalendar(id,input,event){ if (document.body.onclick != null) closeCalendar(); fillCal(id); showBlock(id); top.calOpened = id; top.calInput = input; document.body.onclick = closeCalendar; stopPropg(event); } top.curDate = new Date(); function setCurMonth(month){ top.curDate.setMonth(month); } function adjustCurYear(adj){ top.curDate.setFullYear(top.curDate.getFullYear() + adj); } function adjustCurMonth(adj){ top.curDate.setMonth(top.curDate.getMonth() + adj); } function fillCal(id){ var Months = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"]; var dateNowVal = new Date(); var dateNowDay = dateNowVal.getDate(); var dateNowMonth = dateNowVal.getMonth(); var dateNowYear = dateNowVal.getFullYear(); var dateNow = document.createTextNode(dateNowVal.getDate() + '.' + (dateNowVal.getMonth()+1).toString() + '.' + dateNowVal.getFullYear()); var dateNowSpan = framePath(id + 'cal_date'); dateNowSpan.removeChild(dateNowSpan.childNodes[0]); dateNowSpan.appendChild(dateNow); var curMonth = top.curDate.getMonth(); var curYear = top.curDate.getFullYear(); var calRows = framePath(id + 'calendar_days/*TR'); var loopDate = new Date(); loopDate.setTime(top.curDate.getTime()); loopDate.setDate(1); var loopDay = loopDate.getDay(); if (loopDay < 2) loopDay += 7; loopDate.setDate(loopDate.getDate() - loopDay); for (var j = 1; j < 7; j++) for (var i = 0; i < 7; i++){ loopDate.setDate(loopDate.getDate() + 1); var cell = framePath('*TD/' + i, calRows[j]); cell.removeChild(cell.childNodes[0]); var span = document.createElement('SPAN'); span.appendChild(document.createTextNode(loopDate.getDate())); if (loopDate.getMonth() != curMonth){ span.className = 'alien'; cell.onclick = null; } else { cell.day = loopDate.getDate(); cell.month = loopDate.getMonth(); cell.year = loopDate.getFullYear(); cell.onclick = setCurDate; } if (loopDate.getDate() == dateNowDay && loopDate.getMonth() == dateNowMonth && loopDate.getFullYear() == dateNowYear) cell.className = 'cur'; else cell.className = ''; cell.appendChild(span); } framePath(id + 'month_choice').selectedIndex = curMonth; var select = framePath(id + 'year_choice'); if (select.childNodes.length != 101){ while(select.childNodes.length > 0) select.removeChild(select.childNodes[0]); for (var i = curYear - 50; i <= curYear + 50; i++){ var opt = document.createElement('OPTION'); opt.appendChild(document.createTextNode(i)); opt.value = i; select.appendChild(opt); } select.selectedIndex = 50; } else { var j = 0; for (var i = curYear - 50; i <= curYear + 50; i++){ var opt = select.childNodes[j]; opt.value = i; opt.childNodes[0].nodeValue = i; if (j == 50) select.selectedIndex = 50; j++; } } } function fillYear(select, selValue){ if(selValue == ""){ return; } var value = parseInt(selValue, 10); var curYear = (new Date()).getFullYear(); var lastYear = value + 30; var firstYear = value - 30; if(lastYear > curYear){ lastYear = curYear; firstYear = curYear - 60; } if (select.childNodes.length != 62){ while(select.childNodes.length > 0) select.removeChild(select.childNodes[0]); var j = 0; for (var i = firstYear; i <= lastYear; i++){ var opt = document.createElement('OPTION'); opt.appendChild(document.createTextNode(i)); opt.value = i; select.appendChild(opt); if (i == value) select.selectedIndex = j; j++; } var opt = document.createElement('OPTION'); opt.appendChild(document.createTextNode("...")); opt.value = ""; select.appendChild(opt); }else{ var j = 0; for (var i = firstYear; i <= lastYear; i++){ var opt = select.childNodes[j]; opt.value = i; opt.childNodes[0].nodeValue = i; if (i == value) select.selectedIndex = j; j++; } } } function setCurDate(){ top.curDate.setDate(this.day); top.curDate.setMonth(this.month); top.curDate.setFullYear(this.year); var strday = this.day.toString(); if (this.day <= 9) strday = "0" + this.day.toString(); var strmonth = (this.month+1).toString(); if ((this.month + 1) <= 9) strmonth = "0" + (this.month+1).toString(); framePath(top.calInput).value = strday + '.' + strmonth + '.' + this.year; closeCalendar(); } function closeCalendar(){ var win = window; while (framePath(top.calOpened,win) == null) win = win.parent; win.killBlock(top.calOpened); win.document.body.onclick = null; } function stopPropg(event){ event = event || window.event; if (event.stopPropagation != null){ event.stopPropagation(); } else { event.cancelBubble = true; } } function doNothing(){ } function checkFilter(name){ var inputs = framePath(name + '/*INPUT'); for (var i = 0; i < inputs.length; i++){ var inp = inputs[i]; if (inp.type == 'text' && inp.value != '') return true; } window.alert('Нет данных для выполнения запроса'); return false; } function changeState(num,event){ var state = getEventTarget(event).checked; top.boxes = top.boxes || new Array(); top.inversed = top.inversed || false; if (top.inversed) state = !state; if (state){ top.boxes.push(num); } else { top.boxes.splice(top.boxes.indexOf(num),1); } } function showBookmarks(bpas,intelsearch,showCreation){ closeOtherPopups('window_bookmarks'); window.open(pPath() + 'window_bookmarks' + (showCreation ? '&action=create' : ''),'window_bookmarks', "width=" + 534 + ",height=" + 513 + ",toolbar=no,resizable=yes"); } function getContents(){ var cont = framePath('/contents'); if (null == cont) return window; return framePath('/contents/list/.'); } function showSets(action, oid){ closeOtherPopups('window_sets'); window.open(pPath() + 'window_sets&action=' + action + '&oid=' + oid, 'window_bookmarks', "width=" + 534 + ",height=" + 513 + ",toolbar=no,resizable=yes"); } function parseCookieVar(name){ var prefs = new cookiePrefs(); var val = prefs[name]; if (val == null) { return new Array(); } return val; } function saveCookieVar(name,value){ var prefs = new cookiePrefs(); prefs[name] = value; prefs.save(); } function saveQuery(name,value){ window.open(pPath() + 'window_queries&action=create&name=' + name + '&value=' + escape(value),'window_bookmarks', "width=" + 534 + ",height=" + 513 + ",toolbar=no,resizable=yes"); } function addQuery(valueQuery){ var today = new Date(); var newBookmark = { value: valueQuery, time: today.getTime() }; var obj, name; if ( (obj=framePath('P_name')) ) { name = obj.value; newBookmark['name'] = name; } var sets = top.P_info; for (var i = 0; i < sets.length; i++) if (sets[i].name == name) { window.alert('Запрос с таким именем уже существует'); return; } if ( (obj=framePath('P_comment')) ) newBookmark['comment'] = obj.value || obj.innerHTML; addToPersistentArray('queries',newBookmark, function(){ /* window.alert('Запрос сохранен'); var qFrame = framePath("/window_queries"); if (qFrame) qFrame.contentWindow.location.reload(); */ window.location.replace(pPath() + 'window_queries'); }); } function saveQueryFromAttrs(){ ifr = framePath("/temp_iframe"); form = framePath("filterform"); appendJS(form,{ 'tagName':"INPUT", 'type':"hidden", 'name':"tosave", 'id':"tosave", 'value':"yes" }); postFormTo(form,ifr.contentWindow); form.removeChild(framePath('tosave')); return false; } function addBookmark(id) //,name,comment) { var win = window.opener.getContents(); var today = new Date(); var selStart = 0, selEnd = 0; if ( win.getSelEnd ) { selStart = win.getSelStart(); selEnd = win.getSelEnd(); } else { alert("В данном документе создание закладки невозможно"); return; } var newBookmark = { id : id, pos : { endPos : selEnd, startPos : selStart }, time: today.getTime() }; var aFld = ['name', 'comment']; var obj; if ( (obj=framePath('P_name')) ) newBookmark['name'] = obj.value; if ( (obj=framePath('P_comment')) ) newBookmark['comment'] = obj.value || obj.innerHTML; win.setDocSelection(newBookmark.pos.startPos,newBookmark.pos.endPos); addToPersistentArray('bookmarks',newBookmark,function(){ window.location.replace(pPath() + 'window_bookmarks'); }); } function addSet(name,action, oid){ if ('' == name) { window.alert('Пожалуйста, задайте имя подборки'); return; } var sets = top.P_info; for (var i = 0; i < sets.length; ++i) { if (sets[i].name == name) { window.alert('Подборка с таким именем уже существует, пожалуйста выберите другое имя'); return; } } var today = new Date(); newSet = { name : name, docs : [], count : 0, time : today.getTime() }; var obj; if ( (obj=framePath('P_comment')) ) newSet['comment'] = obj.value || obj.innerHTML; addToPersistentArray('sets', newSet,function(){ if (''==action) window.close(); else window.location.href = pPath() + "window_sets&action=" + action + "&oid=" + oid; }); } function findSet(namePart){ var setslist = framePath('sets/items/*LI'); if (0 == setslist.length) return; var currentSet = 0; while (setslist[currentSet].className != 'current') currentSet++; for (var i = 0; i < setslist.length; i++){ currentSet = (currentSet+1) % (setslist.length); if (setslist[currentSet].childNodes[0].nodeValue.indexOf(namePart) >= 0){ framePath('sets/').selectedItem.className = ''; setslist[currentSet].className = 'current'; framePath('sets/').selectedItem = setslist[currentSet]; setInfo(setslist[currentSet]); return; } } window.alert('Такой подборки нет'); } function setInfo(item){ if (null == item) return; var sets = top.P_info; var setNum = item.ind; if (null == setNum) setNum = 0; var allInfo = ['name', 'time', 'count', 'comment']; for(var i = 0; i < allInfo.length; i++) { var curSet = sets[setNum]; var val = curSet[allInfo[i]]; if (null != val) { if ('time' == allInfo[i]) { var date = new Date(parseInt(val)); val = date.toLocaleString(); } framePath('/set_' + allInfo[i]).childNodes[0].nodeValue = val; } } } function removeSet(){ var seltd = framePath('sets/').selectedItem; if (null == seltd) return; removeFromPersistentArray('sets', seltd.num, function () { top.location.reload(); } ); } function clearSet(){ var seltd = framePath('sets/').selectedItem; if (null == seltd) return; if (!authorized()) { var sets = top.P_info; sets[seltd.num].docs = []; sets[seltd.num].count = 0; saveCookieVar('sets',sets); framePath('sets/.').location.reload(); } else { window.callback = function(){ framePath('sets/.').location.reload(); } framePath('temp_iframe/.').location.href = pPath() + "persistent=&clearset=" + seltd.num; } } function showQueries(){ window.open(pPath() + 'window_queries','window_queries', "width=" + 534 + ",height=" + 513 + ",toolbar=no,resizable=yes"); } function showBPAs(){ closeOtherPopups('window_dbs'); if (top.loaded != null) { viewBlock('window_dbs'); return; } top.loaded = true; top.callBack = function (){ viewBlock('window_dbs'); top.callBack = null; } var _frame = framePath('window_dbs/.'); if (null == _frame) return; var loc = _frame.location; loc.replace(loc.href); } function removeQuery(){ if(window.confirm("Удалить этот запрос?")){ removeFromPersistentArray('queries',framePath('queries/').selectedItem.num,function(){ framePath('queries/.').location.reload(true); }); } } function itemsClick(event, callBack){ var target = getEventTarget(event); if ("LI" != target.tagName) return; document.selectedItem.className = ''; target.className = 'current'; document.selectedItem = target; if (null != callBack) callBack(target); } function clearBookmarks(){ // saveCookieVar('bookmarks',[]); clearPersistentArray('bookmarks',function(){window.alert('OK')}); } function prepareAjaxResultForCheckDeletedDoc(result, togo, posSt, posEnd){ if(result == 'true'){ if(confirm("Данный документ удалён из информационного фонда.\nУдалить его из закладок?")) removeCurrent(); return; } window.open(pPath() + "searchres=&set=" + togo + "&posSt=" + posSt + "&posEnd=" + posEnd + "&sort=1"); window.close(); } function goToBookmark(event){ parseCookies(); var seltd = framePath('bookmarks/').selectedItem; if (seltd == null) return; var params = seltd.togo + ", " + seltd.togoPos.startPos + ", " + seltd.togoPos.endPos; PassAjaxResponseToFunction(pPath() + 'checkdeleteddoc' + '&oid=' + seltd.togo, 'prepareAjaxResultForCheckDeletedDoc', params); } function removeCurrent(){ // var bookmarks = parseCookieVar('bookmarks'); var seltd = framePath('bookmarks/').selectedItem; if (seltd == null) return; // bookmarks.splice(seltd.num,1); // saveCookieVar('bookmarks',bookmarks); removeFromPersistentArray('bookmarks',seltd.num,function(){framePath('/bookmarks/.').location.reload()}); } function ownerDoc(elem){ if (elem.ownerDocument) return elem.ownerDocument; return elem.document; } function selectAllBPAs(){ var cboxes = framePath('/bpa_root/*INPUT'); for (var i = 0; i < cboxes.length; i++) cboxes[i].checked="checked"; } function selectNoBPAs(){ var cboxes = framePath('/bpa_root/*INPUT'); for (var i = 0; i < cboxes.length; i++) cboxes[i].checked=""; } function getCheckedOIDs(topWindow) { if (null == topWindow) var wndTop = top else var wndTop = topWindow; if (null == wndTop.boxes) wndTop.boxes = new Array(); return wndTop.boxes; } function addDocToSet(oid) { var MAX_DOCS_COUNT = 100; var selItem = framePath('sets/').selectedItem; if (null == selItem) return; var setNum = selItem.num; var workOID = parseInt(oid); if (authorized()) { window.callback = function (msg) { if ("" != msg) alert(msg); else window.close(); } framePath('temp_iframe/.').location.href = pPath() + "persistent=&addtoset=" + setNum + "&oid=" + workOID; } else { var sets = parseCookieVar('sets'); if (0 == sets[setNum].count) sets[setNum].docs = new Array(); var index = sets[setNum].docs.indexOf(workOID); if (index < 0) index = sets[setNum].docs.indexOf(workOID + ""); if (index > -1) { alert("Текущий документ уже содержится в данной подборке,\n" + "пожалуйста, выберите другую или создайте новую подборку"); return false; } var limitMsg = "Максимально возможное количество документов в одной подборке: " + MAX_DOCS_COUNT; if (sets[setNum].docs.length == MAX_DOCS_COUNT) { alert(limitMsg + ",\nдля данной подборки этот лимит исчерпан"); return false; } sets[setNum].docs.push(workOID); sets[setNum].count = sets[setNum].docs.length; saveCookieVar('sets', sets); window.close(); } } function removeDocFromSet(setId, excepted){ var mode = null; if(excepted == 'all'){ mode = "all"; }else if (excepted != null){ mode = "excepted"; }else{ var cls = top.CurrentListSelection; var excepted = cls.getExceptedArray(); var included = cls.getIncludedArray(); if (0 != excepted.length) // удалить все кроме выбранных mode = "excepted"; else if (0 != included.length) // удалить выбранные mode = "selected"; else if (cls.isAllSelected()) // удалить все mode = "all"; else { alert("Пожалуйста, отметьте документы на удаление"); return; } if ( !confirm("Вы действительно хотите удалить выбранные\nдокументы из текущей подборки?") ) return; } if (authorized()) { // авторизованный пользователь window.callback = function (empty) { if ("True" == empty) top.close(); else top.location.reload(); }; if ("all" == mode) { var urlQuery = "clearset=" + setId; } else if ("selected" == mode) { var urlQuery = "dropfromset=" + setId + "&oids=" + included.join(";"); } else if ("excepted" == mode) { var urlQuery = "keepinset=" + setId + "&oids=" + excepted.join(";"); } framePath('temp_iframe/.').location.href = pPath() + "persistent=&" + urlQuery; } else { // неавторизованный пользователь var sets = parseCookieVar('sets'); var workSet = null; for (var i = 0; i < sets.length; i++) { if (sets[i].time == setId) { workSet = sets[i]; break; } } if (null == workSet) { alert('Текущая подборка уже удалена'); return; } if ("all" == mode) { // удалим все документы из подборки workSet.docs = new Array(); } else if ("selected" == mode) { // удалим отмеченные документы из подборки var docs = workSet.docs; for (var i = 0; i < included.length; i++) { var oid = included[i]; var index = docs.indexOf(oid); if (index < 0) index = docs.indexOf(oid + ""); if (index < 0) continue; docs[index] = docs[docs.length - 1]; delete docs[docs.length - 1]; docs.length--; } } else if ("excepted" == mode) { // удалим все документы из подборки, кроме отмеченных // ==== // здесь возникает проблема: // при попытке написать // workSet.docs = excepted; // и последующим workSet.toJSONString().parseJSON() // workSet.docs вместо массива превратится в объект с набором свойств (IE6) // ибо excepted instanceof Array = false; // ==== // сделаем финт ушами: var hint = new Array(); for (var i = 0; i < excepted.length; i++) { hint.push(excepted[i]); } workSet.docs = hint; } workSet.count = workSet.docs.length; saveCookieVar('sets', sets); if (0 == workSet.docs.length) { top.close(); return; } top.location.assign(pPath() + "searchres=&set=" + workSet.docs.join("/") + "&setid=" + setId + "&sort=1" + "&setname=" + workSet.name); return workSet.docs.join("/"); } } function prepareAjaxResultForCheckDeletedDocs(result, docset, setid, setName){ if(result == "0"){ if (authorized()) url = pPath() + "searchres=&set=" + setid + "&sort=1" + setName else url = pPath() + "searchres=&set=" + docset + "&setid=" + setid + "&sort=1" + setName; }else{ if(confirm("В подборке присутствуют документы, удалённые из информационного фонда.\nУдалить их из подборки?")){ var excepted = result.split("/"); var docset = removeDocFromSet(setid, excepted); } if (authorized()) url = pPath() + "searchres=&set=" + setid + "&sort=1" + setName else url = pPath() + "searchres=&set=" + docset + "&setid=" + setid + "&sort=1" + setName; } window.open(url); window.close(); } function showSet(){ var selItem = framePath('sets/').selectedItem; if (selItem == null) return; var setNum = selItem.num; var setName = "&setname=" + selItem.innerHTML; var url; if (authorized()) { if (0 == top.P_info[selItem.ind].count) return; //url = pPath() + "searchres=&set=" + setNum + "&sort=1" + setName; var params = "'', '" + setNum + "', '" + setName+ "'"; PassAjaxResponseToFunction(pPath() + 'checkdeleteddocs' + '&set=' + setNum, 'prepareAjaxResultForCheckDeletedDocs', params); } else { var sets = top.P_info; var docs = sets[setNum].docs; if (0 == docs.length) return; var params = "'" + docs.join("/") + "', '" + sets[setNum].time + "', '" + setName+ "'"; PassAjaxResponseToFunction(pPath() + 'checkdeleteddocs' + '&oids=' + docs.join("/"), 'prepareAjaxResultForCheckDeletedDocs', params); } } function pPath(){ var loc = window.location.href; var i = loc.indexOf('?'); return loc.substring(0,i+1); } function openClassifKey(attr,event){ parseCookies(); event = event || window.event; if (event.ctrlKey || event.altKey || event.metaKey) return true; var code = event.charCode || event.keyCode; if (code == 0) return true; var chr = String.fromCharCode(code); if ('абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ ,;.'.indexOf(chr) < 0) return false; showPopupClassif(attr, 'bpa=' + pCookies['bpas'] + '&a' + attr + 'type=' + framePath('a' + attr +'type').value + '&incrsearch=' + escape(chr), '?'); return false; } function getTop(o) { var fixBrowserQuirks = true; var top = 0; var parentNode = null; var offsetParent = null; offsetParent = o.offsetParent; var originalObject = o; var el = o; while (el.parentNode!=null) { el = el.parentNode; if (el.offsetParent != null) { var considerScroll = true; if (fixBrowserQuirks && window.opera) { if (el==originalObject.parentNode || el.nodeName=="TR") considerScroll = false; } if (considerScroll) { if (el.scrollTop && el.scrollTop>0) top -= el.scrollTop; } } if (el == offsetParent) { top += o.offsetTop; if (el.clientTop && el.nodeName!="TABLE") top += el.clientTop; o = el; if (o.offsetParent==null) { if (o.offsetTop) top += o.offsetTop; } offsetParent = o.offsetParent; } }     return top; } function moveToVisible(elem,subelem){ subelem = subelem || elem; var doc = elem.ownerDocument || elem.document; var win = doc.defaultView || doc.parentWindow; var scrolled = win.document.body.scrollTop; var hgt = win.innerHeight || win.document.body.clientHeight; var elTop = getTop(subelem); if (elTop + subelem.scrollHeight > scrolled + hgt || elTop < scrolled) win.scrollTo(0,getTop(elem)); } var timer = null; function divOutML() { timer = window.setTimeout('hideBlock("months_list")', 50); } function divOutYE() { timer = window.setTimeout('hideBlock("year_edit")', 50); } function divOver() { window.clearTimeout(timer); } function execAndContinue(){ if (top.jscode == null) return; eval(top.jscode); setTimeout('execAndContinue()',200); } function mouseRepeat(code){ top.jscode = code; execAndContinue(); } function cancelMouseRepeat(){ top.jscode = null; } function setBpaAndGo(bpa) { if (bpa.length == 0){ window.alert('Выберите хотя бы один БПА'); return; } saveCookieVar('bpas',bpa); location.reload(); var elem = document.getElementById("a7type"); if(elem != null) elem.disabled = false; } function scrollToPosition(topId,pos){ var node = framePath(topId); for (var i = 0; i < pos.length - 1; i++) node = node.childNodes[pos[i]]; var rang = document.createRange(); rang.setStart(node,pos[pos.length-1]); var sp = document.createElement("SP"); rang.insertNode(sp); sp.scrollIntoView(); sp.parentNode.removeChild(sp); } function nodeIndex(node,parent){ for (var i = 0; i < parent.childNodes.length; i++) if (parent.childNodes[i] == node) return i; return -1; } function gotoTopPos(){ return; if (top.pos == null) return; scrollToPosition('doc_content',top.pos); top.pos = null; } function checkMultipleBPAs(cb){ var div = parentNodeTag(cb,'DIV'); if (div == null) return; if (div.className == "div_minus") div = div.nextSibling; var subHeaders = div.getElementsByTagName("INPUT"); for (var i = 0; i < subHeaders.length; i++){ var cbox = subHeaders[i]; if (cbox.type == 'checkbox'){ cbox.checked = cb.checked; } } var up = div.previousSibling; } function restoreBPAs() { var bpas = parseCookieVar('bpas'); if ('Array' == bpas.constructor) { bpas = cooks.join('/'); } var cbs = framePath('bpa_root/*INPUT'); for (var i = 0; i < cbs.length; i++){ var cb = cbs[i]; if (cb.type != 'checkbox' || cb.className.indexOf('emptyCb') < 0) continue; cb.checked = bpas.indexOf(cb.id.substring(3)) >= 0; } recordMultipleBPAs(); } function recordMultipleBPAs(){ var next = 0; var list = []; var items = framePath('bpa_root/*INPUT'); if ( items.length == 0 ) return; do { var nextItem = makeHierachy(items,next); next = nextItem.next; list.push(nextItem.result); } while (nextItem.result.item.className.indexOf('lastCb') < 0); for (var i = 0; i < list.length; i++) checkIfNeeded(list[i]); } function checkIfNeeded(item){ if (item.subItems.length == 0) return; for (var i = 0; i < item.subItems.length; i++) checkIfNeeded(item.subItems[i]); item.item.checked = true; for (var i = 0; i < item.subItems.length; i++) if (!item.subItems[i].item.checked) item.item.checked = false; var up = parentNodeTag(item.item,'DIV').previousSibling; if ( up.getElementsByTagName ) up.getElementsByTagName('INPUT')[0].checked = item.item.checked; } function processCheckBpa(oSpan){ var up = parentNodeTag(oSpan,'TR'); var oCheck = up.getElementsByTagName('INPUT')[0]; oCheck.checked = !oCheck.checked; if ( !oCheck.id ) checkMultipleBPAs(oCheck); recordMultipleBPAs(); return false; } function makeHierachy(inputs,start){ var headInput = inputs[start]; var next = start + 1; if (headInput.className.indexOf('emptyCb') >= 0) return {next : next, result : {item : headInput, subItems : []}}; var list = []; do { var nextItem = makeHierachy(inputs,next); next = nextItem.next; list.push(nextItem.result); } while (nextItem.result.item.className.indexOf('lastCb') < 0); return {next : next, result : {item : headInput, subItems : list}}; } function setCheckedBPAs(){ var itemFunction = function (item) { return item.checked && item.id != null && item.id != ""; }; var idFunction = function (item) { return item.id.substring(3) }; var bpaArray = toArray(framePath('/bpa_root/*INPUT')); var bpaFilteredArray = bpaArray.filter(itemFunction); var bpaList = bpaFilteredArray.map(idFunction).join('/'); setBpaAndGo(bpaList); } var textNodeType = 3; function setBoundary(callBackObject,callBackFunc,node,offset){ if (node.nodeType == textNodeType){ var diff = offset - node.nodeValue.length; if (diff > 0) return diff; callBackObject[callBackFunc](node,offset); return 0; } else { var cNodes = node.childNodes; for (var i = 0; i < cNodes.length; i++){ offset = setBoundary(callBackObject,callBackFunc,cNodes[i],offset); if (offset == 0) return 0; } return offset; } } function setDocSelection(start,end, subQuery){ if (start == end) return; if (navigator.appName.indexOf('Internet Explorer') >= 0) return window.setDocSelectionIE(start,end); var rng = document.createRange(); var i = setBoundary(rng,"setStart",document.body,start); if (i != 0) return; i = setBoundary(rng,"setEnd",document.body,end); if (i != 0) return; if(!subQuery) { var span = document.createElement("SPAN"); rng.insertNode(span); span.scrollIntoView(); span.parentNode.removeChild(span); setBoundary(rng,"setStart",document.body,start); setBoundary(rng,"setEnd",document.body,end); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(rng); } else { var selectFont = document.createElement('font'); selectFont.className = "subquery"; selectFont.id = "subquery"; rng.surroundContents(selectFont); selectFont.scrollIntoView(false); setBoundary(rng,"setStart",document.body,start); setBoundary(rng,"setEnd",document.body,end); top.searchEnd = end; } } function setDocSelectionIE(start,end){ var rng = document.body.createTextRange(); rng.collapse(true); rng.moveEnd("character",end); rng.moveStart("character",start); rng.select(); } function getStartBoundary(rng){ var span = document.createElement("SPAN"); span.style.display = "none"; rng.insertNode(span); span.appendChild(document.createTextNode("o_O")); var pos = document.body.textContent.indexOf("o_O"); span.parentNode.removeChild(span); return pos; } function getSelStart(){ // note - destroys selection! if (navigator.appName.indexOf('Internet Explorer') >= 0) { return (top.selStart || 0); } var sel = window.getSelection(); if (sel.rangeCount == 0) return 0; var rng = sel.getRangeAt(0); var pos = getStartBoundary(rng); return pos; } function getSelStartIE(){ var rng = document.selection.createRange(); return Math.abs(rng.moveStart("character",-1000000000)); } function getSelEnd(){ // doesn't destroy selection if (navigator.appName.indexOf('Internet Explorer') >= 0) return (top.selEnd || 0); var sel = window.getSelection(); if (sel.rangeCount == 0) return 0; var rng = sel.getRangeAt(0); var rng2 = rng.cloneRange(); rng2.setStart(rng.endContainer,rng.endOffset); var pos = getStartBoundary(rng2); sel.removeAllRanges(); sel.addRange(rng); return pos; } function getSelEndIE(){ var rng = document.selection.createRange(); rng.moveStart("character",-1000000000) return Math.abs(rng.moveEnd("character",-1000000000)); } function getThisParamIE(rng){ return Math.abs(rng.moveStart("character",-1000000000)); } function goToSelection() { if (top.pname == undefined) return; var selStInd = top.pname.indexOf("posSt"); var selEndInd = top.pname.indexOf("posEnd"); if (selStInd < 0 || selEndInd < 0) return; setDocSelection(parseInt(top.pvalue[selStInd]),parseInt(top.pvalue[selEndInd])); } function setselchange(){ document.onselectionchange = IERecordSel; } function IERecordSel(){ if (navigator.appName.indexOf('Internet Explorer') < 0) return; if (document.selection.type == 'None'){ top.selEnd = 0; top.selStart = 0; return; } top.selEnd = getSelEndIE(); top.selStart = getSelStartIE(); } function findParentText(win, subQuery) { if (subQuery == null) subQuery = false; var textToFind = win.framePath('find_str').value; if(subQuery) var findStart = parseInt(win.framePath('find_from').value); else var findStart = win.framePath('find_from').selectedIndex; var findDir = win.framePath('find_to').selectedIndex; var findExact = win.framePath('find_exact').checked; var findCaps = win.framePath('find_consider_caps').checked; if (navigator.appName.indexOf('Internet Explorer') < 0) var func = "findText"; else var func = "findTextIE"; var fFind = framePath('list/.')[func]; if (null != fFind) { return fFind(textToFind, findStart, findDir, findExact, findCaps, subQuery); } else { alert("К сожалению в данном документе поиск невозможен"); win.close(); } } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function insertClass(rng) { var removeMark = rng.getBookmark(); if(top.searchEnd) { subqueryRemove(); } rng.moveToBookmark(removeMark); window.parent.isSmthFound = true; rng.pasteHTML('' + rng.text + ''); rng.scrollIntoView(false); } function getSearchParams(rng) { var cloneMark = rng.getBookmark(); rng.move("word", -1); top.searchStart = getThisParamIE(rng); rng.moveToBookmark(cloneMark); top.searchEnd = getThisParamIE(rng); } function subqueryRemove() { subFont = document.body.getElementsByTagName('font'); subFontCount = subFont.length; for(var i = 0; i < subFontCount; i++) { if(subFont[i].className == 'subquery') { subFont[i].outerHTML = subFont[i].innerHTML; subFontCount--; } } } function confirmRange(dir, browser) { var message = (dir == 1)?("Это первое вхождение. Перейти на последнее?"):("Это последнее вхождение. Перейти на первое?"); if ( !confirm(message) ) { return null; } else { if(top.searchEnd){ if(browser == 'IE') { subqueryRemove(); } else { subFont = document.getElementById("subquery"); if(subFont) setOuterHTML("subquery", subFont.innerHTML); } } return true; } } function findTextIE(textToFind, findStart, findDir, findExact, findCaps, subQuery){ var range = document.body.createTextRange(); range.collapse(true); var textEnd = range.moveEnd("character", 1000000000); var prefix = ""; var startPoint = null; switch (findStart) { case 0: if (0 == findDir) startPoint = top.searchEnd; else startPoint = top.searchStart; break; case 1: startPoint = 0; break; case 2: startPoint = textEnd; break; } range.moveStart("character", startPoint); range.collapse(true); var flags = 0; if (1 == findDir) flags += 1; if (findExact) flags += 2; if (findCaps) flags += 4; // ничего не делаем, если текст пустой if (trim(textToFind).length == 0) return null; var found = range.findText(textToFind,findDir == 0 ? 1000000000 : -1000000000, flags); if(subQuery) { var checkRange = document.body.createTextRange(); var oRegExp = new RegExp(textToFind, "ig"); if (found) { insertClass(range); getSearchParams(range); } else if (checkRange.text.search(oRegExp) > -1) { var isConfirm = confirmRange(findDir, 'IE'); return isConfirm; } else { if(top.searchEnd) subqueryRemove(); return notFoundMessage(); } } else { if (found) { window.parent.isSmthFound = true; try { range.select(); } catch (e) { return "internal error"; } top.selEnd = getSelEndIE(); top.searchEnd = top.selEnd; top.selStart = getSelStartIE(); top.searchStart = top.selStart; } else return notFoundMessage(); } return null; } function setOuterHTML(ElementID, txt) { var someElement = document.getElementById(ElementID); var rng = document.createRange(); rng.setStartBefore(someElement); var docFrag = rng.createContextualFragment(txt); someElement.parentNode.replaceChild(docFrag, someElement); } function findText(textToFind,findStart,findDir,findExact,findCaps, subQuery){ var textStart = new Object(); var textEnd = new Object(); var currPos; var range = document.createRange(); range.selectNodeContents(document.body); textStart.container = range.startContainer; textStart.offset = range.startOffset; textEnd.container = range.endContainer; textEnd.offset = range.endOffset; var sel = window.getSelection(); var prefix = ""; var wordBoundary = ""; if (findExact) wordBoundary = "\\b"; if(subQuery){ var subQue = document.getElementById('subquery'); if(subQue){ currPos = new Object(); currPos.container = subQue; currPos.offset = top.searchEnd; } } else { if (sel.rangeCount == 0) currPos = textStart; else { currPos = new Object(); var rng = sel.getRangeAt(0); currPos.container = rng.startContainer; currPos.offset = rng.startOffset; var r = new RegExp("^" + textToFind + "$", findCaps ? "" : "i"); var test = r.test(rng.cloneContents().textContent); if (test && 0 == findStart && 0 == findDir) prefix = "."; } } var startPoint; switch (findStart) { case 0: startPoint = currPos; break; case 1: startPoint = textStart; break; case 2: startPoint = textEnd; break; } if (0 == findDir) var setSE = "setStart"; else var setSE = "setEnd"; if(!subQuery) range[setSE](startPoint.container, startPoint.offset); else { if(0 == findStart) { if(subQue) { if(0 == findDir) range.setStartAfter(document.getElementById("subquery")); else range.setEndBefore(document.getElementById("subquery")); } else { if(startPoint) range[setSE](startPoint.container, startPoint.offset); } } else { if(startPoint) range[setSE](startPoint.container, startPoint.offset); } } var searchReg = prefix + wordBoundary + textToFind + wordBoundary; if (findCaps) var caps = ""; else var caps = "i"; var re = new RegExp(searchReg, caps); if (0 == findDir) var offset = range.cloneContents().textContent.search(re); else var offset = findLastOccurence(range.cloneContents().textContent, re); if(!subQuery) { if (offset < 0) return notFoundMessage(); window.parent.isSmthFound = true; offset += getStartBoundary(range) + prefix.length; setDocSelection(offset, offset + textToFind.length, false); return null; } else { var checkRange = document.createRange(); checkRange.selectNodeContents(document.body); var oRegExp = new RegExp(textToFind, "ig"); if (offset > -1) { window.parent.isSmthFound = true; offset += getStartBoundary(range) + prefix.length; if(top.searchEnd) { subFont = document.getElementById("subquery"); if(subFont) setOuterHTML("subquery", subFont.innerHTML); } setDocSelection(offset, offset + textToFind.length, subQuery); } else if (checkRange.toString().search(oRegExp) > -1) { var isConfirm = confirmRange(findDir, 'FF'); return isConfirm; } else { if(top.searchEnd) { subFont = document.getElementById("subquery"); setOuterHTML("subquery", subFont.innerHTML); } return notFoundMessage(); } return null; } } function notFoundMessage(){ return (window.parent.isSmthFound ? "Достигнут конец поиска" : "Ничего не найдено"); } function findLastOccurence(str,reg){ var offset = str.search(reg); if (offset == -1) return -1; var temp = findLastOccurence(str.substring(offset+1),reg); if (temp == -1) return offset; return temp+offset+1; } function closeOtherPopups(winname){ return; if (null != top.closeOthers) top.closeOthers(); if (null == window.parent) return null; if (null == window.parent.getContents) return; var doc = window.parent.getContents(); if (null == doc) return; if ( !doc.framePath ) return; top.closeOthers = function () { if (null == winname) return; if (null != doc && null != doc.framePath) { if (null == doc.framePath(winname)) return; } if ("IFRAME" == doc.framePath(winname).tagName){ if (null != doc.hideBlock) doc.hideBlock(winname); } else { if (null != doc.killBlock) doc.killBlock(winname); } } } function setExpandedPanel(flag){ var today = new Date(); today.setDate(today.getDate() + 7); document.cookie="expandedPanel" + "=" + (flag ? "" : "no; expires=" + today.toGMTString()); } function postFormTo(form,win){ var formCopy = win.document.createElement('FORM'); formCopy.method = form.method; formCopy.action = form.action; formCopy.style.display = 'none'; formCopy.acceptCharset = "windows-1251"; var inputs = framePath('*INPUT',form); for (var i=0; i parameters.length) return; var catalogues = parameters[4].split('/'); var vols = new Array(); for (var i = 0; i < catalogues.length; ++i) { var o = new Object(); var catalog = catalogues[i].split(','); if ('' == catalog) break; o.Name = catalog[0]; o.OID = catalog[1]; o.Date = catalog[2]; vols[vols.length] = o; } window.editions[parameters[2]].Years[parameters[3]].Vols = vols; //2 - вызвать функцию формирования списка viewEditionsCatalogue(parameters[0], parameters[1]); } function viewEditionsCatalogue(anotherSelect, thisSelect) { var another = framePath('' + anotherSelect); var selct = framePath('' + thisSelect); var index = selct.options.selectedIndex; var coords = selct.options[index].value.split('/'); var editionObject = window.editions[coords[0]]; var vols = editionObject.Years[coords[1]].Vols; while(another.childNodes.length > 0) another.removeChild(another.childNodes[0]); var newVol = document.createElement('OPTION'); newVol.appendChild(document.createTextNode('КАТАЛОГ')); newVol.value = ""; another.appendChild(newVol); for (var i = 0; i < vols.length; i++){ newVol = document.createElement('OPTION'); newVol.appendChild(document.createTextNode('Сборник ' + vols[i].Name + ' от ' + vols[i].Date)); newVol.value = coords.join('/') + '/' + i.toString(); another.appendChild(newVol); } another.style.display = 'inline'; } function editionsGoTo(anotherSelect, thisSelect, additionalParams){ var another = framePath(thisSelect); var anotherIndex = another.options.selectedIndex; if (anotherIndex == 0){ window.location.href = top.pPath + "divisions&edition=" + window.editions[another.options[0].value].OID + additionalParams; return; } var selct = framePath(anotherSelect); var index = selct.options.selectedIndex; if (index == 0){ var coords = another.options[anotherIndex].value.split('/'); window.location.href = top.pPath + "divisions&edition=" + window.editions[coords[0]].OID + "&year=" + another.options[anotherIndex].text + additionalParams; return; } var coords = selct.options[index].value.split('/'); window.location.href = top.pPath + "divisions&edition=" + window.editions[coords[0]].OID + "&volume=" + window.editions[coords[0]].Years[coords[1]].Vols[coords[2]].OID + additionalParams; return false; } function printSelected(prefix){ // var win = framePath('list').contentWindow; /* var postfix = ''; var sel = win.document.selection; alert(null == win.document.selection); alert(false == win.document.selection); alert(!win.document.selection); var frag = (null != && false != sel && "None" != sel.type); alert(frag); if (frag)*/ /*var postfix = 'selStart=' + win.getSelStart() + '&selEnd=' + win.getSelEnd(); window.open(prefix + postfix);*/ window.open(prefix); } function clearExcept(n,m){ if (navigator.appName.indexOf('Internet Explorer') >= 0) return clearExceptIE(n,m); if (n == 0) n = 1; setDocSelection(n,m); var cont = window.getSelection().getRangeAt(0).extractContents(); var body = document.body; while(body.childNodes.length > 0) body.removeChild(body.childNodes[0]); body.appendChild(cont); } function clearExceptIE(n,m){ setDocSelection(n,m); document.body.innerHTML = document.selection.createRange().htmlText; } function cookiePrefs(){ var prefix = "kpref="; var sideValues = ["bpas","theme-contents","font-size-contents","theme-document","font-size-document","authorized","auth_ok","workspaceState"]; var sessionValues = ["authorized", "auth_ok"]; this.save = function(object){ var copy = {}; for (var i = 0; i < sideValues.length; i++) { sideValue = sideValues[i]; copy[sideValue] = this[sideValue]; this[sideValue] = undefined; } if (!object) object = this; var date = new Date(); date.setDate(date.getDate() + 7); //jack_smith в 6ке нет кукей var cookie = new Array(new String()); cookie[0] = prefix + escape(object.toJSONString()) + "; expires=" + date.toGMTString(); for (var i = 0; i < sideValues.length; i++) { sideValue = sideValues[i]; if (copy[sideValue] != null) { cookie[cookie.length] = sideValue + "=" + copy[sideValue] + (sessionValues.indexOf(sideValue) < 0 ? "; expires=" + date.toGMTString() : ""); } else { cookie[cookie.length] = sideValue + "=; expires=" + (sessionValues.indexOf(sideValue) < 0 ? "; expires=" + date.toGMTString() : ""); } } for (var i = 0; i < sideValues.length; i++) { sideValue = sideValues[i]; this[sideValue] = copy[sideValue]; } //теперь сохраним cookie if (null != window.biscuit) { window.biscuitArray = cookie; window.biscuit = cookie.join('; '); framePath('temp_iframe/.').location.href = pPath() + "persistent=&savecookie=" + escape(window.biscuit); } else { var len = 0; for (var i=0; i < cookie.length; ++i){ //alert(cookie); len += cookie[i].length; } if(len > 1000000){ alert("Слишком много сохраненных запросов. Новый запрос не создан."); return; } for (var i=0; i= 0){ var endIndex = (cookie + ";").indexOf(";", index); if (endIndex < 0) endIndex = cookie.length; this[sideValue] = cookie.substring(index + sideValue.length + 1, endIndex); } } var index = cookie.indexOf(prefix); if (index < 0) { this.save(new Object()); } else { var endIndex = cookie.indexOf(";", index + 6); if (endIndex < 0) endIndex = cookie.length; var data = (unescape(cookie.substring(index + 6, endIndex))).parseJSON(); for (var i in data) if (this[i] == null) this[i] = data[i]; } this.clear = function(elems){ for (var i = 0; i < elems.length; i++) this[elems[i]] = undefined; this.save(); } this.push = function(key, value) { var index=-1; if (null!=this[key]) { while (null!=this[key][++index]); } this[key][index]=value; } this.splice = function (key, from, count) { if (null!=this[key]) { var current=from-1; while (null!=this[key][++current]) { var shiftedElement = this[key][current+count]; if (null!=shiftedElement) { this[key][current] = shiftedElement; } else { delete this[key][current]; } } } } } function relogin() { var c = getCookies(); if (c.indexOf('auth_ok=1') != -1) { alert("Вы уже авторизовались на данном рабочем месте."); } else { saveCookieVar('authorized','1'); saveCookieVar('auth_ok',null); } window.location.reload(); } function exportJSON(form,obj,frameName){ frameName = frameName || "/topmenu/temp_iframe" if (framePath("save_settings") == null){ appendJS(document.body,{'tagName':"form", 'id':"save_settings", 'style':{'visibility':"hidden",'position':"absolute",'top':"-500px",'left':"-500px"}, 'method':"POST", 'action':top.pPath() + form, 'target':"save_settings_iframe", 'acceptCharset':"windows-1251", 'childNodes':[{'tagName':"input",'type':"hidden",'name':form,'value':""}, {'tagName':"textarea",'name':"tosave",'value':obj.toJSONString()}]}); } ifr = framePath(frameName); if (ifr == null) ifr = framePath("temp_iframe"); postFormTo(framePath("save_settings"),ifr.contentWindow); } function authorized(){ return (new cookiePrefs()).auth_ok == 1; } function makeURLParts(arr,pref,obj){ for (var i in obj){ var val = obj[i]; switch (typeof(val)){ case 'object': if (val instanceof Array) break; makeURLParts(arr,pref + i + '_',val); break; case 'function': break; default: arr.push(pref + i + '=' + escape(val)); } } return arr; } function addToPersistentArray(arrName,element,callback){ if (!authorized()){ var prefs = new cookiePrefs(); if (null==prefs[arrName]) prefs[arrName] = []; //prefs[arrName].push(element); //jack_smith 19.10.07 просто другая схема ведения куков prefs.push(arrName, element); prefs.save(); return callback(); } window.callback = callback; framePath('temp_iframe/.').location.href = pPath() + "persistent=&save=" + arrName + "&" + makeURLParts([],'',element).join('&'); } function removeFromPersistentArray(arrName,eltId,callback){ if (!authorized()){ var prefs = new cookiePrefs(); //prefs[arrName].splice(eltId,1); //jack_smith новая схема работы prefs.splice(arrName, eltId, 1); prefs.save(); return callback(); } window.callback = callback; framePath('temp_iframe/.').location.href = pPath() + "persistent=&remove=" + arrName + "&nd=" + eltId; } function getPersistentArray(arrName, callback){ if ( !authorized() ) { var prefs = new cookiePrefs(); if (null == prefs[arrName]) prefs[arrName] = new Array(); var result = callback(prefs[arrName]); return result; } window.callback = callback; framePath('temp_iframe/.').location.href = pPath() + "persistent=&get=" + arrName; } function clearPersistentArray(arrName,callback){ if (!authorized()){ var prefs = new cookiePrefs(); prefs[arrName] = []; prefs.save(); return callback(); } window.callback = callback; framePath('temp_iframe/.').location.href = pPath() + "persistent=&clear=" + arrName; } function exportPersistentArray(arrName,form,frameName,callback){ getPersistentArray(arrName,function(arr){ var obj = {}; obj[arrName] = arr; exportJSON(form,obj,frameName); callback(); }); } function changeCheckbox(id){ var cb = framePath(id); cb.checked = !cb.checked; } function dateFieldSwitch(name){ var index = framePath(name + "type").options.selectedIndex; var showTwo = index >= 3; var divOne = framePath("filter_" + name + "_exact"); var divTwo = framePath("filter_" + name + "_period"); var divToShow = showTwo ? divTwo : divOne; var divToHide = showTwo ? divOne : divTwo; divToShow.style.display = 'inline'; divToHide.style.display = 'none'; var dateInput = framePath(name + "date"); var fromInput = framePath(name + "from"); var toInput = framePath(name + "to"); var sourceInput = index == 1 ? toInput : fromInput; if (sourceInput.value == '') sourceInput = index == 1 ? fromInput : toInput; if (sourceInput.value == '') sourceInput = dateInput; var targetInput = showTwo ? top.dateSwitchIndex == 1 ? toInput : fromInput : dateInput; targetInput.value = sourceInput.value; var inputs = framePath('*INPUT',divToHide); for (var i = 0; i < inputs.length; i++){ inputs[i].value = ''; } top.dateSwitchIndex = index; if (index > 3){ var readonly = "readOnly"; framePath(name + "from").readOnly = true; framePath(name + "to").readOnly = true; framePath("img_" + name + "_from").style.display = 'none'; framePath("img_" + name + "_to").style.display = 'none'; var today = new Date(); var month = today.getMonth(); var year = today.getYear(); var granularity = [12,6,3,1][index-4]; month = granularity * Math.floor(month / granularity); var monthCountDay = new Array( 31, (((year%4) == 0 ) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30 ,31 ); framePath(name + "from").value = "1." + (month + 1) + "." + today.getFullYear(); framePath(name + "to").value = monthCountDay[month + granularity - 1] + "." + (month + granularity) + "." + today.getFullYear(); } else { framePath(name + "from").readOnly = false; framePath(name + "to").readOnly = false; framePath("img_" + name + "_from").style.display = 'inline'; framePath("img_" + name + "_to").style.display = 'inline'; } } function dateField(name){ this.name = name; this.clearField = function(){ framePath(this.name + 'type').options.selectedIndex = 0; dateFieldSwitch(this.name); framePath(this.name + 'from').value = ""; framePath(this.name + 'to').value = ""; framePath(this.name + 'date').value = ""; }; this.prepareSubmit = function(){ if (framePath(this.name + 'type').value == 4){ var f = framePath(this.name + 'from'); f.value = partialDate(f.value).lastStep(); f = framePath(this.name + 'to'); f.value = partialDate(f.value).lastStep(); } else { var f = framePath(this.name + 'date'); f.value = partialDate(f.value).lastStep(); } } } function stringField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; } } function stringExField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; } } function stringNumField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; } } function stringYearField(name){ this.name = name; this.clearField = function(){ framePath(this.name).options.selectedIndex = framePath(this.name).length - 1; } } function numberField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; framePath(this.name + 'type').options.selectedIndex = 0; } } function classifierField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; framePath(this.name + 'type').value = ""; framePath(this.name + 'label').value = ""; } /* this.disable = function(){ framePath(this.name + 'label').disabled = true; }*/ } function classifierFieldEx(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; framePath(this.name + 'type').value = ""; framePath(this.name + 'label').value = ""; } } function certSNField(name){ this.name = name; this.clearField = function(){ framePath(this.name).value = ""; //framePath(this.name + 'type').options.selectedIndex = 1; } /* this.disable = function(){ framePath(this.name + 'label').disabled = true; }*/ } function textPresenseField(name){ this.name = name; this.clearField = function(){ framePath(this.name).options.selectedIndex = 0; } } function sortField(name){ this.name = name; this.clearField = function(){ framePath(this.name).options.selectedIndex = 1; } } function intellectField(name){ this.name = name; this.clearField = function(){ } } function appendField(form,initializer,name){ form[name] = new initializer(name); } function sortMultiple(){ /* viewBlock('/contents/list/window_sort'); sortFields = top.pvalue[top.pname.indexOf('sort')].split('/'); var table = framePath('/contents/list/window_sort/sorting'); var win = framePath('/contents/list/window_sort').contentWindow; while(table.childNodes.length > 0) table.removeChild(table.childNodes[0]); for (var i = 0; i < sortFields.length; i++){ win.appendRow(table,sortFields[i]); */ size = {'width':540,'height':400}; win = window.open("?window_sort", "window_sort", "width=" + size.width + ",height=" + size.height + ",toolbar=no,resizable=yes"); win.openWin = top; // win.init(); //Перенести в onLoad } function appendOption(select,selected,title,value){ var option = document.createElement('option'); select.appendChild(option); option.appendChild(document.createTextNode(title)); option.value = value; if (value == selected) option.selected = "selected"; } function appendRow(table,field){ var options = [ {'title':"По наименованию",'value':1}, {'title':"По убыванию даты",'value':7}, {'title':"По возрастанию даты",'value':-7}, {'title':"По номеру документа",'value':8}, {'title':"По виду документа",'value':3} ]; if ( !openWin ) openWin = top; if (openWin.pname.indexOf('intelsearch') >= 0) options.splice(0,0,{'title':"По весу",'value':-1}); appendJS(table,{ 'tagName':"tr", 'childNodes':[{ 'tagName':"td", 'childNodes':"сортировать:" },{ 'tagName':"td", 'style':{'padding':"0 5px"}, 'childNodes':{ 'tagName':"select", 'childNodes':options.map(function(option){ var result = { 'tagName':"option", 'value':option.value, 'childNodes':option.title } if (option.value == field) result.selected = 'selected'; return result; }) } },{ 'tagName':"td", 'childNodes':{ 'tagName':"img", 'src':openWin.pPath() + "pic_sort_delete.gif", 'className':"pic", 'alt':"Удалить условие", 'title':"Удалить условие", 'onclick':function(event){removeRow(parentNodeTag(getEventTarget(event),'TR'));} } }] }); } function removeRow(row){ parentNodeTag(row,'TABLE').deleteRow(row.rowIndex); } function postSortConditions(){ // var selects = framePath('/contents/list/window_sort/sorting/*SELECT'); if ( !openWin ) openWin = top; var selects = framePath('/sorting/*SELECT'); var values = []; for (var i = 0; i < selects.length; i++) values[i] = selects[i].value; openWin.framePath('/topmenu').contentWindow.changeSortOrder(openWin.pvalue[openWin.pname.indexOf('sort')],values.join('/')); window.close(); } function compareRed(nd){ //var checked = toArray(framePath('c_editions/*INPUT')).filter(function(inp){return inp.checked;}).map(function(inp){return inp.value;}); var red1 = document.getElementById('red1').value; var red2 = document.getElementById('red2').value; if (red1 == red2) { alert("Для сравнения нужны две различные редакции"); return; } window.open(top.pPath() + "compare_vert&nd=" + nd + "&rdkleft=" + red1 + "&rdkright=" + red2); } function fixDocDimensions(className){ var coeff = 1; switch(className){ case 't_small': coeff = 0.67; break; case 't_normal': coeff = 0.84; break; case 't_standart': coeff = 1; break; case 't_large': coeff = 1.17; break; case 't_huge': coeff = 1.34; break; case 't_monster': coeff = 1.67; break; } //fixDimensions(coeff); document.body.style.zoom = coeff; } function getHTMLSelectionForHyperlink(){ var textrange = document.selection.createRange(); if (is_space(textrange.text.substring(0, 1))){ for (;;){ if (textrange.moveStart('character', 1) == 0) break; if (!is_space(textrange.text.substring(0, 1))) break; } }else{ for (;;){ var tr = textrange.duplicate(); if (tr.moveStart('character', -1) == 0) break; if (is_space(tr.text.substring(0, 1))) break; var htmlText = textrange.htmlText; htmlText = htmlText.replace(/[\r\n]/g, ''); var trText = tr.htmlText.replace(/[\r\r]/g, ''); if (trText.indexOf(htmlText.substring(0, 3)) > 1) break; textrange = tr; } } if (is_space(textrange.text.substring(textrange.text.length - 1))){ for (;;){ if (textrange.moveEnd('character', -1) == 0) break; if (!is_space(textrange.text.substring(textrange.text.length - 1))) break; } }else{ for (;;){ var tr = textrange.duplicate(); if (tr.moveEnd('character', 1) == 0) break; if (is_space(tr.text.substring(tr.text.length - 1))) break; var htmlText = textrange.htmlText; htmlText = htmlText.replace(/[\r\n]/g, '').substring(htmlText.length - 3); var trText = tr.htmlText.replace(/[\r\r]/g, ''); if (trText.lastIndexOf(htmlText) < tr.htmlText.length - htmlText.length - 1) break; textrange = tr; } } var name = textrange.text; var arr = name.split(/[ \t\n\r\.\,:;\'\"\[\]\(\)]+(-+[ \t\n\r\.\,:;\'\"\[\]\(\)]+)?/); words = arr.length; sel = textrange.duplicate(); textrange.collapse(); textrange.moveEnd("word", 32); var fav_param = new Object(); fav_param.marker = textrange.text; if (words > 0){ name = name.replace(/\r?\n/g, ' ').replace(/ +/g, ' '); if (name.length > 256){ name = name.substring(0, 253); var pos = name.lastIndexOf(' '); if (pos > 50) name = name.substring(0, pos); name += '...'; } fav_param.name = name; } return fav_param; } function is_space(s){ return (s == ' ') || (s == '\r') || (s == '\n') || (s == '\t'); } function checkDataKey(event){ event = event || window.event; var c = event.keyCode; return ((c >= 48) && (c <= 57)) || ([190,8,9,13].indexOf(c) >= 0); } function saveWorkspaceState(listOnly){ var value = 0; if (true == listOnly) value = 1; saveCookieVar('workspaceState', value); } function fixnull(value,obj){ return obj == null ? value : obj; } function showWspaceState(){ framePath(fixnull("workspace_default",["workspace_default","workspace_list"][fixnull("0",(new cookiePrefs()).workspaceState)])).checked = true; } function goToContext(n){ var sp = framePath('sp_' + n); if (sp == null) return; sp.scrollIntoView(); } function killBlockInh(bid) { document.getElementById(bid).style.display='none'; } function showBlockInh(bid) { document.getElementById(bid).style.display='block'; } function setDateBlock() { elem = document.getElementById('date_type'); div1 = document.getElementById('search_date_period'); div2 = document.getElementById('search_date_exact'); if(elem.options[elem.selectedIndex].value == 'period') { div1.style.display = 'inline'; div2.style.display = 'none'; } else { div1.style.display = 'none'; div2.style.display = 'inline'; } } function createImplicitLink(anchorEl, docOid, fragmentId, text) { // anchorEl может быть идентификатором anchorEl = el(anchorEl); // Спросим ссылки var target = window.external.setImplicitRefsForFragment(docOid, fragmentId, text); if(target) { // Обновим вид нашей ссылки. if(anchorEl) { anchorEl.className = 'il_set'; if(target.oids) { anchorEl.title = 'После сохранения это будет ссылка на ' + target.oids.length + ' документов'; } } // Find next suspected IL. var spans = document.getElementsByTagName('SPAN'), nextUnsetFragId = -1; for(var i in spans) { var span = spans[i]; if('il_unset' == span.className && span.id) { var spanFragId = span.id.replace('il_id_', ''); if(spanFragId != span.id) { spanFragId = parseInt(spanFragId, 10); if(spanFragId > fragmentId) { if(-1 == nextUnsetFragId || spanFragId < nextUnsetFragId) { nextUnsetFragId = spanFragId; } } } } } // Jump to it. if(nextUnsetFragId != -1) { // alert(nextUnsetFragId); location.href = '#il_id_' + nextUnsetFragId; } } } function showSearchPanel() { //debugger; var frame = (window.frames['list'].contentWindow || window.frames['list'].frameElement.contentWindow); if (!frame.textCompleted) { window.location.href = window.location.href + '&showsearch=1'; } else { showBlock('window_find'); getFocus('find_str'); } } var enableBtn = (function() { var originals = [], nop = function() {}; var getRec = function(btn, create) { for(var i = 0; i < originals.length; i++) { var rec = originals[i]; if(btn == rec.btn) { return rec; } } if(create) { var rec = { btn: btn, className: btn.className, onclick: btn.onclick }; originals.push(rec); return rec; } }; return function(btn, enable) { if(enable === undefined) enable = true; btn = el(btn); if(btn==null) return; var rec = getRec(btn, !enable); if(enable) { if(rec) { btn.className = rec.className; btn.onclick = rec.onclick; } } else { btn.className += ' disabled'; btn.onclick = nop; } btn.disabled = !enable; }; })(); function hideSpinner() { var spinner = document.getElementById('spinner'); if (spinner != null) { spinner.style.display = 'none'; } }