// JScript File var dcInfoSpaceScriptId = 'dcInfoSpaceS'; var dcInfoSpaceOutputId = 'dcInfoSpaceOutput'; var dcInfoSpaceDataSource = 'http://www.darkclan.ru/cgi/getisdata.pl'; var dcInfoSpaceNoCache = true; var cityhash = { Capital: 'Capital city', Angels: ' Angels city', Demons: 'Demons city', Devils: ' Devils city', Sun: 'Suncity', Sand: 'Sandcity', Emeralds: 'Emeralds city', Moon: 'Moon city', East: 'East city', capital: 'Capital city', emeralds: 'Emeralds city' }; var stateshop = "Государственный"; var privateshop = "Комиссионный"; var moz = (document.getElementById && !document.all); var cursorX = 0; var cursorY = 0; var infoSpaceRequest = new Object(); function dcInfoSpace(id, ctx) { infoSpaceRequest = { id: id, ctx: ctx, response: null, activeTab: 0 }; cleanupScriptElement(dcInfoSpaceScriptId); var href = dcInfoSpaceDataSource + '?rnd=' + Math.random() + '&i=' + escape(id) + '&ctx=' + escape(ctx); getScriptElement(dcInfoSpaceScriptId, href); return false; } function cleanupScriptElement(id) { var span = document.getElementById(id); if (span != null) { setTimeout(function() { // without setTimeout - crash in IE 5.0! span.parentNode.removeChild(span); }, 50 ); } } function getScriptElement(id, href) { var span = document.body.appendChild(document.createElement('SPAN')); span.style.display = 'none'; span.innerHTML = 'MSIE fix'; setTimeout(function() { var s = span.getElementsByTagName("script")[0]; s.language = "JavaScript"; if (s.setAttribute) s.setAttribute('src', href); else s.src = href; }, 10 ); return span; } function handleResponse(response) { var imgHtml = ''; var html = ''; html += imgHtml + '' + response.caption + '
'; html += ''; html += ''; for (var shopi = 0; shopi < response.shops.length; shopi++) { var shop = response.shops[shopi]; html += ''; } html += '
Местонахождение'; html += 'Тип'; html += 'Количество'; html += 'Цена
' + cityhash[shop.where] + ''; html += (shop.which == 'state') ? stateshop : privateshop; html += ''; html += shop.count; html += ''; html += (shop.which == 'state') ? shop.price : ('(' + shop.minprice + ' - ' + shop.maxprice + ')'); html += '
'; var html2 = ''; html2 += imgHtml + '' + response.caption + '
'; for (var auci = 0; auci < response.auctions.length; auci++) { var ahtml = ''; var auc = response.auctions[auci]; for (var ii = 0; ii < auc.instances.length; ii++) { var instance = auc.instances[ii]; ahtml += '' + imgHtml + response.caption + instance.htmlcode + ''; ahtml += '' + instance.from + '' + instance.price + ''; ahtml += ''; } if (ahtml != '') { html2 += ''; html2 += ''; html2 += ''; html2 += '' + cityhash[auc.where] + '
' + ahtml; html2 += '
Информация о предмете'; html2 += 'От когоЦена
'; } } var isr = { shops: { caption: 'Магазины', content: html }, auctions: { caption: 'Аукционы', content: html2 } }; infoSpaceRequest.response = isr; handleInfoSpaceResponse(); } function handleInfoSpaceResponse() { recreateInfoSpace(); var div = document.getElementById(dcInfoSpaceOutputId); var x = cursorX - 8; var y = cursorY + 8; div.style.left = x + 'px'; div.style.top = y + 'px'; div.style.visibility = ''; } function closeInfoSpace() { var div = document.getElementById(dcInfoSpaceOutputId); div.style.visibility = 'hidden'; cleanupScriptElement(dcInfoSpaceScriptId); return false; } function recreateInfoSpace() { var div = document.getElementById(dcInfoSpaceOutputId); if (infoSpaceRequest.response == null) { div.innerHTML = 'Данных нет'; return; } var i = 0; var html = ''; for (var tabn in infoSpaceRequest.response) { if (i == infoSpaceRequest.activeTab) { html = infoSpaceRequest.response[tabn].content; break; } i++; } var content = '
'; content += '
'; content += html; content += '
'; content += '
'; content = getInfoSpaceTabsHtml() + content; div.innerHTML = content; } function getInfoSpaceTabsHtml() { if (infoSpaceRequest.response == null) { return; } var tabs = ''; var i = 0; for (var tabn in infoSpaceRequest.response) { var classn = 'tab-off'; var onclick = ' onclick="changeInfoSpaceTab(' + "'" + tabn + "'" +')"'; if (i == infoSpaceRequest.activeTab) { classn = 'tab-on'; onclick = ''; } tabs += ''; i++; } tabs += ''; tabs += '
 ' + infoSpaceRequest.response[tabn].caption + ' '; tabs += 'Закрыть'; tabs += '
'; return tabs; } function CurPos(e) { cursorX = !moz ? event.clientX : e.clientX; cursorY = !moz ? event.clientY : e.clientY; cursorX += document.body.scrollLeft; cursorY += document.body.scrollTop; if (!is.opera) { cursorX += document.documentElement.scrollLeft; cursorY += document.documentElement.scrollTop; } } document.onmousemove = CurPos; function changeInfoSpaceTab(id) { if (infoSpaceRequest.response == null) { return; } var i = 0; for (var tabn in infoSpaceRequest.response) { if (tabn == id) { break; } i++; } infoSpaceRequest.activeTab = i; recreateInfoSpace(); }