// Determine browser and version.

function Browser() {
  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

function changeStyleBtn(el, action, color) {
	if(action == "over") {
		el.style.color=color;
	}
	else {
		el.style.color='#ffffff';
	}
}


function helpText(event, text) {
	
	if(text != "") {
	
		if(document.getElementById('helpDiv')) {
			var div = document.getElementById('helpDiv');
		}
		else {
			var div = document.createElement('div');
			div.setAttribute('id', 'helpDiv');
			div.style.position = "absolute";
			div.style.background = "yellow";
			div.style.border = "1px solid #000";
			div.style.padding = "4px";
			div.style.zindex = '255';
			div.style.visibility = 'hidden';
			document.body.appendChild(div);
		}

		div.innerHTML = text;
		// Get cursor position with respect to the page.
		if (browser.isNS) {
			var x = event.clientX + window.scrollX;
			var y = event.clientY + window.scrollY;
		}
		else {
			var x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
			var y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		}
		
		div.style.left = (x + 40) + 'px';
		div.style.top = (y - 20) + 'px';		
	}
	
	if(document.getElementById('helpDiv')) {
		var div = document.getElementById('helpDiv');
		if(div.style.visibility == 'visible') {
	//		div.style.visibility = 'hidden';
			setTimeout("document.getElementById('helpDiv').style.visibility = 'hidden'", 400);
		}
		else {
			setTimeout("document.getElementById('helpDiv').style.visibility = 'visible'", 800);
		}
	}
}
