/*********************************
 * (c) Professional Health Products
 *********************************/
function browserObj() {
	d = document;
	this.ver = navigator.appVersion;
	this.agent = navigator.userAgent;
	this.gebi = d.getElementById?1:0;
	this.op5 = this.agent.indexOf("Opera 5")>-1;
	this.mac = this.agent.indexOf("Mac")>-1;
	this.ie4 = (d.all && !this.gebi)?1:0;
	this.ie5 = (this.gebi && this.ver.indexOf("MSIE 5")>-1 && !this.op5)?1:0;
	this.ie6 = (this.gebi && this.ver.indexOf("MSIE 6")>-1 && !this.op5)?1:0;
	this.ns4 = (d.layers && !this.gebi)?1:0;
	this.ns6 = (this.gebi && parseInt(this.ver)>=5)?1:0;
	this.ns = (this.ns4||this.ns6);
	this.ie = (this.ie4||this.ie5||this.ie6);
	this.valid = (this.ie||this.ns);
	return this;
}

browser = new browserObj();

function phpObj(obj) {
	this.name = obj;
	this.dom = browser.gebi?document.getElementById(obj):browser.ns4?eval("document.layers['"+obj+"']"):browser.ie4?obj:0;
	this.css = browser.gebi||browser.ie4?this.dom.style:this.dom;
	if(!this.css){return alert("Layer ["+obj+"] does not exist.");}
	return this;
}

function php_buttonObj(btnName,img1,img2,parent) {
	this.btnName = btnName;   this.parent=(parent) ? parent : 0;
	this.off     = new Image; this.off = img1;
	this.on      = new Image; this.on = img2;
	this.status  = 0;
	return this;
}

php_buttonObj.prototype.swapMe = function(obj1,obj2) {
	if (browser.ns4 && this.parent) { document[this.parent].document[this.btnName].src = this.status ? this.off : this.on; }
	else { document[this.btnName].src = this.status ? this.off : this.on; }
	this.status = this.status ? 0 : 1;
}

function toggle(e) {
  var r = null;

  if (e.parentNode && e.parentNode.parentNode) {
    r = e.parentNode.parentNode;
  } else if (e.parentElement && e.parentElement.parentElement) {
    r = e.parentElement.parentElement;
  }

  if (r) {
    if (r.className == "normal" && e.checked) {
      r.className = "highlight";
    } else if (r.className == "highlight") {
      r.className = "normal";
    }
  }
}

function toggleBgColor(e) {
  if (e) {
    if (e.className == "normal") {
      e.className = "highlight";
    } else if (e.className == "highlight") {
      e.className = "normal";
    }
  }
}
