/* --- ФУНКЦИИ ДВИЖКА --- */ /* Редирект */ function sendto(x) { this.location = x; } /* Функция установления репутации. Плагины , и . Также использутеся в отображении комментариев. */ function setkarma(n,c) { if (c == "plus"){ t2 = "увеличить"; } else{ t2 = "уменьшить"; } if(n == "") alert("Нельзя менять репутацию самому себе."); else{ reason = prompt("Введите причину, по которой вы хотите " + t2 + " репутацию пользователя " + n,"") if (reason == "") alert("Необходимо ввести причину") else { if (reason != null) { sendto("?m_plg=rating&act=blame&u_name=" + n + "&karmaAct=" + c + "&reason=" + reason + "&location="); } } } } /* Функция сворачивания окон плагинов */ /* Функция установления занчений cookie */ // name - имя cookie // value - значение cookie // [expires] - дата окончания действия cookie (по умолчанию - до конца сессии) // [path] - путь, для которого cookie действительно (по умолчанию - документ, в котором значение было установлено) // [domain] - домен, для которого cookie действительно (по умолчанию - домен, в котором значение было установлено) // [secure] - логическое значение, показывающее требуется ли защищенная передача значения cookie function setCookie(name, value, exp, path, domain, secure) { var exp = new Date(); var nowPlusOneMonth = exp.getTime() + ( 30 * 24 * 60 * 60 * 1000); exp.setTime(nowPlusOneMonth); var curCookie = name + "=" + escape(value) + ((exp) ? "; expires=" + exp.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "") if ( (name + "=" + escape(value)).length <= 4000 ) document.cookie = curCookie else if (confirm("Cookie превышает 4KB и будет вырезан !")) document.cookie = curCookie } /* Функция прочтения cookie */ // name - имя считываемого cookie function getCookie(name) { var prefix = name + "=" var cookieStartIndex = document.cookie.indexOf(prefix) if (cookieStartIndex == -1) return null var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length) if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) } /* Функция отображения времени в реальном времени */ function showTime () { if(document.getElementById) { nowtime = new Date() if (parseInt(nowtime.getHours()) > 9) { var nowtimeHours = nowtime.getHours()} else { var nowtimeHours = '0' + nowtime.getHours() } if (parseInt(nowtime.getMinutes()) > 9) { var nowtimeMinutes = nowtime.getMinutes()} else { var nowtimeMinutes = '0' + nowtime.getMinutes() } if (parseInt(nowtime.getSeconds()) > 9) { var nowtimeSeconds = nowtime.getSeconds()} else { var nowtimeSeconds = '0' + nowtime.getSeconds() } // if (parseInt(nowtime.getDate()) > 9) { var nowtimeDay = nowtime.getDate() } else { var nowtimeDay = '0' +(nowtime.getDate()) } // if (parseInt(nowtime.getMonth() + 1) > 9) { var nowtimeMonth = nowtime.getMonth() + 1} else { var nowtimeMonth = '0' + (nowtime.getMonth() + 1) } var TimeString = nowtimeHours + ':' + nowtimeMinutes + ':' + nowtimeSeconds // + ' / ' + nowtimeDay + '.' + nowtimeMonth + '.' + nowtime.getFullYear(); if(document.getElementById('ShowTime')) { document.getElementById('ShowTime').innerHTML = TimeString; setTimeout("showTime()", 1000); } } } /* Функция отображения подсказок (tooltips). Поддержка скинов. */ var ns4 = document.layers; var ns6 = document.getElementById && !document.all; var ie4 = document.all; offsetX = -183; offsetY = 15; var toolTipSTYLE=""; function initToolTips() { if(ns4||ns6||ie4) { if(ns4) toolTipSTYLE = document.toolTipLayer; else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style; else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style; if(ns4) document.captureEvents(Event.MOUSEMOVE); else { toolTipSTYLE.visibility = "visible"; toolTipSTYLE.display = "none"; } document.onmousemove = moveToMouseLoc; } } function toolTip(msg) { if(toolTip.arguments.length < 1) // hide { if(ns4) toolTipSTYLE.visibility = "hidden"; else toolTipSTYLE.display = "none"; } else // show { var content = "
" + msg + "
"; if(ns4) { toolTipSTYLE.document.write(content); toolTipSTYLE.document.close(); toolTipSTYLE.visibility = "visible"; } if(ns6) { document.getElementById("toolTipLayer").innerHTML = content; toolTipSTYLE.display='block' } if(ie4) { document.all("toolTipLayer").innerHTML=content; toolTipSTYLE.display='block' } } } function moveToMouseLoc(e) { if(ns4||ns6) { x = e.pageX; y = e.pageY; } else { x = event.x + document.body.scrollLeft; y = event.y + document.body.scrollTop; } toolTipSTYLE.left = x + offsetX; toolTipSTYLE.top = y + offsetY; return true; }