index.html  |  resources.html  |  resources.js  |  workspace.html  |  workspace.js  |  reset.html  |  reset.js  |  sql-code.html  |  sql-code.js

var
  resAmount = 13,

  slResTp  = '01',
  slResCom = '00',
  
  slIntervalId,
  resComSlVisible = false,

  statusColors = ['black', 'white'];

function blinkSlCom() {
  with (document.getElementsByTagName('div')[0].style)
    backgroundColor = statusColors[(resComSlVisible = !resComSlVisible) - 0];
}

function toggleIt(it) {
  with (top.frames[0][it])
    document.getElementById(it).style.color = statusColors[(active = !active) - 0];
}

function selectResCom(resCom) {
  var resComPos = new Array;
  if ((slResCom = resCom) == '0012') resCom++;
  
  with (document.getElementsByTagName('img')[resCom - 0].style) {
    resComPos.x = left;
    resComPos.y = top;
  }

  with (document.getElementsByTagName('div')[0].style) {
    left = resComPos.x.match(/\d+/) - 1 + 'px';
    top  = resComPos.y.match(/\d+/) - 1 + 'px';
  }
}

function updateResTp(resTp) {
  var tmp = document.getElementsByTagName('b');
  tmp[resTp - 1].style.color = (tmp = tmp[slResTp - 1].style).color;
  tmp.color = '';

  for (var i = 0; i != resAmount; i++)
    with (document.getElementsByTagName('img')[i])
      setAttribute('src', getAttribute('src').replace(/\d\d/, slResTp = resTp));
}

function resetMapDialog() {
  var resetMapWin = window.open('reset.html', '_blank', 'width=320, height=150, dependent=yes');
}

function showSqlCode() {
  var sqlCodeWin = window.open('sql-code.html', '_blank', 'width=700, height=600, dependent=yes');
}