// setting varialbles // ie5+ supports all the methods in the tree, but not the hasFeature, so... var ie5 = (document.all && document.getElementById)? true : false; // dom - all DOM2 compliant browsers (with MouseEvents 2 ;-) var dom = (document.implementation && document.implementation.hasFeature("MouseEvents","2.0"))? true : false; // tree variables // isTreeOpen // All tree branches are open if true, closed if false. // I've got plans to keep branch states in cookie, but it's not yet realized. var isTreeOpen = false; // look variables // By this value leafs will go deep. var leafImgWidth = 16; // Default caption padding in the style var leafCaptionDefPadding = 0; // Caching leafImages var leafImg = new Image(); leafImg.src = '/leaf.gif'; var leafOpenImg = new Image(); leafOpenImg.src = '/leafopen.gif'; var leafClosedImg = new Image(); leafClosedImg.src = '/leafclosed.gif'; // Fake function function initTree(treeContainerId) { return false } if (ie5 || dom) { document.write(''); document.write(''); } else document.write(''); function showNewsByDay() { var error = ""; var day = document.arch.selectDay.value; var month = document.arch.selectMonth.value; var year = document.arch.selectYear.value; if (day == "0") error=error+"Укажите день\n"; if (month == "0") error=error+"Укажите месяц\n"; if (year == "0") error=error+"Укажите год\n"; if (error == "") document.location='/web/news.nsf/arch?open&RestrictByCategory='+year+month+day; else alert (error); } function showNewsForCurrentDay() { var D; var myYear; var myDay; var myMonth; D = new Date(); myDay = D.getDate(); myMonth = D.getMonth() + 1; if(ie5) { myYear = D.getYear(); } else { myYear = D.getYear() + 1900; } var temp = "" + myYear; temp += ((myMonth < 10) ? "0" : "") + myMonth; temp += ((myDay < 10) ? "0" : "") + myDay; document.location="/web/news.nsf/arch?open&RestrictByCategory=" + temp; } /********************************************************* //JavaScript functions используемые в базе //Александр Богомолов, Олег Эльберг, Максим Воронин **********************************************************/ /********************************************************* //Проверка броузера **********************************************************/ dom = (document.getElementById)? true : false; nn4 = (document.layers)? true : false; ie4 = (document.all && !dom)? true : false; function setStatus(text) { window.status = text; return true; } function clearStatus() { window.status = ""; return true; } /********************************************************* //Отправка голосования **********************************************************/ function gls (form) { //alert ("982309238"); var cheked=false; var i; for (var i=0;i,\[,\]]/; var str = s.value; if ( str == "" ) { alert("Пожалуйста введите значение для поиска."); s.focus(); } else { if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing if ( regExp1.test( str ) || regExp2.test( str ) ) { var alrt = "Пожалуйста не включайте следующее:"; alrt += "\n\nзарезервированное слово 'field'\nзначения [, ], (, ), < или >"; alrt += "\n\n в поисковый запрос!\n"; s.focus(); return alert( alrt ); } function openDbRelativeURL( url, target ){ //Определение a target window; target = (target == null ) ? window : target; //рабочая область database; //path=location.pathname.split('.nsf')[0] + '.nsf/'; if(flag==1) { //path = '/C5256E2C00227BF6/'; path = '/web/news.nsf/'; } else { //path = '/C5256E2000157A03/'; path = '/web/www.nsf/'; } //target.location.href = path + url; window.location = path + url; } if(flag==1) { openDbRelativeURL("search?searchview&query="+ escape( str )+"&start=1&count=10"); } else { openDbRelativeURL("search?searchview&query="+ escape( str )+"&start=1&count=10"); } } } /////// /********************************************************* //нет спама **********************************************************/ function nospam(user,domain) { locationstring = "mailto:" + user + "@" + domain; window.location = locationstring; } /********************************************************* //Открытие документа по ID **********************************************************/ function nl(link) { //if(window.location.pathname=="web/www.nsf/web") //{ /*window.location.href ="http://www.orsk-adm.ru/web/www.nsf/Pages/"+link+""; */ window.location.href ="http://www.orsk-adm.ru/web/www.nsf/Pages/"+link+""; //window.location.href.replace("default?OpenForm","Pages/"+link); //} } /********************************************************* //Показ результата голосования и его скрытие **********************************************************/ function show_res() { putElem ('glr'); removeElem ('gl'); } function hide_res() { putElem ('gl'); removeElem ('glr'); } function showVoteRes(form) { putElem ('voteRes' + form.voteId.value); removeElem ('vote' + form.voteId.value); } function hideVoteRes(form) { putElem ('vote' + form.voteId.value); removeElem ('voteRes' + form.voteId.value); } /********************************************************* //Скрытие и отображение категорий ТЛФ **********************************************************/ function putElem(elemId) { if (dom) document.getElementById(elemId).style.display = "block"; else if (ie4) document.all[elemId].style.display = "block"; else alert('Ваш браузер не позволяет менять свойство display для элемента: '+elemId) } function removeElem(elemId) { if (dom) document.getElementById(elemId).style.display = "none"; else if (ie4) document.all[elemId].style.display = "none"; else alert('Ваш браузер не позволяет менять свойство display для элемента: '+elemId) } /********************************************************* //Добавление сайта **********************************************************/ /* function Check(nm, mess) { if ((nm=="") | (nm=="http://")) { alert(mess); return true } else return false; //return false; } function sendnow() { var i=0; var f=document.forms[1]; var nm=f.elements[i+0].value; if (Check(nm,"Необходимо указать название сайта")) return; var url=f.elements[i+1].value; if (Check(url,"Необходимо указать URL сайта")) return; var deskr=f.elements[i+2].value; if (Check(deskr,"Необходимо указать описание сайта")) return; var ctg=f.elements[i+3]; var n=ctg.options.selectedIndex; if (n==0) { alert("Выберите категорию сайта"); return; } f.ctgvl.value=n; f.submit(); //var s=ctg.options[n].text; } */ function returnFalse(s){ //guess the field if not supplied s = (s == null) ? document.forms[0].Query : s; //if you want to do the search, use this line //doSearchDB(s); //if you want to alert the user, use this line alert('Пожалуйста используйте \'кнопки!!!\' для поиска'); //this line should always be here!! return false; } function calcTime() { var strResult = '' var now = new Date(); var newYear = new Date(2008, 0, 1, 0, 0, 0); var tmp = Math.round ( (newYear - now) / 1000 ); var days = Math.floor (tmp / 24 / 60 / 60); strResult += days +' дней. '; tmp = tmp - (days * 24 * 60 * 60); var hours = Math.floor (tmp / 60 / 60); strResult += hours +' ч. '; tmp = tmp - (hours * 60 * 60); var minutes = Math.floor (tmp / 60); strResult += minutes +' мин. '; tmp = tmp - (minutes * 60); var seconds = Math.floor (tmp); strResult += seconds +' сек. '; return strResult; } var counterSpan = null function updateCounter() { if (!counterSpan) counterSpan = document.getElementById ('timer'); if (counterSpan) counterSpan.innerHTML = calcTime(); } function getQueryVariable() { //полачаем строку запроса (?a=123&b=qwe) и удаляем знак ? var query = window.location.search.substring(1); //получаем массив значений из строки запроса вида vars[0] = ‘a=123’; var vars = query.split("&"); var arr = new Array(); //переводим массив vars в обычный ассоциативный массив for (var i=0;i