// $Id: common_d.js,v 1.6 2007/12/03 14:49:58 razor Exp $ var undefined; Number.prototype.toFixed = Number.prototype.toFixed || function(fractionDigits){ return Math.floor( this * Math.pow(10, fractionDigits) + .5) / Math.pow(10, fractionDigits) } function gebi(id){ return document.getElementById(id) } function jsquote(str){ return str.replace(/'/g,''').replace(/>/g,'>').replace(/ 1000000000) bot_id -= 1000000000; url += "?bot_id="+bot_id; } else if (artikul_id) url += "?artikul_id="+artikul_id; window.open(url, "", "width=915,height=700,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } function showPunishmentInfo(nick) { var url = "/punishment_info.php?nick="+nick; window.open(url, "", "width=730,height=550,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } function showInjuryInfo(nick) { var url = "/injury_info.php?nick="+nick; window.open(url, "", "width=730,height=550,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } function showEffectInfo(nick) { var url = "/effect_info.php?nick="+nick; window.open(url, "", "width=730,height=550,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } function showClanInfo(clan_id) { var url = "/clan_info.php?clan_id="+clan_id; window.open(url, "", "width=730,height=650,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); } function userPrvTag() { var win = window try { win = dialogArguments || window } catch(e) {} while (win.opener) win = win.opener; if (win.closed) return; try { for (i=0; i document.body.clientWidth - 7 ? ex - div.offsetWidth - 10 : ex + 10; var y = evnt.clientY + div.offsetHeight > document.body.clientHeight - 7 ? ey - div.offsetHeight - 10 : ey + 10; if (x < 0 ) { x = ex - div.offsetWidth/2 } if (x < 7 ) { x = 7 } if (x > document.body.clientWidth - div.offsetWidth - 7) { x= document.body.clientWidth - div.offsetWidth - 7 } div.style.left = x; div.style.top = y; } function updateBag() { var win = window try { win = dialogArguments ? dialogArguments.win || dialogArguments : window } catch(e) {} while (win.opener) win = win.opener; if (win.closed) return false; try{ var win_main = win.top.frames['main_frame'].frames['main'] if(win_main.is_userphp) { win_main.location.href = win_main.urlMODE + '&update_swf=1' return true; } } catch (e) {} return false; } function updateSwf(params) { var win = window try { win = dialogArguments ? dialogArguments.win || dialogArguments : window } catch(e) {} while (win.opener) win = win.opener; if (win.closed) return; var url = 'main_iframe.php?mode=update_swf'; if (!params) return; try { for (i in params) { url += '&tar[]='+i; if (params[i]) url += '&add['+i+']='+escape(params[i]); } win.top.frames['main_frame'].frames['main_hidden'].location.href = url; } catch (e) {} } function updateHP() { updateSwf({'lvl': '' ,'items': ''}); } function fightRedirect(fight_id) { var rnd = Math.floor(Math.random()*1000000000); var url = 'fight.php?'+rnd; if (top.__lastFightId && (top.__lastFightId >= fight_id)) return; top.__lastFightId = fight_id; location.href = url; } function updatePartyLoot() { try { top.frames['main_frame'].frames['main_hidden'].location.href = 'main_iframe.php?mode=update_party'; } catch (e) {}; } function fightUpdateLog(ctime, nick1, level1, nick2, level2, code, i1, i2, i3, s1) { try { top.frames['main_frame'].frames['main'].fightUpdateLog(ctime, nick1, level1, nick2, level2, code, i1, i2, i3, s1); } catch (e) {}; } // ======================================================================================= function js_money_input_assemble(id_prefix) { var m1 = gebi(id_prefix+'1').value; var m2 = gebi(id_prefix+'2').value; var m3 = gebi(id_prefix+'3').value; if (m1.match(/[^0-9.]/)) m1 = m1.replace(/[^0-9].*$/, ''); if (m2.match(/[^0-9.]/)) m2 = m2.replace(/[^0-9].*$/, ''); if (m3.match(/[^0-9.]/)) m3 = m3.replace(/[^0-9].*$/, ''); v = m1/100.0 + m2*1.0 + m3*100.0; res = (isNaN(v) || v <= 0) ? 0 : (1.0 * (1.0*v).toFixed(2)).toFixed(2); return res*1.0; } function js_money_input_fill(id_prefix, amount) { var m1 = gebi(id_prefix+'1'); var m2 = gebi(id_prefix+'2'); var m3 = gebi(id_prefix+'3'); var str = ' '; var t=[]; amount = amount * 100; for (i = 0; i < 2; i++) { t[i] = (amount % 100); amount = (amount - t[i]) / 100; } t[2] = amount; m1.value = t[0].toFixed(0); m2.value = t[1].toFixed(0); m3.value = t[2].toFixed(0); } function userIgnore(name,status) { var win = window; try { win = dialogArguments || window } catch(e) {} while (win.opener) win = win.opener; if (win.closed) return; try { win.top.frames['chat'].chatSyncIgnore(name,status); } catch (e) {} }