var done = 0; var timeouts = new Array(); var globalLayer = 0; try { if(IE) { changingContainerMarginsVertical = 19; bottomHiddenPopupMargin = 20; } } catch(e) { changingContainerMarginsVertical = 0; bottomHiddenPopupMargin = 2; } bottomHiddenPopupMargin += 20; tabsImages = new Array(); tabsImages['active'] = new Array(); tabsImages['inactive'] = new Array(); // предзагрузка картинок табсов for (a = 1; a < 5; a++) { tabsImages['active']['tab'+ a] = new Image(); tabsImages['inactive']['tab'+ a] = new Image(); } tabsImages['active']['tab1'].src = '../img/tabsButtonAboutActive.gif'; tabsImages['active']['tab2'].src = '../img/tabsButtonFillActive.gif'; tabsImages['active']['tab3'].src = '../img/tabsButtonSpendActive.gif'; tabsImages['active']['tab4'].src = '../img/tabsButtonTakeOutActive.gif'; tabsImages['inactive']['tab1'].src = '../img/tabsButtonAbout.gif'; tabsImages['inactive']['tab2'].src = '../img/tabsButtonFill.gif'; tabsImages['inactive']['tab3'].src = '../img/tabsButtonSpend.gif'; tabsImages['inactive']['tab4'].src = '../img/tabsButtonTakeOut.gif'; function initialization() { /* tabActive = getElement('tab1'); displayedArray = getElementsByClassName('tableChanging', document.body); initChangingContainer(); hiddenPopups = getElementsByClassName('bottomHiddenPopup', document.body); bottomPopupsInitialization(); window.onresize = whenWindowResized; graphsInitialization(); */ var textInputs = document.getElementsByTagName('input'); for (a = 0; a < textInputs.length; a++) { if (textInputs[a].type == "text" && (textInputs[a].id == "findSubject" || textInputs[a].id == "findSubject2")) { textInputs[a].initialValue = textInputs[a].value; textInputs[a].onfocus = inputClear; textInputs[a].onblur = inputRestore; textInputs[a].style.display = 'none'; textInputs[a].style.display = 'inline'; } } done = 1; } function whenWindowResized() { initChangingContainer(); bottomPopupsInitialization(); try { sIFR.rollback(); hello(); } catch(e) {} } function initChangingContainer() { if (!getElement('changingContainer')) return; var max_height = 0; var changingContainerWidth = getElement('changingContainer').offsetWidth - 18; for (a=0; a < displayedArray.length; a++) { displayedArray[a].style.width = changingContainerWidth + 'px'; if (max_height < displayedArray[a].offsetHeight) { max_height = displayedArray[a].offsetHeight; } } if (!done) { try { displayed = displayedArray[0]; displayed.style.position = 'absolute'; } catch(e) {} } getElement('changingContainer').style.height = max_height + changingContainerMarginsVertical + 'px'; } function graphsInitialization() { graphItemSelected = new Array(); try { graphsImages = getElementsByClassName('graphChangingImg', document.body); graphItemsActive = getElementsByClassName('statsLeftItemActive', document.body); for (a=0; a < graphItemsActive.length; a++) { graphItemSelected[a] = graphItemsActive[a]; } } catch(e) { return; } } function showGraph(item, graph, targetImage) { if (!done) { return; } if (targetImage == 'Graph1') { graphNumber = 0; } if (targetImage == 'Graph2') { graphNumber = 1; } if (item == graphItemSelected[graphNumber]) { return; } graphItemSelected[graphNumber].className = 'statsLeftItem'; item.className = 'statsLeftItemActive'; graphItemSelected[graphNumber] = item; try { graphsImages[graphNumber].filters[0].apply(); } catch(e) {} graphsImages[graphNumber].src = graph.src; try { graphsImages[graphNumber].filters[0].play(); } catch(e) {} } function bottomPopupsInitialization() { var cellBottomContainer = getElement('cellBottomContainer'); var popupsLeft = findPosX(cellBottomContainer) + (cellBottomContainer.offsetWidth / 2); var popupsTop = findPosY(getElement('bottomPopupLinks')); // var popupsWidth = cellBottomContainer.offsetWidth - bottomHiddenPopupMargin; for (a=0; a < hiddenPopups.length; a++) { hiddenPopups[a].style.left = popupsLeft - (hiddenPopups[a].offsetWidth / 2) + 'px'; hiddenPopups[a].style.top = popupsTop - hiddenPopups[a].offsetHeight + 1 - 30 + 'px'; // hiddenPopups[a].style.width = popupsWidth + 'px'; } } function showBottomPopup(layer) { cancelHide(getElement(layer)); for (a=0; a < hiddenPopups.length; a++) { if (getElement(layer) != hiddenPopups[a]) { hiddenPopups[a].style.visibility = 'hidden'; cancelHide(hiddenPopups[a]); } } bottomPopupsInitialization(); if(getElement(layer)) { var layerLocal = getElement(layer); try { layerLocal.filters[1].apply(); layerLocal.filters[2].apply(); } catch (e) {} layerLocal.style.visibility= 'visible'; try { layerLocal.filters[1].play(); layerLocal.filters[2].play(); } catch(e) {} } } function hideBottomPopup(event, layer) { globalLayer = layer; if(layer.contains) { if (!layer.contains(event.toElement)) { layer.timeout = setTimeout("hide3()", 1000); layer.timeoutActive = 1; } } else { where = event.relatedTarget; if (where == layer) { return; } while (where.parentNode) { if (where.parentNode == layer) { return; } where = where.parentNode; } layer.timeout = setTimeout("hide3()", 1000); layer.timeoutActive = 1; } } function hide3() { try { globalLayer.filters[0].apply(); } catch(e) {} globalLayer.style.visibility= 'hidden'; try { globalLayer.filters[0].play(); } catch(e) {} } function cancelHide(layer2) { if(layer2.timeoutActive) { clearTimeout(layer2.timeout); layer2.timeoutActive = 0; } } function showInfo(sourceTab, infoContainer) { if (done) { if (sourceTab != tabActive) { changingCurrent = getElement(infoContainer); tabActive.src = tabsImages['inactive'][tabActive.id].src; sourceTab.src = tabsImages['active'][sourceTab.id].src; tabActive = sourceTab; changingCurrent.style.visibility = 'visible'; displayed.style.visibility = 'hidden'; displayed = changingCurrent; } } } function inputClear() { if (this.value == this.initialValue) { this.value = ""; } } function inputRestore() { if (this.value == "") { this.value = this.initialValue; this.style.display = 'none'; this.style.display = 'inline'; } } function getElement(id) { if (document.getElementById) { return document.getElementById(id); } else if (document.all) { return document.all(id); } } function getElementsByClassName(strClassName, obj) { var ar = arguments[2] || new Array(); var re = new RegExp("\\b" + strClassName + "\\b", "g"); if (re.test(obj.className)) { ar.push(obj); } for ( var i = 0; i < obj.childNodes.length; i++ ) getElementsByClassName(strClassName, obj.childNodes[i], ar); return ar; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; }