game/img.new-combats.com/js/Lite/gameEngine.js
2023-01-10 18:30:35 +02:00

2445 lines
62 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Начало работы */
function startEng()
{
lineResize();
lineResize2();
testResize();
//preventSelection(document.body);
startChat(0);
seeBtns(0);
}
/* Переменные */
var norz = 0;
var id_log = 0;
var id_log_ar = new Array();
var battle_log = 0;
var goodIE = 7;
var lstW = 0;
var lstH = 0;
var tmoff = 0;
var tmgof = 1;
var chatBtnsDate = { };
var chatReflesh = 0;
var newTimeReflesh = 20;
var lastMessage = 0;
var trnsl = 0;
var snd = 0;
var max_window = 10; // максимальное число окошек
var toInpLogin = '';
var nowraz = 0;
var battle = 0;
var battle_now = 0;
var tmr10 = 0;
var onr = 0;
var chat_id = 0;
function rmve(id)
{
$(id).remove();
}
/* ==========[ Авто обновление чата ] ============================================================================================================================================= */
var tr07 = 0;
function startChat(id)
{
if(id==1)
{
clearTimeout(tmr10);
}
if(tr07==0)
{
$.post('chat.php',{reflesh:top.lastMessage,fi:document.F1.fi.value,romz:onr},function(data){$("#output").html(data);top.lineResize2();});
setTimeout('top.tr07 = 0;',1000);
}
tmr10 = setTimeout('startChat(1);',newTimeReflesh*1000);
}
/* ==========[ Работа с чатом ]==================================================================================================================================================== */
var id_file = 'test';
var ltr = 0;
var tt1;
function giveTtl()
{
var i = 1;
while(i<=20)
{
if(nb[i]!=undefined)
{
var obj = document.getElementById('chBtn'+i);
if(obj!=undefined)
{
obj.title = nb[i][1];
}
}
i++;
}
}
function autoAllChat(onref)
{
if(tmoff==0)
{
var onr = top.onlineRef;
if(onref==1)
{
onr = 1;
}
$.post('chat.php',{reflesh:top.lastMessage,fi:document.F1.fi.value,romz:onr},function(data){$("#output").html(data);top.lineResize2();});
tmoff = 10;
}else{
if(tmoff>0 && tmgof==1)
{
setTimeout('tmoff = 0; tmgof = 1; autoAllChat('+onref+');',500);
tmgof = 0;
}
}
}
function autoFocus()
{
if(document.getElementById('F1')!=undefined)
{
if(document.getElementById('text')!=undefined)
{
document.getElementById('text').focus();
}
}
}
function trmb()
{
if(top.trnsl==1)
{
document.F1.text.value = convert2(document.F1.text.value);
}
}
function convert2(txt)
{
var trn = new Array();
trn = txt.split(' ');
for(var i=0;i<trn.length;i++) {
if(trn[i].indexOf("http://") < 0 && trn[i].indexOf('@') < 0 && trn[i].indexOf("www.") < 0 && !(trn[i].charAt(0)==":" && trn[i].charAt(trn[i].length-1)==":")) {
if ((i<trn.length-1)&&(trn[i]=="to" || trn[i]=="private")&&(trn[i+1].charAt(0)=="[")) {
while ( (i<trn.length-1) && (trn[i].charAt(trn[i].length-1)!="]") ) i++;
} else { trn[i] = top.convert(trn[i]); }
}
}
return trn.join(' ');
}
/* ==========[ Работа с событиями ]================================================================================================================================================ */
Event = (function() {
var guid = 0
function fixEvent(event) {
event = event || window.event
if ( event.isFixed ) {
return event
}
event.isFixed = true
event.preventDefault = event.preventDefault || function(){this.returnValue = false}
event.stopPropagation = event.stopPropagaton || function(){this.cancelBubble = true}
if (!event.target) {
event.target = event.srcElement
}
if (!event.relatedTarget && event.fromElement) {
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
}
if ( event.pageX == null && event.clientX != null ) {
var html = document.documentElement, body = document.body;
event.pageX = event.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0);
event.pageY = event.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0);
}
if ( !event.which && event.button ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event
}
/* Вызывается в контексте элемента всегда this = element */
function commonHandle(event) {
event = fixEvent(event)
var handlers = this.events[event.type]
for ( var g in handlers ) {
var handler = handlers[g]
var ret = handler.call(this, event)
if ( ret === false ) {
event.preventDefault()
event.stopPropagation()
}
}
}
return {
add: function(elem, type, handler) {
if (elem.setInterval && ( elem != window && !elem.frameElement ) ) {
elem = window;
}
if (!handler.guid) {
handler.guid = ++guid
}
if (!elem.events) {
elem.events = {}
elem.handle = function(event) {
if (typeof Event !== "undefined") {
return commonHandle.call(elem, event)
}
}
}
if (!elem.events[type]) {
elem.events[type] = {}
if (elem.addEventListener)
elem.addEventListener(type, elem.handle, false)
else if (elem.attachEvent)
elem.attachEvent("on" + type, elem.handle)
}
elem.events[type][handler.guid] = handler
},
remove: function(elem, type, handler) {
var handlers = elem.events && elem.events[type]
if (!handlers) return
delete handlers[handler.guid]
for(var any in handlers) return
if (elem.removeEventListener)
elem.removeEventListener(type, elem.handle, false)
else if (elem.detachEvent)
elem.detachEvent("on" + type, elem.handle)
delete elem.events[type]
for (var any in elem.events) return
try {
delete elem.handle
delete elem.events
} catch(e) { // IE
//if(goodIE>=7.0)
//{
elem.removeAttribute("handle");
elem.removeAttribute("events");
//}
}
}
}
}());
/* ==========[ Высплывающие подсказки ]========================================================================================================================================== */
var addMoveFRM = new Array();
var iAct = 0;
function moveTitle(event,f,tp)
{
var f2 = '';
chf = f;
if(f=='online')
{
f2 = f;
f = '';
}
if (!event)
{
event = window.event;
}
var __HintObject = top.document.getElementById('ttl');
if(__HintObject.innerHTML!='')
{
var x,y;
if(event.clientX+top.document.body.scrollLeft+__HintObject.clientWidth+20>=top.document.body.clientWidth)
{
x = event.clientX-__HintObject.clientWidth-20;
}else{
x = event.clientX+top.document.body.scrollLeft+20;
}
if(event.clientY+top.document.body.scrollTop+__HintObject.clientHeight+20>=top.document.body.clientHeight+top.document.body.scrollTop-5)
{
y = top.document.body.clientHeight-__HintObject.clientHeight+top.document.body.scrollTop-5;
}else{
y = event.clientY+top.document.body.scrollTop+20;
}
var dptop = 0;
var dpleft = 0;
if(f!='' && top.frames[f]!=undefined)
{
var dp = top.frames[f].document;
}else{
var dp = top.document;
}
if(addMoveFRM[f]==undefined || addMoveFRM[f]!=1)
{
Event.add(dp, 'mousemove', test2);
addMoveFRM[f] = 1;
}
if(dp!=undefined && f=='chat')
{
dptop = getFrH(top.frames['main']);
}else if(dp!=undefined && f=='online')
{
dptop = getFrH(top.frames['main']);
dpleft = 0;
}
if(f=='main')
{
x -= 2;
y += 7;
}else if(f2=='online')
{
x -= 10;
y -= 37;
} if(f=='online')
{
x -= 10;
y -= 37;
}
if(top.frames['main']==undefined)
{
x -= 10;
y -= 37;
}
__HintObject.style.left = x -10 + dpleft + 'px';
__HintObject.style.top = y + 37 + dptop + 'px';
}
}
function test2(event)
{
moveTitle(event,chf,null);
iAct++;
}
function test(event)
{
moveTitle(event,chf,null);
}
var chf = '';
function title(t,event,tp,frm,stl)
{
if(chf!='' && frm!='online' && top.frames[chf]!=undefined)
{
var dp = top.frames[chf].document;
}else{
var dp = top.document;
}
if(stl==null || stl==undefined)
{
stl = 'white-space:nowrap;';
}
//Event.remove(dp, 'mousemove', test);
chf = frm;
if (!event)
{
event = window.event;
}
//white-space:nowrap;
var s = '<font style=\''+stl+' display:block; font-size: 8pt; font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;\'>'+t+'</font>';
var dv = top.document.getElementById('ttl');
if(dv!=undefined)
{
if(tp==0)
{
addMoveFRM[chf] = 1;
}
dv.innerHTML = s;
top.moveTitle(event,frm,tp);
dv.style.display = '';
}
}
function ct(event)
{
var dv = top.document.getElementById('ttl');
if(dv!=undefined)
{
dv.innerHTML = '';
dv.style.display = 'none';
}
var q,w='';
if(chf!='' && top.frames[chf]!=undefined)
{
var dp = top.frames[chf].document;
}else{
var dp = top.document;
}
if(chf!='')
{
Event.remove(dp, 'mousemove', test);
addMoveFRM[chf] = 0;
}
chf = '';
}
/* ==========[ Запрет выделения ]================================================================================================================================================ */
function preventSelection(element)
{
var preventSelection = false;
function addHandler(element, event, handler){
if (element.attachEvent)
element.attachEvent('on' + event, handler);
else
if (element.addEventListener)
element.addEventListener(event, handler, false);
}
function removeSelection(){
if (window.getSelection) { window.getSelection().removeAllRanges(); }
else if (document.selection && document.selection.clear)
document.selection.clear();
}
function killCtrlA(event){
var event = event || window.event;
var sender = event.target || event.srcElement;
if (sender.tagName.match(/INPUT|TEXTAREA/i))
return;
var key = event.keyCode || event.which;
if (event.ctrlKey && key == 'A'.charCodeAt(0))
{
removeSelection();
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
}
addHandler(element, 'mousemove', function(){
if(preventSelection){removeSelection();}
});
addHandler(element, 'mousedown', function(event){
var event = event || window.event;
var sender = event.target || event.srcElement;
preventSelection = !sender.tagName.match(/INPUT|TEXTAREA/i);
});
addHandler(element, 'mouseup', function(){
if (preventSelection)
removeSelection();
preventSelection = false;
});
addHandler(element, 'keydown', killCtrlA);
addHandler(element, 'keyup', killCtrlA);
}
/* ==========[ Изменение размеров линии ]================================================================================================================================================ */
function showtable(id)
{
hidesel(id);
hidemenu(0);
document.getElementById('menu'+id).style.display = '';
}
function hidemenu (time) {
for (var i=1;i<=4;i++) {
document.getElementById('menu'+i).style.display = 'none';
}
}
function hidesel (id) {
for (var i=1;i<=5;i++) {
if (i!=id) {document.getElementById('el'+i).style.backgroundColor='';document.getElementById('el'+i).style.color='';}
}
}
function resizeLine2(evt)
{
if(document.getElementById('glob').style.display!='')
{
document.getElementById('glob').style.display = '';
}
evt = evt || window.event;
var ln = document.getElementById('resizeLine2');
if(ln!=undefined)
{
Event.add(document, 'mousemove', resizeLine2);
ln.style.left = evt.clientX-1+'px';
norz = 1;
}
}
function resizeLineEnd2(evt)
{
if(document.getElementById('glob').style.display=='')
{
document.getElementById('glob').style.display = 'none';
}
Event.remove(document, 'mousemove', resizeLine2);
evt = evt || window.event;
var ln = document.getElementById('resizeLine2');
if(ln!=undefined)
{
//сохраняем координаты загрушки
var wh = getClientWidth();
var newSz = evt.clientX+15;
if(newSz<301){ newSz = 301; }
if(newSz>wh-51){ newSz = wh-51; }
var bln = document.getElementById('backresizeLine2');
var newY = ln.style.top;
var ms = document.getElementById('online2');
if(ms!=undefined)
{
var cf = document.getElementById('onlineframe');
cf.style.width = wh-newSz+'px';
ms.style.width = 100-((newSz)/wh*100)+'%';
lineResize2();
}
if(bln!=undefined)
{
bln.style.left = ln.style.left;
}
norz = 0;
}
}
function resizeLine(evt)
{
if(document.getElementById('glob').style.display!='')
{
document.getElementById('glob').style.display = '';
}
evt = evt || window.event;
var ln = document.getElementById('resizeLine');
if(ln!=undefined)
{
Event.add(document, 'mousemove', resizeLine);
ln.style.top = evt.clientY-2+'px';
norz = 1;
}
}
function resizeLineEnd(evt)
{
if(document.getElementById('glob').style.display=='')
{
document.getElementById('glob').style.display = 'none';
}
Event.remove(document, 'mousemove', resizeLine);
evt = evt || window.event;
var ln = document.getElementById('resizeLine');
if(ln!=undefined)
{
//сохраняем координаты загрушки
var wh = getClientHeight();
var newSz = evt.clientY-42;
if(newSz<50){ newSz = 50; }
if(newSz>wh-107){ newSz = wh-107; }
var bln = document.getElementById('backresizeLine');
var newY = ln.style.top;
var ms = document.getElementById('main_frame');
var cs = document.getElementById('chat_frame');
var cs2 = document.getElementById('chat_frame2');
if(ms!=undefined)
{
ms.style.height = ((newSz)/wh*100)+'%';
chatResize(newSz);
lineResize();
lineResize2();
}
if(bln!=undefined)
{
bln.style.top = ln.style.top;
lineResize2();
}
norz = 0;
}
}
function bodyisresize()
{
if(lstH==0)
{
lstH = document.getElementById('main_frame').clientHeight;
}
if(lstH!=document.getElementById('main_frame').clientHeight)
{
lstH = document.getElementById('main_frame').clientHeight;
lineResize();
lineResize2();
}else{
if(lstW==0)
{
lstW = document.getElementById('main_frame').clientWidth;
}
if(lstW!=document.getElementById('main_frame').clientWidth)
{
lstW = document.getElementById('main_frame').clientWidth;
lineResize2();
}
}
}
function testResize()
{
if(norz==0)
{
bodyisresize();
}
chatResize(0);
setTimeout(testResize,20);
}
function chatResize(newSize)
{
var m = document.getElementById('chat_menus');
if(m!=undefined)
{
var chW = !window.opera?document.getElementById('chat').clientWidth:document.getElementById('chat').clientWidth;
if(m.style.width!=chW)
{
m.style.width = chW+'px';
}
}
var n = document.getElementById('chat');
if(n!=undefined)
{
var cfH = !window.opera?document.getElementById('main_frame').clientHeight:document.getElementById('main_frame').clientHeight;
if(newSize>0)
{
cfH = newSize;
}
if(-(cfH-getClientHeight())-73>0)
{
cfH = -(cfH-getClientHeight())-73;
}else{
cfH = 0;
}
n.style.height = cfH+'px';
}
}
function testMsg(txt,ch)
{
var cht = document.getElementById('chatID'+ch);
if(cht!=undefined)
{
cht.innerHTML += txt;
}
}
function clearMsgs()
{
if(lastMsgIds>0)
{
var i = lastMsgIds-500;
while(i < lastMsgIds-300)
{
if(document.getElementById('message'+i)!=undefined)
{
$('#message'+i).remove();
}
i++;
}
}
}
function lineResize()
{
document.getElementById('onlineframe').style.height = '0px';
var cf = document.getElementById('chat_frame');
if(cf!=undefined)
{
var ln = document.getElementById('resizeLine');
if(ln!=undefined)
{
var xy = getOffset(cf);
chatResize(xy.top);
var xy2 = getOffset(ln);
ln.style.top = xy.top+'px';
var bln = document.getElementById('backresizeLine');
if(bln!=undefined)
{
bln.style.top = xy.top+'px';
document.getElementById('onlineframe').style.height = (getClientHeight()-xy.top-37)+'px';
}
}
}
}
function lineResize2()
{
var cf = document.getElementById('onlineframe');
if(cf!=undefined)
{
var wh = getClientWidth();
var ln = document.getElementById('resizeLine2');
if(ln!=undefined)
{
var xy = getOffset(cf);
ln.style.left = xy.left+'px';
ln.style.height = getClientHeight()-67-document.getElementById('main_frame').clientHeight-1+'px';
ln.style.top = xy.top-4+'px';
var bln = document.getElementById('backresizeLine2');
if(bln!=undefined)
{
bln.style.height = ln.style.height;
bln.style.top = ln.style.top;
bln.style.left = ln.style.left;
}
}
}
}
/* Высота и ширина окна */
function getClientHeight()
{
return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}
function getClientWidth()
{
return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}
/* Получение координат Элемента */
function getOffsetSum(elem)
{
var top=0, left=0;
while(elem)
{
top = top + parseFloat(elem.offsetTop);
left = left + parseFloat(elem.offsetLeft);
elem = elem.offsetParent;
}
return {top: Math.round(top), left: Math.round(left)}
}
function getOffsetRect(elem)
{
var box = elem.getBoundingClientRect();
var body = document.body;
var docElem = document.documentElement;
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
var clientTop = docElem.clientTop || body.clientTop || 0;
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
var top = box.top + scrollTop - clientTop;
var left = box.left + scrollLeft - clientLeft;
return { top: Math.round(top), left: Math.round(left) }
}
function getOffset(elem)
{
if(elem.getBoundingClientRect)
{
return getOffsetRect(elem);
}else{
return getOffsetSum(elem);
}
}
/* ================================================================================================================================== */
function goGames()
{
top.openNewWindow(0,"goGames",'Игральный зал','<iframe src="goGames.php" frameborder="0" id="goGames" style="width:700px; height:400px;"></iframe>',1,1);
}
function gobattle(id)
{
if(top.frames['main']!=undefined)
{
if(top.frames['main'].battle!=id)
{
top.frames['main'].location = top.frames['main'].location;
}
}
}
function useInLOck(id,r)
{
if(id>0)
{
top.openNewWindow(1,id,'Замок для рюкзака','<div align="left">Введите пароль:</div><input style="width:244px; margin:5px;" id="inPassLock'+id+'" class="inpt2" type="password" value="">','top.useInLOck2('+id+','+r+');',1);
}
}
function ertext(ee,txt)
{
if(ee!=undefined)
{
ee.innerHTML = txt;
}
}
function addNewSmile(id,r)
{
if(r==0)
{
top.openNewWindow(2,id,'Установить личный "смайлик"','Загрузите изображение смайлика:<br><form enctype="multipart/form-data" target="loadfiles" action="load_image.php?smile='+id+'" method="post" style="padding:0px; margin:0px;">Короткое имя смайлика: <input maxlength="10" type="text" name="smillname"><br><input type="file" name="filesmile" id="filesmile"><input type="submit" value="Загрузить"><Br><br><div align="left"></form><small>- Размер не более: 60 x 35 px (&quot;Ширина&quot; х &quot;Высота&quot;)<br>- Файл не должен привышать 15 кб.<br>- Формат изображения GIF<br>- Изображение не должно содержать запрещенных надписей / обьектов<br>- Попытка взлома или загрузка вредоностных файлов карается смертью персонажа</small></div><div id="addSmileError"></div><br>','top.addNewSmile('+id+',1);',1);
}else{
}
}
function newLider(id,login,uid)
{
if(id==1)
{
top.openNewWindow(1,"psh2",'Выбрать нового лидера','Выбрать `<b>'+login+'</b>`<br>новым лидером группы?<br>','top.newLider(0,'+uid+');',1,1,1);
}else{
}
}
function delMan(id,login,uid)
{
if(id==1)
{
top.openNewWindow(1,"psh1",'Выгнать персонажа','Выгнать `<b>'+login+'</b>`?<br>','top.newLider(0,'+uid+');',1,1,1);
}else{
}
}
function useMagic(name,id,img,type,urlUse)
{
top.openNewWindow(1,"useMagic",'<small>Использовать магию &quot;'+name+'&quot;','Введите логин персонажа:<br><input style="width:244px; margin:5px;" id="useMagicLogin" class="inpt2" type="text" value=""><br><span style="color:grey;">(можно щелкнуть по логину в чате)</span></small>','top.useMagicGoGo(\''+urlUse+'\');',1,1,1);
}
function useMagicGoGo(urlUse)
{
document.getElementById('useMagicLogin').value = document.getElementById('useMagicLogin').value.replace(' ','%',document.getElementById('useMagicLogin').value);
top.frames['main'].location = urlUse+'&login='+document.getElementById('useMagicLogin').value;
}
function useMagicPriem(name,pid,type,adon)
{
top.openNewWindow(1,"priemMagic",'"'+name+'"','<div align="left">Введите логин персонажа:</div><input style="width:244px; margin:5px;" id="usePriemLogin" class="inpt2" type="text" value=""><br><small style="color:grey;">(можно щелкнуть по логину в чате)</small>','top.useMagicNow('+pid+');',1,1,1);
}
function useMagicNow(id)
{
top.frames['main'].use_on_pers = document.getElementById('usePriemLogin').value;
top.frames['main'].magic_use = id;
top.frames['main'].reflesh();
}
function smiles()
{
var x = document.body.clientWidth - 200;
var y = document.body.clientHeight - 500;
var sFeatures = 'dialogLeft:'+x+'px;dialogTop:'+y+'px;dialogHeight:510px;dialogWidth:400px;help:no;status:no;unadorned:yes';
if (document.all && document.all.item && !window.opera && !document.layers) {
window.showModelessDialog("smiles.html", window, sFeatures);
} else {
window.open("smiles.html", "", "left="+x+",top="+y+",location=no,scrollbars=yes,resizable=yes,width=200,height=500");
}
}
function useInLOck2(id,r)
{
top.frames['main'].location = 'main.php?edit=1&otdel='+r+'&addPassInvNew='+top.document.getElementById('inPassLock'+id).value+'&use_sid='+id+'';
}
function usePaper(id,r)
{
if(id>0)
{
top.openNewWindow(1,id,'Использовать предмет','<div align="left">Введите текст:</div><input style="width:244px; margin:5px;" id="addTxtPaper'+id+'" class="inpt2" type="text" value="">','top.addTxtPaper('+id+','+r+');',1);
}
}
function addTxtPaper(id,r)
{
top.frames['main'].location = 'main.php?edit=1&otdel='+r+'&add_txt='+top.document.getElementById('addTxtPaper'+id).value+'&itmID='+id+'';
}
var sd4key = '';
function drop(id,img,name,x,date,r,fdfdf)
{
if(id>0)
{
top.openNewWindow(1,id,'Выбросить предмет?',date,'top.del('+id+','+r+');',1);
}
}
function useiteminv(id,img,name,x,date,r)
{
if(id>0)
{
top.openNewWindow(1,id,'Подтверждение',date,'top.useitminv('+id+','+r+');',1);
}
}
function hlam(id,img,name,x,date,r)
{
if(id>0)
{
top.openNewWindow(1,id,'Выбросить хлам?',date,'top.hlamdel('+id+','+r+');',1);
}
}
function hlamdel(id,r)
{
top.frames['main'].location = 'main.php?edit=1&otdel='+r+'&drop_hlam=1';
}
function useitminv(id,r)
{
top.frames['main'].location = 'main.php?inv=1&otdel='+r+'&use_pid='+id+'';
}
function btlUseItems(id,img,name,x,date)
{
if(id>0)
{
top.openNewWindow(1,id,'Подтверждение','<span style="padding-left:20px; padding-right:20px;">Использовать сейчас?</span><br>','top.btlUse('+id+');',1);
}
}
function btlUse(id)
{
alert('Ошибка использования.');
}
function btlclearlog()
{
top.openNewWindow(1,'778_clear_btl','Подтверждение','<span style="padding-left:20px; padding-right:20px;">Очистить лог боя?</span><br>','top.btlclearlogSt();',1);
}
function priemOnUser(pr,id,nm)
{
if(id==1)
{
top.openNewWindow(1,'779_use_priem','Используем &quot;'+nm+'&quot;','<div style="font-size:12px;"><div style="margin-left:5px;">Введите логин противника</div><div align="center"><input id="useOnLogin" name="useOnLogin" style="width:98%;" class="inpt2"></div></div>(Можно кликнуть на логин в чате)','top.usePriemNow(top.document.getElementById(\'useOnLogin\').value,'+pr+');',2);
}
}
function usePriemNow(lgn,id)
{
top.frames['main'].use_on_pers = lgn;
top.frames['main'].usepriem(id,1);
}
function btlclearlogSt()
{
if(top.document.getElementById('chsee2')!=undefined)
{
top.document.getElementById('chsee2').innerHTML = '';
}
if(top.document.getElementById('chsee3')!=undefined)
{
top.document.getElementById('chsee3').innerHTML = '';
}
}
function smena1()
{
top.openNewWindow(1,'778_smena','Смена противника','<span style="padding-left:20px; padding-right:20px;">Введите логин персонажа:</span><br><br><input id="smenaLogin" class="inpt2"><br><small style="color:grey;">(можно щелкнуть по логину в чате)</small>','top.smena2(top.document.getElementById(\'smenaLogin\').value);',1);
toInpLogin = 'smenaLogin';
}
function smena2(login)
{
//var i = 0;
//while(i<=65)
//{
// login = login.replace(new RegExp(ruD[i],'g'),ruC[ruD[i]]);
// i++;
//}
top.frames['main'].smena_login = login;
top.frames['main'].reflesh();
}
function del(id,r)
{
top.frames['main'].location = 'main.php?inv=1&otdel='+r+'&delete='+id+'&sd4='+sd4key+'';
}
function unstack(id,img,name,x,date,r)
{
if(id>0)
{
top.openNewWindow(1,'uns'+id,'Разделить предмет?',date+'<br><div align="left">Кол-во: <input class="inpt1" id="unsIMP'+id+'" value="1" style="width:70px;"></div>','top.uns('+id+','+r+');',1);
}
}
function uns(id,r)
{
top.frames['main'].location = 'main.php?edit=1&otdel='+r+'&unstack='+id+'&x='+top.document.getElementById("unsIMP"+id).value;
}
function delWin(divId,tsa)
{
if(document.getElementById(divId)!=undefined)
{
if(divId=='778_smena')
{
toInpLogin = '';
}
if(tsa==1)
{
document.getElementById(divId+"_title").className="windowsmf_css1_title_active";
setTimeout('delWin("'+divId+'",2)',50);
}else if(tsa==2){
document.getElementById(divId+"_title").className="windowsmf_css1_title_active2";
document.getElementById(divId+"_main").className="windowsmf_css1_main_active2";
document.getElementById(divId).className="windowsmf_css1_active2";
setTimeout('delWin("'+divId+'",3)',50);
}else if(tsa==3){
elem = document.getElementById(divId);
document.getElementById('windows').removeChild(elem);
}
}
}
function AutoSizeIFrame(IFrameId,td)
{
var c1,c2;
c1 = document.getElementById(IFrameId);
c2 = document.getElementById(td);
c1.style.height = c2.clientHeight+"px";
}
function sizeFrameX(fr)
{
var size = top.document.getElementById(fr).clientWidth;
return size;
}
function sizeFrameY(fr)
{
var size = top.document.getElementById(fr).clientHeight;
return size;
}
function getchH() { return 'test'}
function getchY(d){ return d.self.pageYOffset || (d.document.documentElement && d.document.documentElement.scrollTop) || (d.document.body && d.document.body.scrollTop);}
function getchX(d){ return d.self.pageXOffset || (d.document.documentElement && d.document.documentElement.scrollLeft) || (d.document.body && d.document.body.scrollLeft);}
var newmsgh = 0;
function getBounds(element)
{
var left = element.offsetLeft;
var top = element.offsetTop;
for (var parent = element.offsetParent; parent; parent = parent.offsetParent)
{
left += parent.offsetLeft - parent.scrollLeft;
top += parent.offsetTop - parent.scrollTop
}
return {left: left, top: top, width: element.offsetWidth, height: element.offsetHeight};
}
var actmd = 0;
function GoGoGoUp()
{
var element3 = document.getElementById('menuD');
var bounds3 = getBounds(element3);
var element4 = document.getElementById('menuimg');
var bounds4 = getBounds(element4);
var m = document.getElementById('menuD');
if(actmd<bounds3.height)
{
actmd = actmd+5;
m.style.top = bounds4.top-actmd+"px";
if(bounds4.top+bounds4.height==m.style.top)
{
}else{
setTimeout('GoGoGoUp()',11);
}
}else{
document.getElementById('menuimg').style.display = 'none';
document.getElementById('menuimg2').style.display = '';
}
}
function GoGoGoDown()
{
var element3 = document.getElementById('menuD');
var bounds3 = getBounds(element3);
var element4 = document.getElementById('menuimg2');
var bounds4 = getBounds(element4);
var m = document.getElementById('menuD');
if(actmd>-100)
{
actmd = actmd-5;
m.style.top = bounds4.top-actmd+"px";
if(bounds4.top+bounds4.height-bounds4.top-actmd>80)
{
m.style.display = 'none';
actmd = 0;
document.getElementById('menuimg2').style.display = 'none';
document.getElementById('menuimg').style.display = '';
}else{
setTimeout('GoGoGoDown()',11);
}
}
}
function openNewWindow(type,id,title,dates,action,x,pos,ttlal)
{
if(!document.getElementById('windowMF_'+id))
{
//создаем
if(type==1)
{
//Форма типа Да \ Нет
dates = '<small>'+dates+'<div align="center"><br><input type="button" onClick="'+action+'; delWin(\'windowMF_'+id+'\',3); return false;" class="yesbtn" value="Да" unselectable="on" style="user-select: none; -o-user-select:none; -khtml-user-select: none; -moz-user-select: none;" unselectable onselectstart="return false"> &nbsp; <input type="button" onClick="delWin(\'windowMF_'+id+'\',3); return false;" style="user-select: none; -o-user-select:none; -khtml-user-select: none; -moz-user-select: none;" unselectable onselectstart="return false" class="yesbtn" value="Нет"></small></div>';
}else if(type==2)
{
//Форма типа Отмена
dates = ''+dates+'<br><center> <input type="button" onClick="delWin(\'windowMF_'+id+'\',3); return false;" class="yesbtn" style="user-select: none; -o-user-select:none; -khtml-user-select: none; -moz-user-select: none;" unselectable onselectstart="return false" value="Отмена"></center>';
}
if(x==1)
{
ttlals = '';
if(ttlal==1)
{
ttlals = 'text-align:left;';
}
title = '<div unselectable="on" style="user-select: none; -o-user-select:none; -khtml-user-select: none; -moz-user-select: none; width:inherit; '+ttlals+'" unselectable onselectstart="return false">'+title+'<div style="float:right;"><a onClick="delWin(\'windowMF_'+id+'\',3); return false;" href="#" title="Закрыть"><img style="margin-left:15px;" src="http://'+top.config['img']+'/i/clear.gif"></a></div></div>';
}
//document.print('<div style="height:500px;width:500px;background-color:red;position:absolute;"></div>');
var wind = '<div onmousedown=\'drag_object(event,"windowMF_'+id+'");\' id="windowMF_'+id+'_title" class="windowsmf_css1_title" style="padding-left:10px;"><b>'+title+'</b></div><div unselectable="on" style="-moz-user-select:none; -webkit-user-select:none; user-select:none;" id="windowMF_'+id+'_main" class="windowsmf_css1_main">'+dates+'</div>';
wind = '<table unselectable="on" style="user-select: none; -o-user-select:none; -khtml-user-select: none; -moz-user-select: none;" id="windowMF_'+id+'" unselectable onselectstart="return false" class="windowsmf_css1" border="0" cellpadding="0" cellspacing="0"><tr><td width="5" height="7" background="http://'+top.config['img']+'/i/bneitral_03.gif"></td><td background="http://'+top.config['img']+'/i/bneitral_05.gif"></td><td background="http://'+top.config['img']+'/i/bneitral_03.gif"></td></tr><tr><td background="http://'+top.config['img']+'/i/bneitral_17.gif"></td><td>'+wind+'</td><td background="http://'+top.config['img']+'/i/bneitral_19.gif"></td></tr><tr><td background="http://'+top.config['img']+'/i/bneitral_03.gif"></td><td background="http://'+top.config['img']+'/i/bneitral_05.gif"></td><td width="5" height="7" background="http://'+top.config['img']+'/i/bneitral_03.gif"></td></tr></table>'
document.getElementById('windows').innerHTML = document.getElementById('windows').innerHTML + (wind);
var nw = document.getElementById('windowMF_'+id);
var nwt = document.getElementById('windowMF_'+id+'_title');
serPositionWin("windowMF_"+id,pos);
}else{
//обновляем
}
}
function serPositionWin(obj,pos)
{
obj = document.getElementById(obj);
var winX=(window.innerWidth)?window.innerWidth:((document.all)?document.body.offsetWidth:null);
var winY=(window.innerHeight)?window.innerHeight:((document.all)?document.body.offsetHeight:null);
var objH=obj.offsetHeight;
var objW=obj.offsetWidth;
if(pos==1)
{
obj.style.left = 300+"px";
obj.style.top = 150+"px";
}else{
obj.style.left = Math.floor(winX/2-objW/2)+"px";
obj.style.top = Math.floor(winY/2-objH/2)+"px";
}
}
function drag_object(evt,obj)
{
if(obj!=undefined)
{
obj = document.getElementById(obj);
}
if(obj!=undefined)
{
evt = evt || window.event;
obj.clicked = true;
obj.mousePosX = evt.clientX;
obj.mousePosY = evt.clientY;
document.onmouseup = function(evt)
{
if(document.getElementById(obj.id+'_title')!=undefined)
{
obj.clicked = false;
obj.style.zIndex = 1000;
document.getElementById('glob').style.display = 'none';
document.getElementById(obj.id+'_title').className="windowsmf_css1_title";
}
}
var winX=(window.innerWidth)?window.innerWidth:
((document.all)?document.body.offsetWidth:null);
var winY=(window.innerHeight)?window.innerHeight:
((document.all)?document.body.offsetHeight:null);
if(obj.clicked==true && obj!=undefined)
{
document.getElementById('glob').style.display = '';
document.onmousemove = function(evt)
{
evt = evt || window.event;
if(obj.clicked==true)
{
document.getElementById(obj.id+'_title').className="windowsmf_css1_title_active";
posLeft = !obj.style.left ? obj.offsetLeft : parseInt( obj.style.left );
posTop = !obj.style.top ? obj.offsetTop : parseInt( obj.style.top );
mousePosX = evt.clientX;
mousePosY = evt.clientY;
if(posLeft + mousePosX - obj.mousePosX>5 && obj.offsetWidth + posLeft + mousePosX - obj.mousePosX<winX-5)
{
obj.style.left = posLeft + mousePosX - obj.mousePosX + 'px';
}
if(posTop + mousePosY - obj.mousePosY>5 && obj.offsetHeight + posTop + mousePosY - obj.mousePosY<winY-5)
{
obj.style.top = posTop + mousePosY - obj.mousePosY + 'px';
}
obj.mousePosX = mousePosX;
obj.mousePosY = mousePosY;
obj.style.zIndex = 1111;
}
}
}else{
document.getElementById('glob').style.display = 'none';
document.getElementById(obj.id+'_title').className="windowsmf_css1_title";
}
}
}
var lafstReg = new Array();
var timerHP = 0;
var lasttimeHP = 0;
function startHpRegen(f,id,hpnow,hpmax,mpnow,mpmax,sec_h,sec_m,speed_hp,speed_mp,news,tmr)
{
var d = document;
if(news!=0)
{
lasttimeHP++; tmr = lasttimeHP; timerHP = tmr;
}
if(news==1 && tt1!=undefined)
{
clearTimeout(tt1);
}
if(lasttimeHP!=tmr)
{
}else{
if(f=='top')
{
d = top.document;
}else if(f=='main')
{
d = top.frames['main'].document;
}
if(d!=undefined && lafstReg[id]!=undefined && lafstReg[id]!=0)
{
//здоровье
var h1 = d.getElementById('vhp'+id);
if(h1!=undefined)
{
var h2 = d.getElementById('lhp'+id);
if(h2!=undefined)
{
//Восстанавливаем НР
var newHP = '';
newHP = sec_h*speed_hp;
if(newHP!=0)
{
hpnow += newHP;
if(hpnow<0)
{
hpnow = 0;
}
if(hpnow>hpmax)
{
hpnow = hpmax;
}
h1.innerHTML = ' '+Math.floor(hpnow)+'/'+hpmax+'';
if(Math.floor(hpnow/hpmax*120)<1)
{
h2.className = 'hp_none';
}
if(Math.floor(hpnow/hpmax*120)>0)
{
h2.className = 'hp_1';
}
if(Math.floor(hpnow/hpmax*120)>32)
{
h2.className = 'hp_2';
}
if(Math.floor(hpnow/hpmax*120)>65)
{
h2.className = 'hp_3';
}
if(Math.floor(hpnow/hpmax*120)<=120)
{
h2.style.width = Math.floor(hpnow/hpmax*120)+'px';
}
}
}
}
//мана
var m1 = d.getElementById('vmp'+id);
if(m1!=undefined)
{
var m2 = d.getElementById('lmp'+id);
if(m2!=undefined)
{
//Восстанавливаем MP
var newMP = '';
newMP = sec_m*speed_mp;
if(newMP!=0)
{
mpnow += newMP;
if(mpnow<0)
{
mpnow = 0;
}
if(mpnow>mpmax)
{
mpnow = mpmax;
}
m1.innerHTML = ' '+Math.floor(mpnow)+'/'+mpmax+'';
if(Math.floor(mpnow/mpmax*120)<1)
{
m2.className = 'hp_none';
}else{
m2.className = 'hp_mp';
}
if(Math.floor(mpnow/mpmax*120)<=120)
{
m2.style.width = Math.floor(mpnow/mpmax*120)+'px';
}
}
}
}
lafstReg[id] = 0+lafstReg[id]+1;
var tt1 = setTimeout('top.startHpRegen("'+f+'",'+id+','+hpnow+','+hpmax+','+mpnow+','+mpmax+',1,1,'+speed_hp+','+speed_mp+',0,'+timerHP+');',1000);
}
if(lafstReg[id]==0 || lafstReg[id]==undefined)
{
lafstReg[id] = 0+lafstReg[id]+1;
var tt1 = setTimeout('top.startHpRegen("'+f+'",'+id+','+hpnow+','+hpmax+','+mpnow+','+mpmax+',1,1,'+speed_hp+','+speed_mp+',0,'+timerHP+');',1000);
}
}
}
function filterChat()
{
if(top.document.F1.fi!=undefined)
{
if(top.document.F1.fi.value==0)
{
top.document.F1.fi.value = 1;
}else{
top.document.F1.fi.value = 0;
}
}
}
function test(event)
{
if (!event)
{
event = window.event;
}
}
function nameRoom(nm)
{
top.document.getElementById('roomName').innerHTML = '<FONT style="FONT-SIZE: 10pt; COLOR: #8f0000;"><B>'+nm+'</B></FONT>';
lastRoom = nm;
}
var lastData = '';
var lastRoom = '';
var alignName = new Array();
alignName[0] = '';
alignName[1] = 'Свет';
alignName[2] = 'Хаос';
alignName[3] = 'Тьма';
alignName[7] = 'Нейтрал';
alignName[50] = 'Алхимик';
alignName[100] = 'Ангел';
function alignNames(nm)
{
var an = '';
if(nm>1 && nm<2)
{
an = 'Паладин';
}else if(nm>3 && nm<4)
{
an = 'Тарман';
}else{
an = alignName[nm];
}
if(an == undefined)
{
an = '';
}
return an;
}
function refleshOnline(data)
{
lastData = data;
top.document.getElementById('onlineReflesh').innerHTML = '';
var d = data.split('|');
var i = 0;
var j = 0;
var k = 0;
var r = '';
var s = 0;
while(i!=-1)
{
if(d[i]!=undefined)
{
if(j==0)
{
s = k*14;
if(d[s+1]!=undefined)
{
var prmb = '';
var pcl = '';
if(d[s+4]>0)
{
pcl = '<a href="#"><img src="http://'+top.config['img']+'/i/clan/'+d[s+12]+'" title="'+d[s+13]+'"></a>';
}
if(top.level>0)
{
var btlmb = '';
if(d[s+7]>0)
{
btlmb = '1';
}
prmb = '<img onClick="top.addTo(\''+d[s+1]+'\',\'private\');" style="cursor:pointer;" src="http://'+config['img']+'/i/lock'+btlmb+'.gif" title="Приват">';
}
var efs = '';
if(d[s+5]>0)
{
efs += ' <img src="http://'+top.config['img']+'/i/sleep2.gif" title="Заклятие молчания">';
}
if(d[s+9]!=0)
{
pcl += ' <small onMouseOver=\'top.title("'+d[s+9]+'",event,1,"online");\' onMouseOut="top.ct(event);" onMouseDown="top.ct(event);"><b>afk</b></small> ';
}else if(d[s+10]!=0)
{
pcl += ' <small onMouseOver=\'top.title("'+d[s+10]+'",event,1,"online");\' onMouseOut="top.ct(event);" onMouseDown="top.ct(event);"><b>dnd</b></small> ';
}
r += '<font id="u'+d[s]+'">'+prmb+'<img title="'+top.alignNames(d[s+3])+'" src="http://'+top.config['img']+'/i/align/align'+d[s+3]+'.gif">'+pcl+'<a style="cursor:pointer;" title="'+d[s+1]+'" onClick="top.addTo(\''+d[s+1]+'\',\'to\');return false;">'+d[s+1]+'</a>['+d[s+2]+']<a href="inf.php?'+d[s]+'" target="_blank" title="Инф. о '+d[s+1]+'"><img src="http://'+config['img']+'/i/inf_'+d[s+8]+'.gif" width="12" height="11"></a>'+efs+'</font><br>';
}
j++;
}else if(j<12)
{
j++;
}else{
j = 0;
k++;
}
}else{
i = -2;
}
i++;
}
top.document.getElementById('onlineReflesh').innerHTML = ''+r+'';
}
function hint(txt,e,f)
{
var d = top.document.getElementById('persinfo');
if(d!=undefined)
{
var s = d.style;
s.display = '';
}
}
function c()
{
var d = top.document.getElementById('persinfo');
if(d!=undefined)
{
var s = d.style;
s.display = 'none';
d.innerHTML = '';
}
}
function mousePageXY(e)
{
var x = 0, y = 0;
if (e.pageX || e.pageY)
{
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
return {"x":x, "y":y};
}
var doTest;
function MBcMenu()
{
T_cm = setTimeout("if(doTest){ top.infoMenuClose(1); clearTimeout(T_cm);}", 100);
}
function infoMenu(u,e,f)
{
if (!e) e = window.event;
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('glob');
if(d!=undefined)
{
var dptop = -5;
var dpleft = -5;
var dp = top;
var s = d.style;
d2.style.display = '';
d.className = 'topusermenu';
s.display = '';
var obtop = mousePageXY(e)['y']+dptop;
if(getNameBrouser()=='msie')
{
obtop -= dp.document.body.scrollTop;
}else{
obtop -= dp.document.documentElement.scrollTop+dp.document.body.scrollTop;
}
var obleft = mousePageXY(e)['x']+dpleft;
d.style.top = obtop+'px';
d.style.left = obleft+'px';
d.innerHTML = '<DIV onmouseover="top.doTest = false;" onmouseout="top.doTest = true; top.MBcMenu();">'
+'<div onClick="top.addTo(\''+u+'\',\'to\'); infoMenuClose(4);" class="topusermenuBtn">TO</div>'
+'<div onClick="top.addTo(\''+u+'\',\'private\'); infoMenuClose(4);" class="topusermenuBtn">PRIVATE</div>'
+'<div onClick="window.open(\'inf.php?login='+u+'\'); infoMenuClose(4);" class="topusermenuBtn">INFO</div>'
+'<div onClick=" infoMenuClose(4);" class="topusermenuBtn">COPY</div>'
+'</DIV>';
var bdx = document.body.clientWidth;
var bdy = document.body.clientHeight;
var obx = d.clientWidth;
var oby = d.clientHeight;
var ots = bdy-obtop-oby;
var ols = bdx-obleft-obx;
if(ots<10)
{
obtop = bdy-10-oby;
d.style.top = obtop+'px';
}
if(ols<10)
{
obleft = bdx-10-obx;
d.style.left = obleft+'px';
}
}
}
function infoMenuClose(id)
{
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('glob');
if(d!=undefined)
{
if(id>0 && id<5)
{
d.className = 'topusermenu inviseMen'+id;
T_mn = setTimeout('top.infoMenuClose('+(id+1)+')',30);
}else if(id==5)
{
var s = d.style;
s.display = 'none';
d2.style.display = 'none';
d.innerHTML = '';
d.className = '';
clearTimeout(T_mn);
}
}
}
function speedChat()
{
if(newTimeReflesh==20)
{
newTimeReflesh = 60;
chatReflesh = 60
}else if(newTimeReflesh==60)
{
newTimeReflesh = -1;
chatReflesh = -1;
}else if(newTimeReflesh==-1)
{
newTimeReflesh = 20;
chatReflesh = 20;
}
}
function refleshChat()
{
if(top!=undefined)
{
if(chatReflesh<1)
{
if(newTimeReflesh>0 && typeof top.window['autoAllChat'] == 'function')
{
top.autoAllChat();
chatReflesh = newTimeReflesh;
}
}
chatReflesh--;
}
setTimeout('refleshChat()',1000);
}
function sendMsg()
{
if(top.document.getElementById('chBtn2').className=='chatBtn2_1')
{
top.document.getElementById('chBtn2').className = 'chatBtn2_2';
top.document.getElementById('sbm').click();
}
}
function seeGoodMsg(id)
{
top.lastMessage = id;
var mv = top.document.getElementById('mval');
if(mv!=undefined)
{
mv.value = id;
}
}
function getFrW(fr)
{
return fr.document.compatMode=='CSS1Compat' && !fr.window.opera?fr.document.documentElement.clientWidth:fr.document.body.clientWidth;
}
function getFrH(fr)
{
return fr.document.compatMode=='CSS1Compat' && !fr.window.opera?fr.document.documentElement.clientHeight:fr.document.body.clientHeight;
}
function getFrScH(fr)
{
return fr.self.pageYOffset || (fr.document.documentElement && fr.document.documentElement.scrollTop) || (fr.document.body && fr.document.body.scrollTop);
}
function getFrScW(fr)
{
return fr.self.pageXOffset || (fr.document.documentElement && fr.document.documentElement.scrollLeft) || (fr.document.body && fr.document.body.scrollLeft);
}
function getDcH(fr)
{
return (fr.document.body.scrollHeight > fr.document.body.offsetHeight)?fr.document.body.scrollHeight:fr.document.body.offsetHeight;
}
function getDcW(fr)
{
return (fr.document.body.scrollWidth > fr.document.body.offsetWidth)?fr.document.body.scrollWidth:fr.document.body.offsetWidth;
}
var cc = 0;
var newMsgs = 0;
var lastHw = 0;
var fst = 1;
var pixScroll = 1000;
function SmartScroll(cc)
{
startScrollChat('chat',pixScroll);
}
function startScrollChat(id,w)
{
sCht = top.document.getElementById(id);
sCh = top.document.getElementById('chat_see');
if(sCht!=undefined && nowraz!=3 && nowraz!=4 && nowraz!=5)
{
maxttt = sCh.offsetHeight-(sCht.scrollTop+sCht.offsetHeight);
if(maxttt<150)
{
sCht.scrollTop += 1;
w -= 1;
if(sCh.offsetHeight>sCht.scrollTop+sCht.offsetHeight)
{
setTimeout('startScrollChat("'+id+'",'+(0+w)+')',10);
}
}else if(fst==1)
{
fst = 0;
sCht.scrollTop = sCh.offsetHeight;
}
}
}
var map_en = new Array('s`h','S`h','S`H','s`Х','sh`','Sh`','SH`',"'o",'yo',"'O",'Yo','YO','zh','w','Zh','ZH','W','ch','Ch','CH','sh','Sh','SH','e`','E`',"'u",'yu',"'U",'Yu',"YU","'a",'ya',"'A",'Ya','YA','a','A','b','B','v','V','g','G','d','D','e','E','z','Z','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','r','R','s','S','t','T','u','U','f','F','h','H','c','C','`','y','Y',"'")
var map_ru = new Array('сх','Сх','СХ','сХ','щ','Щ','Щ','ё','ё','Ё','Ё','Ё','ж','ж','Ж','Ж','Ж','ч','Ч','Ч','ш','Ш','Ш','э','Э','ю','ю','Ю','Ю','Ю','я','я','Я','Я','Я','а','А','б','Б','в','В','г','Г','д','Д','е','Е','з','З','и','И','й','Й','к','К','л','Л','м','М','н','Н','о','О','п','П','р','Р','с','С','т','Т','у','У','ф','Ф','х','Х','ц','Ц','ъ','ы','Ы','ь')
function addSm(i)
{
top.getFocus('','text');
top.document.F1.text.value += ' :'+i+': ';
}
function convert(str)
{
var p1 = new RegExp("private\\s*\\[(.*?)\\]","");
var t1 = new RegExp("to\\s*\\[(.*?)\\]","");
var newstr = '';
if(str.match(p1)!=null)
{
newstr = str.match(p1)[0];
str = str.replace(str.match(p1)[0],'');
}else if(str.match(t1)!=null)
{
newstr = str.match(t1)[0];
str = str.replace(str.match(t1)[0],'');
}
for(var i=0;i<map_en.length;++i) while(str.indexOf(map_en[i])>=0) str = str.replace(map_en[i],map_ru[i]);
newstr += str;
return newstr;
}
function getNameBrouser()
{
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
return "msie"
}
if (ua.indexOf("opera") != -1) {
return "opera"
}
if (ua.indexOf("gecko") != -1) {
return "gecko";
}
if (ua.indexOf("safari") != -1) {
return "safari";
}
if (ua.indexOf("konqueror") != -1) {
return "konqueror";
}
return "unknown";
}
function chatBtnClick(id,clss,maxch,act,ttl)
{
if(chatBtnsDate[id]==undefined)
{
chatBtnsDate[id] = 1;
}
chatBtnsDate[id]++;
if(chatBtnsDate[id]>maxch)
{
chatBtnsDate[id] = 1;
}
var btn = top.document.getElementById(id);
if(btn!=undefined)
{
if(ttl!=null)
{
btn.title = ttl[chatBtnsDate[id]];
}
btn.className = clss+chatBtnsDate[id];
if(act!='')
{
eval(act);
}
}
}
/* ============================================================[ frames.js ] ============================= */
function goReSizeIframe()
{
}
var lastMsgIds = 0;
function addMessage(id,time,to,from,type,ch,text,s,color)
{
if(id>0 || id==-1)
{
if(top.document.getElementById('chat')!=undefined)
{
lastMsgIds = id;
var chat = top.document.getElementById('chsee'+ch);
if(chat!=undefined && (top.document.getElementById('message'+id)==undefined || id==-1))
{
var forYou = 0,fromType = 'to',ftps = '',ftpsTo = '',ftpsToUt = '',timeClass = 'date'; text = '<span style="color:'+color+'">'+text+'</span>';
if(from!='')
{
if(type==3 && to!='')
{
fromType = 'private';
}
ftps += '[<a onMouseDown="top.loginGo(\''+from+'\',event);" oncontextmenu="top.infoMenu(\''+from+'\',event,\'chat\'); return false;" style="cursor:pointer;" title="'+from+'" onClick="top.addTo(\''+from+'\',\''+fromType+'\');return false;">'+from+'</a>]';
}
blnd = '';
if(to!='')
{
if(from.toLowerCase()==top.login.toLowerCase() && type==3)
{
forYou++;
}
var arr = to.split(',');
var i = 0,arrLogin = '';
var newto = '';
while(i!=-1)
{
if(arr[i]!=undefined)
{
newto += trim(arr[i]);
if(arr[i+1]!=undefined)
{
newto += ', ';
}
if(arr[i]!='' && trim(arr[i].toLowerCase())==top.login.toLowerCase())
{
forYou = 1; blnd = 'font-weight:bold;';
}
}else{
i = -2;
to = newto;
}
i++;
}
if(type==1)
{
ftpsTo = '['+to+']';
ftpsTo = '<span style="color:'+color+';'+blnd+'"> to '+ftpsTo+'</span>';
}else if(type==3)
{
ftpsToU = ''; ftpsToUt = '';
var arr = to.split(',');
var i = 0,arrLogin = '';
while(i!=-1)
{
if(arr[i]!=undefined)
{
if(arr[i]!='')
{
arr[i] = trim(arr[i]);
if(arr[i].toLowerCase()==top.login.toLowerCase())
{
arrLogin = from;
}else{
arrLogin = arr[i];
}
ftpsToU += '<b onMouseDown="top.loginGo(\''+arrLogin+'\',event);" title="'+arrLogin+'" oncontextmenu="top.infoMenu(\''+arrLogin+'\',event,\'chat\'); return false;" style="cursor:pointer;" onClick="top.addTo(\''+arrLogin+'\',\'private\');">'+arr[i]+'</b>';
ftpsToUt += arrLogin;
if(arr[i+1]!='' && arr[i+1]!=undefined)
{
ftpsToU += ', ';
ftpsToUt += ',';
}
}
}else{
i = -2;
}
i++;
}
ftpsTo = ' </span><span class="private"><span onClick="top.addToMany(\''+ftpsToUt+'\',\'private\');" style="cursor:pointer;">private [ </span>'+ftpsToU+' <span onClick="top.addToMany(\''+ftpsToUt+'\',\'private\');" style="cursor:pointer;">]</span></span>';
}
ftps += ftpsTo;
}
if(type==10 || type==11 || type==12)
{
var zmlogin = new RegExp("\\[login:(.*?)\\]","");
var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");
if(text.match(zmlogin)!=null)
{
zmlogin = text.match(zmlogin)[1];
text = text.replace('[login:'+zmlogin+']','<a onMouseDown="top.loginGo(\''+zmlogin+'\',event);" oncontextmenu="top.infoMenu(\''+zmlogin+'\',event,\'chat\'); return false;" title="'+zmlogin+'" style="cursor:pointer;" onClick="top.addTo(\''+zmlogin+'\',\'to\');">'+zmlogin+'</a>');
}
if(text.match(reflcd)!=null)
{
reflcd = text.match(reflcd)[1];
text = text.replace('[reflesh_main_zv_priem:'+reflcd+']','');
if(top.frames['main'].zv_Priem!=undefined && top.frames['main'].zv_Priem != reflcd && reflcd>0)
{
top.frames['main'].location = top.frames['main'].location;
}
}
}
if(s==1 || forYou==1)
{
timeClass = 'date2';
}
if(type==12)
{
timeClass = 'date1';
}
if(type==21)
{
ftps = '<i><a onMouseDown="top.loginGo(\''+from+'\',event);" oncontextmenu="top.infoMenu(\''+from+'\',event,\'chat\'); return false;" title="'+from+'" style="cursor:pointer;" onClick="top.addTo(\''+from+'\',\'to\');">'+from+'</a></i>';
var mblogin = new RegExp("\\[login:(.*?)\\]","");
text = text.replace('[loginfrom]',ftps);
if(text.match(mblogin)!=null)
{
mblogin = text.match(mblogin)[1];
text = text.replace('[login:'+mblogin+']','<i><a onMouseDown="top.loginGo(\''+mblogin+'\',event);" oncontextmenu="top.infoMenu(\''+mblogin+'\',event,\'chat\'); return false;" title="'+mblogin+'" style="cursor:pointer;" onClick="top.addTo(\''+mblogin+'\',\'to\');">'+mblogin+'</a></i>');
}
text = '<i>'+text+'</i>';
}
if(forYou==1 && from.toUpperCase()!=top.login.toUpperCase() && top.snd>0)
{
top.window.document.Sound.SetVariable("Sndplay",1);
}
if(type==10)
{
ftps += '<b style="color:red;">Внимание!</b>';
}
chat.innerHTML += '<font id="message'+id+'" class="message"><span class="'+timeClass+'">'+time+'</span> '+ftps+' '+text+'<br></font>';
}
}
}
}
function playSound(id,ddd)
{
if(!ddd)
{
ddd = 1;
}
if(top.snd>ddd)
{
top.window.document.Sound.SetVariable("Sndplay",id);
}
}
function changeni(nm)
{
}
function addToMany(users,tp)
{
var arr = users.split(',');
var i = arr.length;
while(i>=0)
{
if(arr[i]!=undefined)
{
top.addTo(arr[i],tp);
}
i--;
}
}
function trim(s)
{
return rtrim(ltrim(s));
}
function ltrim(s)
{
return s.replace(/^\s+/, '');
}
function rtrim(s)
{
return s.replace(/\s+$/, '');
}
function addTo(login,type2)
{
var loginaddT = login;
top.window.document.getElementById('text').focus();
var s=top.document.getElementById('text').value;
var reg555 = new RegExp("private\\s*\\[(.*?)\\]","");
var reg551 = new RegExp("to\\s*\\[(.*?)\\]","");
var test1 = s.match(reg555);
if(s.match(reg555)==null)
{
type = "to";
}else if(s.match(reg551)==null)
{
type = "private";
}
var type3 = 'to';
var reg2 = new RegExp(""+type+"(\\s*)\\[(.*?)\\]","");
var cs = s.replace(reg2,""+type+"$1[,$2,]");
var slogin = login.replace(/([\^.*{}$%?\[\]+|\/\(\)])/g,"\\$1");
var reg = new RegExp(""+type+"\\s*\\[.*,\\s*"+slogin+"\\s*,.*\\]","");
var result = '';
var reg3 = new RegExp(""+type+"\\s*\\[(.*?)\\]","");
while (res = s.match(reg3))
{
result += res[1]+',';
s = s.replace(reg3,'');
}
result = result.replace(/,$/,'');
var prar = result.split(',');
for (i=0;i<prar.length;i++)
{
prar[i] = prar[i].replace(/^\s+/,'');
prar[i] = prar[i].replace(/\s+$/,'');
}
var str = prar.join(', ');
if (str) login += ', ';
space = '';
if (!s.match(/^\s+/)) space = ' ';
var prob = '';
if (!cs.match(reg))
{
if(type2=='to')
{
if(test1!=null)
{
type2 = 'private';
}
}
s = type2+' ['+prob+''+login+str+''+prob+']'+space+s;
} else {
if(type3=='to')
{
type3 = "private";
}
s = type3+' ['+prob+''+str+''+prob+']'+space+s;
}
if(top.frames['main'].document.getElementById('logingo')!=undefined)
{
top.frames['main'].document.getElementById('logingo').value = loginaddT;
}else if(top.document.getElementById('dialogLoginInput')!=undefined)
{
top.document.getElementById('dialogLoginInput').value = loginaddT;
}else if(top.document.getElementById('useOnLogin')!=undefined)
{
top.document.getElementById('useOnLogin').value = loginaddT;
}else{
top.document.getElementById('text').value = s;
}
}
function clearChatLine()
{
if(top!=undefined)
{
var chat = top.document.getElementById('text');
if(chat!=undefined)
{
chat.value = '';
}
}
}
function clearChat()
{
var chat = top.document.getElementById('text');
if(chat.value=='')
{
if(confirm('Очистить окно чата?'))
{
if(chat_id==0 || chat_id==1)
{
document.getElementById('chsee'+chat_id).innerHTML = '';
}
}
}else{
clearChatLine();
}
}
function getFocus(i,j)
{
var fcc = '';
if(i=='')
{
fcc = top;
}else{
fcc = top.frames[i]
}
if(fcc!=undefined)
{
var fc = fcc.document.getElementById(j);
if(fc!=undefined)
{
fc.focus();
}
}
}
/* =======================================================[ кнопки меню ]================================================================ */
function seeBtns(id)
{
if(top.frames['main'].battle!=undefined)
{
smenabtn = 0;
if(top.frames['main'].battle)
{
var mbbtl = top.frames['main'].battle;
if(mbbtl==0 && document.getElementById('usbtn5').style.display=='')
{
if(nowraz>2 && battle!=1)
{
smenabtn = 1;
document.getElementById('chsee2').innerHTML = '';
document.getElementById('chsee3').innerHTML = '';
}else{
smenabtn = 0;
}
document.getElementById('usbtn3').style.display = 'none';
document.getElementById('usbtn4').style.display = 'none';
document.getElementById('usbtn5').style.display = 'none';
battle = 0;
}else{
if(mbbtl!=0){
if(nowraz!=3 && battle==0)
{
smenabtn = 2;
if(top.window.document.Sound!=undefined)
{
//top.phpaySound(2,0);
}
}else{
smenabtn = 0;
}
document.getElementById('usbtn3').style.display = '';
document.getElementById('usbtn4').style.display = '';
document.getElementById('usbtn5').style.display = '';
battle = mbbtl;
if(battle_log!=0 && battle_log!=battle)
{
document.getElementById('chsee2').innerHYML = '';
document.getElementById('chsee3').innerHYML = '';
battle_log = battle;
}
}
}
}else if(document.getElementById('usbtn5').style.display==''){
if(nowraz>2 && battle!=1)
{
smenabtn = 1;
document.getElementById('chsee2').innerHTML = '';
document.getElementById('chsee3').innerHTML = '';
}else{
smenabtn = 0;
}
document.getElementById('usbtn3').style.display = 'none';
document.getElementById('usbtn4').style.display = 'none';
document.getElementById('usbtn5').style.display = 'none';
battle = 0;
}
if(id==0)
{
var timergo = setTimeout("seeBtns(0);", 1000);
}
if(smenabtn!=0)
{
if(smenabtn==1)
{
//pressBtn(1);
}else{
pressBtn(3);
}
}
if(battle==0)
{
document.getElementById('chsee2').innerHTML = '';
document.getElementById('chsee3').innerHTML = '';
}
if(battle==0 && battle_now!=0)
{
if(nowraz==1){ } pressBtn(1); blueText(1);
}
battle_now = battle;
}else{
if(id==0)
{
var timergo = setTimeout("seeBtns(0);", 1000);
}
}
}
function usb(id,id2,tk)
{
if(document.getElementById(id+'db'+id2))
{
document.getElementById(id+'db'+id2).className = tk;
}
}
function allOff(id)
{
usb('l',1,'zbtn1l');
usb('c',1,'zbtn1c');
usb('r',1,'zbtn1r2');
usb('c',2,'zbtn1c');
if(battle==0)
{
usb('r',2,'zbtn1r');
}else{
usb('r',2,'zbtn1r2');
usb('r',3,'zbtn1r2');
usb('c',3,'zbtn1c');
usb('r',4,'zbtn1r2');
usb('c',4,'zbtn1c');
usb('r',5,'zbtn1r');
usb('c',5,'zbtn1c');
}
}
function seeChat(id)
{
i = 0;
while(i<=4)
{
if(document.getElementById('chsee'+i))
{
document.getElementById('chsee'+i).style.display = 'none';
}
i++;
}
if(id==1)
{
if(document.getElementById('chsee0'))
{
document.getElementById('chsee0').style.display = ''; chat_id = 0;
}
}else{
if(document.getElementById('chsee'+(id-1)))
{
document.getElementById('chsee'+(id-1)).style.display = ''; chat_id = id-1;
}
}
}
function pressBtn(id)
{
if(nowraz!=id)
{
nowraz = id;
seeBtns(1);
allOff(id);
seeChat(id);
if(id==1)
{
usb('l',1,'zbtn2l');
usb('c',1,'zbtn2c');
usb('r',1,'zbtn2r2');
top.document.getElementById('chat').scrollTop = 100000000;
}else if(id==2)
{
usb('r',1,'zbtn2r3');
usb('c',2,'zbtn2c');
if(battle==0)
{
usb('r',2,'zbtn2r');
}else{
usb('r',2,'zbtn2r2');
}
top.document.getElementById('chat').scrollTop = 100000000;
}else if(battle!=0)
{
if(id==3)
{
usb('r',2,'zbtn2r3');
usb('c',3,'zbtn2c');
usb('r',3,'zbtn2r2');
top.document.getElementById('chat').scrollTop = -100000000;
}else if(id==4)
{
usb('r',3,'zbtn2r3');
usb('c',4,'zbtn2c');
usb('r',4,'zbtn2r2');
top.document.getElementById('chat').scrollTop = -100000000;
}else if(id==5)
{
usb('r',4,'zbtn2r3');
usb('c',5,'zbtn2c');
usb('r',5,'zbtn2r');
}
}
}
}
function blueText(id)
{
if(nowraz!=1)
{
document.getElementById('blueTextmb').style.color = 'blue';
}else{
if(id==1)
{
if(nowraz==1)
{
document.getElementById('blueTextmb').style.color = '';
}
}
}
}
/* ==========[ Уникальные функции ] =============================================================================================================================================== */
//Перетаскивание логина
var mlto;
var mlto_Login;
var mlto_Act;
var fps = 0;
var nowLoginMove = 0;
var sX = null;
var sY = null;
function loginGo(lgn,event)
{
mlto_Login = lgn;
mlto = top.document;
if(!event)
{
event = window.event;
}
var obj = document.getElementById('dragLogin');
obj.innerHTML = '[0]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'+mlto_Login+'';
loginGoMove(event);
}
function loginGoMove(event)
{
if (!event)
{
event = window.event;
}
var obj = document.getElementById('dragLogin');
if(nowLoginMove==0)
{
Event.add(mlto, 'mousemove', loginGoMoveTest);
Event.add(mlto, 'mouseup', loginGoEnd);
nowLoginMove = 1;
}
var x,y;
x = event.clientX;
y = event.clientY;
if(sX==null)
{
sX = x;
}
if(sY==null)
{
sY = y;
}
if(x>sX+20 || y>sY+20 || x<sX-20 || y<sY-20 )
{
document.getElementById('glob').style.display = '';
obj.style.display = '';
}
obj.style.top = y-11+'px';
obj.style.left = x-33+'px';
}
function loginGoMoveTest(event)
{
if (!event)
{
event = window.event;
}
loginGoMove(event);
}
var movEndid = 0;
function loginGoEnd()
{
Event.remove(mlto, 'mousemove', loginGoMoveTest);
Event.remove(mlto, 'mouseup', loginGoEnd);
if(movEndid==0)
{
document.getElementById('dragLogin').className = 'dragLoginCss1';
}else if(movEndid==1)
{
document.getElementById('dragLogin').className = 'dragLoginCss2';
}else if(movEndid==2)
{
document.getElementById('dragLogin').className = 'dragLoginCss3';
}else if(movEndid==3)
{
document.getElementById('dragLogin').className = 'dragLoginCss4';
}else if(movEndid==4)
{
document.getElementById('dragLogin').className = 'dragLoginCss5';
}else if(movEndid==5)
{
document.getElementById('dragLogin').className = 'dragLoginCss6';
loginGoDie();
}
if(movEndid<5)
{
movEndid++; setTimeout('loginGoEnd()',15);
}else{
movEndid = 0;
document.getElementById('dragLogin').className = 'dragLoginCss';
}
}
function loginGoDie()
{
document.getElementById('glob').style.display = 'none';
Event.remove(mlto, 'mousemove', loginGoMoveTest);
nowLoginMove = 0;
var obj = document.getElementById('dragLogin');
Event.remove(mlto, 'mouseup', loginGoEnd);
obj.innerHTML = '';
obj.style.display = 'none';
obj.style.top = 0+'px';
obj.style.left = 0+'px';
sX = null; sY = null;
}