var cs = new Array('#','!','0','@','*','$','^','/','x','-') sc = new Array() for (i=0;i<10;i++) sc[cs[i]]=i var texts = new Array("логин","пароль","тут могут быть номера телефонов/icq, адреса почты и т.д.") var texts = new Array("логин","пароль","тут могут быть номера телефонов/icq, адреса почты и т.д.","тут текст сообщения...","здесь текст новости...","тут описание альбома...","тут описание...","тут описание события...") var xoffset = 0 var yoffset = -1 var quantificator = 8 var msgs = 0 var startup = true var check_messages = false var divx = 0 var divy = 0 var divmove = false var ed = false var obj var msgDivs = new Array() var lmsg = 0 var lastHash = "" function el(name) { return document.getElementById(name) } function hide_it(id) { el(id).style.display = 'none' } function show_it(id) { el(id).style.display = 'block' } function cursor_it(id) { el(id).style.left = cx el(id).style.top = cy show_it(id) } function chcursor(id) { el(id).style.left = cx el(id).style.top = cy chstat(id) } function chstat(id) { if (el(id).style.display == 'none') { show_it(id) } else { hide_it(id) } } function getHeight() { if (typeof(window.innerHeight)=='number') { return window.innerHeight; } else if (document.documentElement&&document.documentElement.clientHeight) { return document.documentElement.clientHeight; } else if (document.body&&document.body.clientHeight) { return document.body.clientHeight; } return 600 } function getWidth() { if (typeof(window.innerWidth)=='number') { return window.innerWidth; } else if (document.documentElement&&document.documentElement.clientWidth) { return document.documentElement.clientWidth; } else if (document.body&&document.body.clientWidth) { return document.body.clientWidth; } return 800 } function getObjProp(obj,p) { if (document.defaultView && document.defaultView.getComputedStyle) { return document.defaultView.getComputedStyle(obj, "").getPropertyValue(p).replace(/[^0-9]/g,'') } if (elem.currentStyle) return object.currentStyle[p] } function getObjWidth(obj) { if (obj.style.pixelWidth) return obj.style.pixelWidth else return getObjProp(obj,"width").replace(/[^0-9]/g,"") } function getObjHeight(obj) { if (obj.style.pixelHeight) return obj.style.pixelHeight else return 40// getObjProp(obj,"height").replace(/[^0-9]/g,"") } function getObjLeft(obj) { if (obj.style.pixelLeft) return obj.style.pixelLeft else return getObjProp(obj,"left").replace(/[^0-9]/g,"") } function getObjTop(obj) { if (obj.style.pixelTop) return obj.style.pixelTop else return getObjProp(obj,"top").replace(/[^0-9]/g,"") } function DivMouseDown(e) { divx = -1 obj = e divmove = true } function DivMouseUp() { divmove = false } function DivMouseMove(x,y) { if (divx == -1) { divx = x - getObjLeft(obj) divy = y - getObjTop(obj) } obj.style.left = x - divx obj.style.top = y - divy } function move_hint(e) { if (!e) e = window.event; if (e.pageX || e.pageY) { cx = e.pageX; cy = e.pageY; } else if (e.clientX || e.clientY) { cx = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; cy = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop; } if (divmove) DivMouseMove(cx,cy) el('hint').style.left = cx+xoffset el('hint').style.top = cy+yoffset } function set_hint(caption,pos) { if (caption.indexOf('
') > 0) { strings = caption.split('
') width = strings[0].length for (i = 0; i < strings.length ; i++ ) { if (width < strings[i].length) width = strings[i].length } } else width = caption.length if (width > 40) width/=2 width = width*quantificator el('hint').innerHTML = caption el('hint').style.width = width if (pos == 1) xoffset = -width-10 else xoffset = 10 el('hint').style.left = cx+xoffset show_it('hint') } function clearm() { document.postform.message.value = "" } function setsmile(smile) { obj = document.postform.message if (!ed) obj.value = "" obj.focus(); if (document.selection) { var s = document.selection.createRange(); s.text = smile // s.select(); } else if (typeof(obj.selectionStart)=="number") { var start = obj.selectionStart; var end = obj.selectionEnd; obj.value = obj.value.substr(0,start)+smile+obj.value.substr(end); obj.setSelectionRange(end,end); } else SetQTag(st,fn,pr) } function check_msg() { if (check_messages) { if (!startup) ajax("off") check_messages = false el("loadMsg").style.display = "none" el("aText").innerHTML = "включить AJAX" } else { if (!startup) ajax("on") check_messages = true if (msgs == 0) el("loadMsg").style.display = "block" el("aText").innerHTML = "выключить AJAX" check_msgs() } } function Centrate(obj) { obj.style.left = parseInt((getWidth() - getObjWidth(obj))/2) obj.style.top = parseInt((getHeight() - getObjHeight(obj))/2) if (obj.style.top > 60) obj.style.top -= 20 } function ShowHWindow() { if (el("hwindow").style.display == "none") { Centrate(el("hwindow")) show_it("hwindow") } } function ajax_err(e) { el("err_msg").innerHTML = e show_it("errmsg") } function nms(c) { msgs = c if (c > 0) { el("loadMsg").style.display = "none" el("hasMsg").style.display = "block" el("newMsg").innerHTML = c el("nmmi").innerHTML = "("+c+")" } else { if (check_messages) el("loadMsg").style.display = "block" el("hasMsg").style.display = "none" el("nmmi").innerHTML = "" } if (check_messages) setTimeout("check_msgs()",15000) } function ams(m) { el("hwbody").innerHTML = m ShowHWindow("hwindow") if (check_messages) check_msgs() } function pload(id,m) { el("pmsg_" + id).innerHTML = m el("nmsg_" + id).innerHTML = " " msgDivs[id] = 1 } function lms(m) { pload(lmsg,m) rid = parseInt(lmsg) if (el("nmsg_" + parseInt(lmsg)) != null) pload(rid,m) rid = "0" + rid if ((el("pmsg_" + rid) != null)&&(rid != lmsg)) pload(rid,m) chstat("msg_" + lmsg) if (check_messages) check_msgs() } function nus(u) { if (u > 0) el("new_user").innerHTML = " (" + u + ")" else el("new_user").innerHTML = "" } function ner(e) { if (e > 0) el("new_errs").innerHTML = " (" + e + ")" else el("new_errs").innerHTML = "" } function ajax_event(response) { if (response.indexOf('') < 0) { strings = new Array(); strings[0] = response } else strings = response.split('') for (s in strings) { l = strings[s] tag = l.substr(0,1) block = l.substr(1,l.length) if (block != 'fail') { switch (tag) { case 'n': nms(block) break case 'l': ams(block) break case 'm': lms(block) break case 'u': nus(block) break case 'e': ner(block) break } } else ajax_err("загрузка не удалась") HideLoader() } } function ajax(request) { var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { if ((xmlHttp.responseText.indexOf('') == 0)&&(xmlHttp.responseText.indexOf('') == xmlHttp.responseText.length-7)) { response = xmlHttp.responseText.substr(6,xmlHttp.responseText.length-13) ajax_event(response) } } } xmlHttp.open("POST","ajax.php?do=ajax&act="+request,true); xmlHttp.send(null); return true; } function check_msgs() { if (!ajax("check")) check_messages = false } function ShowLoader() { el("screen_blend").style.width = Math.max(document.documentElement.scrollWidth,document.body.scrollWidth) el("screen_blend").style.height = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight) show_it("screen_blend") Centrate(el("ajax_load")) show_it("ajax_load") } function HideLoader() { hide_it("ajax_load") hide_it("screen_blend") } function ajax_new() { if (ajax("loadnew")) ShowLoader() } function ajax_del(id) { if (ajax("loadnew&del="+id)) ShowLoader() } function ShowMsg(id) { hide_it("errmsg") if (msgDivs[id] == 1) chstat("msg_" + id) else { ShowLoader() lmsg = id if (!ajax("private&target="+id)) HideLoader() } } function SetQTag(st,fn,pr) { text = prompt("ИСТ УГТУ",pr) if (text != null) setsmile(st+text+fn) } function SetTag(st,fn,pr) { obj = document.postform.message obj.focus(); if (document.selection) { var s = document.selection.createRange(); if (s.text.length > 0) { s.text = st + s.text + fn // s.select(); } else SetQTag(st,fn,pr) } else if (typeof(obj.selectionStart)=="number") { if (obj.selectionStart!=obj.selectionEnd) { var start = obj.selectionStart; var end = obj.selectionEnd; var rs = st+obj.value.substr(start,end-start)+fn obj.value = obj.value.substr(0,start)+rs+obj.value.substr(end); obj.setSelectionRange(end,end); } else SetQTag(st,fn,pr) } else SetQTag(st,fn,pr) } function link() { addr = prompt("ИСТ УГТУ","адрес") if (addr != null) SetTag("[link="+addr+"]", "[/link]", "текст на ссылке") } function SetQuot(w,q) { setsmile("[q="+w+"]"+q+"[/q]") } function copylink(lnk) { temp = prompt("ИСТ УГТУ",lnk) } function SelColor(c) { hide_it("colorSel") SetTag("[c="+c+"]","[/c]","цветной текст") } function clearedit(obj) { ed = true for (t in texts) { if (obj.value == texts[t]) { obj.value = "" return } } } function outdc(cstr) { if (cstr.length>0) { nstr="" l=parseInt(cstr.length/4) for (i=l-1;i>=0;i--) { t=0 for (j=0;j<4;j++) { t*=10 t+=sc[cstr.charAt(3-j)] } cstr=cstr.substr(4) nstr=String.fromCharCode(t-i)+nstr } return nstr } else return 'ошибка страницы...' } function RefreshCaptcha() { for(i=0; i