//Help System js
//Requires bastools.js
var helpTopic = "";
function _helpSystem_write() {
	var o = "<a href='javascript:" + this.instname + ".toggle()'><img name='" + this.imgname + "' src='";
	o += this.imgdir + "helpoff.gif' border='0' height='20' width='20'></a>";	
	document.write(o)
}
function _helpSystem_toggle() {
	if (document[this.imgname].src ==  this.imgoff.src) {
		this.helpOn = true;
		document[this.imgname].src = this.imgon.src;
	} else {
		this.helpOn = false;
		document[this.imgname].src = this.imgoff.src; 
	}
}
function _helpSystem_focus() {
	this.helpwin.Focus();
}
function _helpSystem_close() {
	this.helpwin.Close();
}
function _helpSystem_show() {
	this.toggle()
	status='';
	this.helpwin.Open();
}
function _helpSystem_open(topic) {
	if (this.helpOn) {
		helpTopic = this.helpdir + this.helpdoc + "#" + topic;
		var temptimer = setTimeout((this.instname + ".show()"),100);
		return false;
	} return true;
}
function helpSystem(instname, helpdir, doc, imgdir) {
	this.instname = instname;
	this.helpOn = false;
	this.topic = "";
	this.imgdir = imgdir;
	this.helpdir = helpdir;
	this.helpdoc = doc;
	this.imgname = this.instname + "_img";
	this.imgoff = new Image(); 	this.imgoff.src = this.imgdir + "helpoff.gif";
	this.imgon = new Image();	this.imgon.src = this.imgdir + "helpon.gif";
	this.helpwin = new Dialog('help_' + instname, this.helpdir + "index.htm", '', '', 500, screen.width - 50, 1, 1, '');
	this.focus = _helpSystem_focus;
	this.close = _helpSystem_close;
	this.open = _helpSystem_open;
	this.write = _helpSystem_write;
	this.toggle = _helpSystem_toggle;
	this.show = _helpSystem_show;
}
