Toggle = Class.create();
Toggle.prototype = {
	initialize: function(trigger, rank, aims) {
		if (!$(trigger)) return;
		this.t = $(trigger);
		this.rk = rank;
		this.a = new Array(aims.length);
		for (i=0; i<this.a.length; i++) { this.a[i] = $(aims[i]); }
		this.t.onclick = this.flip.bind(this);
	},
	flip: function() {
		this.t.className = (this.t.className == '') ? 'on' : '';
		if (this.a.length == 1) {
      this.a[0].className = (this.a[0].className == '') ? 'on' : '';
		} else {
  		for (i=0; i<this.a.length; i++) {
  			if (i==this.rk) this.a[i].className += ' on';
  			else this.a[i].className = '';
  		}
    }
	}
}

window.onload = function() {
  lnTog = new Toggle('lnk', 0, ['lnMenu']);
	mailTog = new Toggle('emailmore', 0, ['emailplus']);
	lnHeaderTog = new Toggle('lnHeaderTrig', 0, ['lnHeaderSwitch']);
}