battles/js/main_096_ru2.js
2018-01-28 18:40:49 +02:00

142 lines
7.7 KiB
JavaScript

function close_hint(id) {
document.getElementById('hint'+id+'').style.visibility = 'hidden';
Hint3Name = '';
}
function DrawBar(title, id, flags, link_text, link){
var s ='<table width="100%" border=0 cellspacing=0 cellpadding=1 background="http://img.combats.com/i/icon/back.gif">' +
'<tr><td valign=top>';
var sz = 11, num = 1;
var rnd = Math.random();
s += '<a name="bar__'+id+'" href="?edit='+rnd+'&bar='+id+'&a=explore&is_open='+(1-(flags & 1))+'#bar_'+id+'">';
if (flags & 1) {
s+= '<img width='+sz+' height=9 alt="Скрыть" border=0 src="http://img.combats.com/i/icon/'+num+'minus.gif">';
} else {
s+= '<img width='+sz+' height=9 alt="Показать" border=0 src="http://img.combats.com/i/icon/'+num+'plus.gif">';
}
s += '</a> </td>';
s += '<td>&nbsp;</td><td bgcolor="#e2e0e0"><small>&nbsp;<b>'+title+':<b>&nbsp;</small></td>';
if (link_text){
s += '<td>&nbsp;</td><td bgcolor="#e2e0e0"><small>&nbsp;<a href="'+link+'">'+link_text+'</a>&nbsp;</small></td>';
}
s += '<td align=right valign=top width="100%">';
s += ' </td>';
s += '</tr></table>';
document.writeln(s);
}
function splitstack(title, script, img, st) {
var s;
if (st==1) {
s='<form action="'+script+'" method=POST name=slform><table border=0 width=100% cellspacing="0" cellpadding="2"><tr><td colspan=2>'+
'<TABLE width=100%><TD><IMG src="/i/sh/'+img+'"></TD><TD>\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u043F\u0440\u0435\u0434\u043C\u0435\u0442 <b>'+title+'</b></TABLE> \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E: <input type="text" name="qty" value="1"> </TD></TR><TR><TD width=50% align=left><INPUT TYPE="button" name="tmpname423" value="\u0414\u0430" style="width:70%" onclick="if (!top.is_qlaunch) { slform.submit(); } else { top.QLaunchQuery(slform.use.value); closehint3(); } "></TD><TD width=50% align=right><INPUT type=button style="width:70%" value="\u041D\u0435\u0442" onclick="closehint3();"></TD></TR></TABLE></FORM>';
s = crtmagic(0, '\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u043F\u0440\u0435\u0434\u043C\u0435\u0442?', s);
} else {
s='<form action="'+script+'" method=POST name=slform><table border=0 width=100% cellspacing="0" cellpadding="2"><tr><td colspan=2>'+
'<TABLE width=100%><TD><IMG src="/i/sh/'+img+'"></TD><TD>\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u043D\u0430 \u0440\u0430\u0432\u043D\u044B\u0435 \u0447\u0430\u0441\u0442\u0438 <b>'+title+'</b></TABLE> \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u0430\u0441\u0442\u0435\u0439: <input type="text" name="qty" value="2"> </TD></TR><TR><TD width=50% align=left><INPUT TYPE="button" name="tmpname423" value="\u0414\u0430" style="width:70%" onclick="if (!top.is_qlaunch) { slform.submit(); } else { top.QLaunchQuery(slform.use.value); closehint3(); } "></TD><TD width=50% align=right><INPUT type=button style="width:70%" value="\u041D\u0435\u0442" onclick="closehint3();"></TD></TR></TABLE></FORM>';
s = crtmagic(0, '\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u043D\u0430 \u0440\u0430\u0432\u043D\u044B\u0435?', s);
}
document.all("hint3").innerHTML = s;
document.all("hint3").style.visibility = "visible";
document.all("hint3").style.left = 200;
document.all("hint3").style.top = 100;
if (!("autofocus" in document.createElement("input"))) {document.all("tmpname423").focus();}
Hint3Name = name;
}
var sd4 = 0;
function foundmagictype (mtypes) {
if (mtypes) {
mtypes=mtypes+"";
if (mtypes.indexOf(',') == -1) return parseInt(mtypes);
var s=mtypes.split(',');
var found=0;
var doubl=0;
var maxfound=0;
for (i=0; i < s.length; i++) {
var k=parseInt(s[i]);
if (k > maxfound) {
found=i + 1;
maxfound=k;
doubl=0;
} else {
if (k == maxfound) {doubl=1;}
}
}
if (doubl) {return 0};
return found;
}
return 0;
}
function crtmagic(mtype, title, body, subm, noclose) {
return crtmagic_full(mtype, title, body, subm, noclose, 270, 0);
}
function crtmagic_full(mtype, title, body, subm, noclose, dx, dy) {
//name, XYX, X1-X2-Y2, pad.LRU
mtype=foundmagictype(mtype);
var names=new Array(
'neitral',17, 6, 14, 17, 14, 7,0,0, 3,
'fire', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'water', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'air', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'earth', 57,30, 33, 20, 21, 14, 11, 12, 0,
'white', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'black', 51, 25, 46, 44, 44, 10, 5, 5, 0);
var colors=new Array('B1A993','DDD5BF', 'ACA396','D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0');
while (body.indexOf('#IMGSRC#')>=0) body = body.replace('#IMGSRC#', '/i/misc/dmagic/'+names[mtype*10]+'_30.gif');
var s='<table width="'+dx+(dy?'" height="'+dy:'')+'" border="0" align="center" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+1]+'" align="left"><img src="/i/misc/dmagic/b'+names[mtype*10]+'_03.gif" width="'+names[mtype*10+1]+'" height="'+names[mtype*10+2]+'"></td>'+
'<td width="100%" align="right" background="/i/misc/dmagic/b'+names[mtype*10]+'_05.gif"></td>'+
'<td width="'+names[mtype*10+3]+'" align="right"><img src="/i/misc/dmagic/b'+names[mtype*10]+'_07.gif" width="'+names[mtype*10+3]+'" height="'+names[mtype*10+2]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
(names[mtype*10+7]?'<td width="'+names[mtype*10+7]+'"><SPAN style="width:'+names[mtype*10+7]+'">&nbsp;</SPAN></td>':'')+
'<td width="5" background="/i/misc/dmagic/b'+names[mtype*10]+'_17.gif">&nbsp;</td>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td bgcolor="#'+colors[mtype*2]+'"'+(names[mtype*10+9]?' style="padding-top: '+names[mtype*10+9]+'"':'')+' >'+
'<table border=0 width=100% cellspacing="0" cellpadding="0"><td style="padding-left: 20" align=center><B>'+title+
'</td><td width=20 align=right valign=top style="cursor: hand" '+(noclose?'':'onclick="close_hint(4);" ') + ' /><IMG src="/i/clear.gif" width=13 height=13>&nbsp;</td></table>'+
'</td></tr>'+
'<tr>'+
'<td align="center" bgcolor="#'+colors[mtype*2+1]+'">'+body+
'</tr>'+
'</table></td>'+
'<td width="5" background="/i/misc/dmagic/b'+names[mtype*10]+'_19.gif">&nbsp;</td>'+
(names[mtype*10+8]?'<td width="'+names[mtype*10+8]+'"><SPAN style="width:'+names[mtype*10+8]+'">&nbsp;</SPAN></td></td>':'')+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+4]+'" align="left"><img src="/i/misc/dmagic/b'+names[mtype*10]+'_27.gif" width="'+names[mtype*10+4]+'" height="'+names[mtype*10+6]+'"></td>'+
'<td width="100%" align="right" background="/i/misc/dmagic/b'+names[mtype*10]+'_29.gif"></td>'+
'<td width="'+names[mtype*10+5]+'" align="right"><img src="/i/misc/dmagic/b'+names[mtype*10]+'_31.gif" width="'+names[mtype*10+5]+'" height="'+names[mtype*10+6]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table>';
return s;
}