/*
*  Mendeleev table events
*/

function s(z) { /* submit */
	document.forms[0].elements[0].value=z;
	document.forms[0].submit();
}
var tc,ts;
function m_over() { /* mouse oVer */
	tc = this.style.backgroundColor;
	ts = window.status;
	this.style.backgroundColor = '#B0EDE6';
	window.status = this.title;
}
function m_out() { /* mouse oUt */
	this.style.backgroundColor = tc;
	window.status = ts;
}
function a_over() { /* anchor  */
	return true;
}
function cl() { s(this.id) } /* click */

/*
	Mendeleev table - dynamic event binding
*/

/* Must be called from BODY onload */
function StartUp() {
	var all_tables = document.getElementsByTagName('table');
	for(var k=0; k < all_tables.length; k++) {
	  var t = all_tables.item(k);
	  if ( t.className == 'mendeleev' ) {
	    var tds = t.getElementsByTagName('td');
	    for (var i = 0; i < tds.length; ++i) {
	      var itm = tds.item(i);
	      var cls = itm.className;
	      if ( cls != 'e' && cls != 'lh' && cls != 'ah' ) {
	        itm.onmouseover = m_over;
	        itm.onmouseout  = m_out;
	        itm.onclick     = cl;
	        var tda = itm.getElementsByTagName('a');
	        for (var j=0; j < tda.length; j++) {
	          tda.item(j).onmouseover = a_over;
	          tda.item(j).onmouseout  = a_over;
	        }
	      }
	    }
	  }
	}
}

/*
var tds = document.getElementById('mendeleev').getElementsByTagName('td');
for (var i = 0; i < tds.length; ++i) {
  if ( tds.item(i).className != 'e' ) {
    tds.item(i).onmouseover = m_over;
    tds.item(i).onmouseout  = m_out;
    tds.item(i).onclick     = cl;
    var tda = tds.item(i).getElementsByTagName('a');
    for (var j=0; j < tda.length; j++) {
      tda.item(j).onmouseover = a_over;
      tda.item(j).onmouseout  = a_over;
    }
  }
}
*/

