var Loaded = 0, WN = window, DC = document;
var IE = DC.all, DM = DC.getElementById && !(IE), OP = WN.opera;
var Bubble = 1, SayIt = 1;
var SP = String.prototype;
SP.R = SP.replace;
SP.S = SP.substring;
SP.C = SP.charAt;

function Say(s) {
	if (SayIt) SayIt = confirm(s);
}

function NoBubble() {
	Bubble = 0;
	setTimeout('Bubble=1', 10);
}

function By(x) {
	var i, o = DC.getElementById(x);
	return El(o);
}

function El(o) {
	if (o && !o.s) {
		o.s = o.style;
		o.C = function(v) {
			return this.className = typeof v != 'undefined' ? v : Class(this);
		}
		o.X = function(v) {
			return this.innerHTML = v ? v : this.innerHTML;
		};
		o.V = function(v) {
			if (!isNaN(v)) {
				this.s.visibility = v ? 'visible' : 'hidden';
				return v;
			}
			return this.s.visibility == 'hidden' ? 0 : 1;
		};
		o.O = function(v) {
			var s = this.s;
			s.opacity = s.MozOpacity = s.KhtmlOpacity = v / 100;
			s.filter = 'alpha(opacity=' + v + ')';
		};
		o.S = function(s, v) {
			var n, o = this;
			if (v) return o[s] = o.s[s] = v;
			n = 'client'+UC(s);
			return o[n] ? o[n] : o[s] ? o[s] : o.s[s];
		};
		o.T = function(v){return this.S('top', v)}
		o.L = function(v){return this.S('left', v)}
		o.W = function(v){return this.S('width', v)}
		o.H = function(v){return this.S('height', v)}
		o.D = function(v){return this.S('display', v)}
		o.B = function(v){return this.S('background', v)}
		o.R = function(v){return this.S('color', v)}
	}
	return o;
}

function Class(o) {
	return o ? (o.className ? o.className : '') : '';
}

function Tags(t, p) {
	return (p ? p : DC).getElementsByTagName(t);
}

function Event(e) {
	return DM ? e : event;
}

function ClientXY(e) {
	e = Event(e);
	return [e.clientX, e.clientY];
}

function PageXY(e) {
	return DM ? [e.pageX, e.pageY] : [event.x, event.y];
}

function LayerXY(e) {
	e = DM ? e : event;
	return [e.layerX, e.layerY];
}

function ScrollXY() {
	var d = DC.documentElement;
	if (!d || !d.scrollTop) d = DC.body;
	return d ? [d.scrollLeft, d.scrollTop] : [];
}

function XY(e) {
	var o = DC.compatMode && DC.compatMode != 'BackCompat' ? DC.documentElement : DC.body, x = DM ? e.pageX : event.x + o.scrollLeft, y = DM ? e.pageY : event.y + o.scrollTop, m = IE && !WN.opera, w = m ? o.clientWidth : WN.innerWidth - 20, h = m ? o.clientHeight : WN.innerHeight - 20, r = (m ? w - event.clientX : w - e.clientX) - 12, b = (m ? h - event.clientY : h - e.clientY) - 10;
	return [x, y, w, h, r, b];
}

function IEBody() {
	return (DC.compatMode && DC.compatMode != 'BackCompat') ? DC.documentElement : DC.body;
}

var Img = new Object(), MasterTry = new Object();

function LoadImgs() {
	var i, n, s, o, a = arguments;
	for (i = 0; i < a.length; i++) {
		n = a[i];
		o = Img[n] = new Image();
		o.src = '/_/img/' + n + '.gif';
		s = n.substr(0, 3);
		if (s == 'btn' || s == 'top' || s == 'nav') {
			o = Img[n + 'on'] = new Image();
			o.src = '/_/img/' + n + 'on.gif';
		}
	}
}

function On(o) {
	if (Loaded) { 
		Off(o = o && (o.src || Class(o)) ? o : this);
		if (Class(o)) o.className += 'Hover';
		else if (o.src) o.src = o.src.R(/\.(gif|jpg)/, 'on.$1');
	}
}

function Off(o) {
	if (Loaded) {
		o = o && (o.src || Class(o)) ? o : this;
		if (Class(o)) o.className = (''+Class(o)).R(/Hover$/, '');
		else if (o.src) o.src = o.src.R(/on\.(gif|jpg)/, '.$1');
	}
}

function Toggle(i, d) {
	By(i).D((d ? d : By(i).D() == 'none') ? 'block' : 'none');
}

function Fill(o, v) {
	if (o.changed) return;
	for (n in o.form) if (o.form[n] && o.form[n].name && o.form[n].name.substring && o.form[n].name.S(0, 6) == 'MODEUPDATE') return;
	Set(o, v);
}

function Trim(s) {
	return (''+s).R(/^\s*/g,'').R(/\s*$/g,'');
}

function Quot(s) {
	return (s ? ''+s : '').R('"', '&quot;');
}

function A2Z(s) {
	return (''+s).R(/[^A-Z]/gi, '');
}

function Num(s) {
	return (''+s).R(/[^0-9]/g, '') * 1;
}

function UC(s) {
    return (''+s).R(/\w+/g, function(a){return a.C(0).toUpperCase()+a.substr(1)});
}

function Range(i, a, b) {
	return Math.min(Math.max(a, i), b);
}

function Match(v, r) {
	return v != '' && v.R(r, '') == '';
}

function HasMatch(v, r) {
	return v != '' && v.R(r, '') != v;
}

function Between(i, a, b) {
	return i >= a && i <= b;
}

function InArray(x, a) {
	for (var i = 0; i < a.length; i++) if (a[i] == x) return true;
	return false;
}

function Empty(s) {
	return s == null || Trim(s) == '';
}

function Money(v) {
	var n = Trim(''+v).C(0) == '-', c = Math.floor((''+v).R(/[^0-9^\.]/g, '') * 100 + 0.50000000001), d = Math.floor(c / 100) + '', i;
	if ((c = c % 100) < 10) c = '0' + c;
	for (i = 0; i < Math.floor((d.length - (1 + i)) / 3); i++) d = d.S(0, d.length - (4 * i + 3)) + ',' + d.S(d.length - (4 * i + 3));
	return (n ? '-' : '') + d + '.' + c;
}

var IsValid, LastConfirmed = 0;

function Validate(f) {
	var i, a = arguments;
	for (i = IsValid = 1; i < a.length; i++) Require(a[i]);
	By(f.name+'_DisplayErrors').C(IsValid ? '' : 'Alert');
	if (!IsValid) alert('There were problems with your submission.\nPlease fill in all required fields with valid information and re-submit.');
	return IsValid;
}

function ConfirmCancel(f) {
	return Get(f.CHANGES) ? confirm('Are you sure you want to cancel the changes?') : true;
}

function Focus(f) {
	if (f.type) {
		f.focus();
		if (f.type == 'text') f.select();
	}
}

function Get(f, p) {
	var i, v = '', o = f.type ? f : f[0], t = o.type;
	if (t == "select-one") return f[f.selectedIndex][p ? p : 'value'];
	else if (t == "checkbox") {
		if (f[0]) {
			for (i = 0; i < f.length; i++) if (f[i].checked) v += ','+f[i].value;
			return v.R(/^\,/, '');
		}
		return f.checked ? f.value : '';
	} else if (t == 'radio') {
		if (f[0]) for (i = 0; i < f.length; i++) if (f[i].checked) return f[i].value;
		return f.checked ? f.value : '';
	}
	return f.value ? f.value : '';
}

function Set(f, v) {
	f = f.form[f.name];
	var i, t = f.type;
	if (t == "select-one") {
		for (i = 0; i < f.length; i++) if (f[i].value == v) f.selectedIndex = i;
	}
	else if (t == "checkbox") f.checked = v;
	else if (f[0] && f[0].type == 'checkbox') for (i = 0; i < f.length; i++) f.checked = (f.value == v);
	else f.value = v;
}

function Require(o, b, q, n) {
	var e = o.type ? o : o[0], t = e.className, f = e.form, n = e.name, v = Get(o = f[n]);
	var p, s, k = 1, m, u, x = !isNaN(q), i, j, r, l = LastConfirmed, g = '', a = [], d, h, c;
	if (x) q = 1 - q;
	p = HasMatch(t, /^Optional/);
	s = HasMatch(t, / Format$/) && !b && !(p && IsEmpty(v));
	m = t.R(/^.*Match-([^ ^$]*).*$/, '$1');
	m = m != t ? m : '';
	u = HasMatch(t, /Unique/);
	j = t.R(/^.*\(([0-9]*)\).*$/, '$1');
	t = t.R(/(Optional |Required |Unique\([0-9]*\) | Format)/g, '').R(/[ ]?Match-[^ ]*/, '');
	if (t == 'CCNum') k = IsCCNum(v, s);
	else if (t == 'Checkbox' || t == 'YesNo') k = v;
	else if (t == 'Password') {
		k = IsPassword(v);
		if (d = By(n+'_SECURITY')) {
			for (i = s = 0; i < v.length; i++) if (!InArray(c = v.C(i), a)) g += (a[a.length] = c);
			a = [/[a-z]/g, /[A-Z]/g, /[0-9]/g, /[^a-z^0-9]/gi];
			for (i in a) s += 28 - (a[i] = 2 - Math.min(g.length - g.R(a[i], '').length, 2)) * a[i] * 7;
			h = '<div style="float:right;"><small>Security: <b>' + (s < 64 ? 'Low' : (s < 76  ? 'Medium' : (s < 88 ? 'High' : (s < 100 ? 'Very High' : 'Extremely High')))) + '</b></small><br>';
			c = {c:'0123456789ABCDEF'};
			c.r = c.c.C(Math.round((100 - Range(s, 55, 100)) / 3));
			c.g = c.c.C(Math.round((Range(s, 10, 55) - 10) / 4));
			for (i = 0; i < 20; i++) h += '<b style="border:1px solid #666999;'+(i < (Range(s, 10, 100) - 10) / 4.5 ? 'background:#'+c.r+c.r+c.g+c.g+'00;' : '')+'">&nbsp;&nbsp;</b>';
			d.X(s ? h + '</div>' : '');
		}
	}
	else if (t.substr(0, 5) == 'CCExp') {
		n = n.R(/_[MY]{2}/, '');
		k = IsCCExp(Get(f[n+'_MM']), Get(f[n+'_YY']), Num(t));
	}
	else if (c = eval('Is'+t)) k = c(v, s ? o : 0);
	if (m) k = k && v == Get(f[m]);
	if (p) k = k || IsEmpty(v);
	if (u && v && !x) {
		Post((DC.location+'').R(/\?.*$/, ''), n+'_FIND='+escape(v)+'&IDNOT='+j, 'Require(DC.'+f.name+'.'+n+',1,XML)');
	}
	IsValid = IsValid && (x ? q : k);
	if (v = By(f.name+'_'+n.R(/\[\]/, '')+(x ? '_UNIQUE' : ''))) {
		s = (x ? q : k) ? (v.C() == 'Error' ? 2 : 0) : ((!b || v.C() || v.k) ? 1 : 0);
		if (l && l.id != v.id) LastConfirmed = l.C('');
		if (s == 1) {
			v.X(v.x);
			v.C('Error');
		} else if (s == 2) {
			v.x = v.X();
			v.X('<b>Thank you!</b>');
			v.C('Confirm');
			LastConfirmed = v;
		}
		v.k = x ? q : k;
	}
}

function IsEmpty(v) {
	return Trim(v).length < 1;
}

function IsText(v, l) {
	return l > 1 ? Trim(v).length >= l : !Empty(v);
}

function IsZip(v) {
	return Match(v, /^\d{5}(|-\d{4})$/);
}

function IsPhone(v, o) {
	//var n = v.R(/[a-z]/gi, '');
	//if (o) Set(o, n);
	return (''+Num(v)).length > 6;
}

function IsPhoneUS(v, o) {
	var n = (''+Num(v.R(/x.*$/i, ''))).R(/^\+?1/, ''), x = v.R(/^.*x/i, ''), b = Match(n, /[2-9][\d]{2}[2-9][\d]{6}/);
	if (o && b) Set(o, n.R(/^([\d]{3})([\d]{3})([\d]{4})/, '$1-$2-$3') + (x != v ? ' ext. '+Num(x) : ''));
	return b;
}

function IsEmail(v) {
	return Match(v, /^([^$@\\ ]+)@((([^$@\\ \.]+)\.)*)([^$@\\ \.]{2,}\.)([A-Za-z]{2,6})$/);
}

function IsURL(v) {
	return Match(v, /^http(s?):\/\/([^$@\\ ]+)$/i);
}

function IsUsername(v) {
	return Match(v, /^([^$@\\ ]+)$/);
}

function IsPassword(v) {
	return v.length > 5;
}

function IsInteger(v) {
	return Match(v, /^(\+|\-)?([0-9]+)$/);
}

function IsFloat(v) {
	return Match(v, /^(\+|\-)?([0-9]+)(((\.|\,)?([0-9]+))?)$/);
}

function IsMoney(v, o) {
	if (o) Set(o, v = Money(v));
	return Match(v, /^(([0-9]{1,3}([\,]?[0-9]{3})*)|([0-9]{0,3}))(\.[0-9]{2})?$/);
}

function IsDate(v, o) {
	var k = v.R(/Jan/i, '1').R(/Feb/i, '2').R(/Mar/i, '3').R(/Apr/i, '4').R(/May/i, '5').R(/Jun/i, '6').R(/Jul/i, '7').R(/Aug/i, '8').R(/Sep/i, '9').R(/Oct/i, '10').R(/Nov/i, '11').R(/Dec/i, '12').split(/[^0-9]/i).length > 1;
	if (o) DateChange(o, 1);
	return k;
}

function GetDate(v) {
	
}

function IsTime(v) {
	var v, a;
	v = Trim(v).toUpperCase();
	if (v.R(/[:AM]/, '') == v) return 0;
	if (!Match(v, /[012]?[0-9](:[012345][0-9]){0,2}([ ]*[AP][M]?)?/, '')) return 0;
	a = v.R(/[^0-9]/g, ',').split(',');
	if (a[0] * 1 > 23) return 0;
	return 1;
}

function IsCCNum(v) {
	var s = 0, a = [], i, h = '';
	v = v.R(/[^\d]+/g, '');
	if (v.length < 13) return false;
	for (i = 0; i < v.length; i++) a[v.length - 1 - i] = v.S(i, i + 1) * 1;
	for (i = 0; i < v.length; i++) {
		h += a[i]+'<br>';
		if (i % 2) {
			a[i] *= 2;
			if (a[i] >= 10) a[i] -= 9;
		}
		s += a[i];
	}
	return s % 10 == 0;
}

function IsCCNumOrStars(v) {
	return v.S(0, 12) == '************' || IsCCNum(v);
}

function IsCCExp(m, y, d) {
	return parseInt('20' + y + m) >= d;
}

var DateActive = 0;

function DateShow(i) {
	if (Bubble) {
		var a = DateActive;
		if (a && a != i) DateDoHide(a);
		DateActive = i;
		clearTimeout(By(i).t);
		By(i+'_FRM').V(1);
		By(i+'_IMG').B('url(/_/img/main/getdate.gif) bottom');
	}
}

function DateHide(i) {
	By(i).t = setTimeout("DateDoHide('"+i+"')", 100);
}

function DateDoHide(i, t) {
	if (Bubble) {
		By(i+'_FRM').V(DateActive = 0);
		By(i+'_IMG').B('url(/_/img/main/getdate.gif) top');
	}
}

function DateToggle(i) {
	if (DateActive == i) DateDoHide(i);
	else DateShow(i);
	NoBubble();
}

function Day(o) {
	o=o?new Date(''+o):new Date();
	o.Y=function(v){if(!isNaN(v))this.setFullYear(v);return this.getFullYear()};
	o.M=function(v){if(!isNaN(v))this.setMonth(v-1);return this.getMonth()+1};
	o.D=function(v){if(!isNaN(v))this.setDate(v);return this.getDate()};
	o.W=function(){return this.getDay()};
	o.S=function(v){var o=this,s=o.M()+'/'+o.D()+'/'+o.Y();return v?s:s.R(/\/[^\/]*([\d]{2})$/,'/$1')};
	return o;
}

function DateChange(f, r) {
	var d = Day(), v = f.value, y;
	if (!Trim(v)) return;
	v = v.R(/([0-9][0-9])([0-9][0-9])([0-9][0-9])/, '$1 $2 $3');
	v = v.R(/([0-9]+)([^0-9]+)(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i, '\\3\\2\\1');
	v = v.R(/Jan/i, '1').R(/Feb/i, '2').R(/Mar/i, '3').R(/Apr/i, '4');
	v = v.R(/May/i, '5').R(/Jun/i, '6').R(/Jul/i, '7').R(/Aug/i, '8');
	v = v.R(/Sep/i, '9').R(/Oct/i, '10').R(/Nov/i, '11').R(/Dec/i, '12');
	v = Trim(v.R(/[^0-9]+/g, ' '));
	v = v.split(' ');
	y = v.length < 3 ? d.Y() : v[2] * 1;
	if (y < 100) y += 2000;
	d.Y(y);
	d.D(v[1]);
	d.M(v[0] * 1);
	d.D(v[1]);
	if (isNaN(d.D())) {
		d = Day();
		Set(f, '');
	} else {
		w = WN.frames[f.id+'_FRM'];
		DateSet(f, w.Chosen = d);
		w.DateCal();
	}
	if (!r && HasMatch(Class(f), /Require/)) Require(f, 1);
}

function DateSet(f, d) {
	Set(f, d.S(f.name.C(0)!='s'));
}


var XML;

function Post(u, d, j) {
	var x, w = window;
	if (w.XMLHttpRequest) x = new XMLHttpRequest();
	else if (w.ActiveXObject) x = new ActiveXObject("Microsoft.XMLHTTP");
	else return false;
	if (x) {
		x.onreadystatechange = function() {
			if (x.readyState == 4 && x.status == 200) {
				XML = x.responseText;
				eval(j);
				FinishPage();
			}
		}
		x.open('POST', u, true);
		x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		x.setRequestHeader('Content-length', d.length);
		x.setRequestHeader('Connection', 'close');
		x.send(d);
	}
	return true;
}

function List(o) {
	var f = o.form, t, i = f.name+'List', n, e, a = [], d = 'AJAX=Y', m;
	for (n in f) {
		if (e = f[n]) {
			if (!(t = e.type)) {
				if (e[0] && (e[0].type == 'checkbox' || e[0].type == 'radio')) {
					if (!InArray(n, a)) for (j in e) if (e[j].checked) d += '&'+n+'='+escape(e[j].value);
					a[a.length] = n;
				}
				if (e.checked) d += '&'+f[n]+'='+escape(Get(e));
			}
			else if (t != 'submit') d += '&'+n+'='+escape(Get(e));
		}
		d += '&'+o.name+'='+escape(Get(o));
	}
	if (m = By('Messages')) m.D('none');
	if (Post(f.action, d, "By('"+i+"').X(XML);By('"+i+"Wait').C('Abs');if(Scrolls)ScrollSizing(Scrolls);")) {
		By(i+'Wait').C('Wait');
		return false;
	}
	else return true;
}

var Scrolls = [];

function ScrollSizing(a) {
	var i, j, k, w, x, n, h, c, r, b;
	for (i in a) {
		n = a[i];
		if (!(h = By(n+'Heads'))) return;
		c = h.childNodes;
		r = By(n+'Row0');
		b = r.childNodes;
		for (k = 0; k < b.length; k++) {
			if ((w = b[k].clientWidth) && (x = c[k].clientWidth)) {
				w = Math.round((x + w) / 2);
				c[k].style.width = b[k].style.width = w+'px';
				c[k].style.overflow = 'hidden';
			}
		}
	}
}

function Paging(o) {
	if (List(o)) o.form.submit();
}

function ClearSearch(f) {
	var n, o = f.form;
	for (n in o) if (HasMatch(n, /^s[A-Z]/)) {
		if (o[n].type == 'select-one') Set(o[n], 'C');
		Set(o[n], '');
	}
	return List(f);
}

DetailTimeout = 0;

function Detail(o, j) {
	if (!o.type || o.type == 'checkbox') o = Row(o) ? Row(o).b : o;
	var f = o.form, d = 'MODE=DETAIL', i, c = f['ID[]'], t, n, e, a = [], m;
	for (i = 0; i < c.length; i++) if (c[i].checked) d += '&ID[]='+c[i].value;
	for (n in f) {
		if (e = f[n]) {
			if (!(t = e.type)) {
				if (e[0] && (e[0].type == 'checkbox' || e[0].type == 'radio')) {
					if (!InArray(n, a)) for (j in e) if (e[j].checked) d += '&'+n+'='+escape(e[j].value);
					a[a.length] = n;
				}
				if (e.checked) d += '&'+f[n]+'='+escape(Get(e));
			}
			else if (t != 'submit' && n != 'MODE') d += '&'+n+'='+escape(Get(e));
		}
	}
	i = f.name + 'Detail';
	clearTimeout(DetailTimeout);
	DetailTimeout = setTimeout('Post(DC.'+f.name+'.action, "'+d.R(/"/g, '\"')+'", "By(\''+i+'\').X(XML);By(\''+i+'Wait\').C(\'\');if(Scrolls)ScrollSizing(Scrolls);")', 100);
	By(i+'Wait').C('Wait');
}

function ConfirmDelete(o, s, p) {
	var a = o['ID[]'], c = 0, i;
	if (a.length) for (i = 0; i < a.length; i++) c += a[i].checked ? 1 : 0;
	else c += a.checked ? 1 : 0;
	if (c < 1) {
		alert('You have not selected any ' + p + ' to be deleted.');
		return false;
	}
	return confirm('Are you sure you would like to delete the selected ' + (c > 1 ? p : s) + '?');
}

var CheckIndex = -1, RowIgnore = 0;

function Row(o) {
	var f = o, i, a;
	while ((o.tagName != 'TR' || !o.id) && o.parentNode) f = o = o.parentNode;
	while ((f.tagName != 'FORM') && f.parentNode) f = o.f = f.parentNode;
	o.b = Tags('INPUT', o)[0];
	o.i = Num(o.id);
	return (o.p = o.parentNode) ? El(o) : null;
}

function RowOn(e) {
	var o = Row(e), /*r = OrdRow, s = OrdSlot,*/ b;
	if (o.C) o.C(o.C().R(/([Row01]+)$/, '$1 $1H'));
	/*if (r) {
		o.p.insertBefore(s, b = r.c > o.i ? o : o.nextSibling);
		r.c = Row(b).i;
	}*/
}

function RowOff(e) {
	var o = Row(e);
	if (o.C) o.C(o.C().R(/( [Row01]+H)/g, ''));
}

function RowUp(e) {
	//if (OrdRow) OrdUp(Row(e));
}

function RowClick(e) {
	var o = Row(e);
	if (!RowIgnore) {
		o.b.checked = !o.b.checked;
		SelectRows(o.f);
	}
}

function RowEdit(o) {
	if (o = By(Row(o).id.R(/Row/, 'Edit'))) o.click();
}

function ParentTag(o, t) {
	var p = o.parentNode;
	while (p && p.tagName != t) p = p.parentNode;
	return p;
}

function BoxObject(o) {
	var a = ParentTag(o, 'FORM');
	a = DC.forms[a.name]['ID[]'];
	return a.length ? a[Row(o).i] : a;
}

function CheckAll(o) {
	var f = o.form, a = f['ID[]'], b = o.checked, i;
	if (a.length) for (i = 0; i < a.length; i++) a[i].checked = b;
	else a.checked = b;
	SelectRows(f);
}

function CheckDown(o, n) {
	CheckIndex = n;
}

function CheckUp(o, n) {
	var m = CheckIndex, j, i, b, f = o.form, a = f['ID[]'];
	if (m < 0 || n == m) return;
	CheckIndex = -1;
	j = n < m ? 1 : -1;
	for (i = n; i * j <= m * j; i += j) a[i].checked = !a[i].checked;
	SelectRows(f);
}

function CheckClick(o) {
	RowIgnore = 1;
	setTimeout('RowIgnore = 0', 10);
	SelectRows(o.form);
}

function SelectRows(f) {
	var a = f['ID[]'], b, c = true, i;
	//if (b) f.IDs[0].checked = f.IDs[1].checked = !b;
	if (a) {
		if (a.length) {
			for (i = 0; i < a.length; i++) {
				b = a[i].checked;
				c = (c && b);
				SelectRow(By(f.name + 'Row' + i), b);
			}
		} else {
			b = a.checked;
			c = (c && b);
			SelectRow(By(f.name + 'Row0'), b);
		}
		f.IDs[0].checked = f.IDs[1].checked = c;
	}
}

function SelectRow(o, b) {
	var c = o.C().R(/ .*$/, '');
	c = b ? c+' '+c+'S' : c;
	if (c != o.C()) o.C(c);
}

function Merge() {
	var i, j, a = arguments, o = [];
	for (i = 0; i < a.length; i++) for (j in a[i]) o[o.length] = a[i][j];
	return o;
}

function FinishPage() {
	var i, o, a = Tags('INPUT'), c;
	for (i in a) {
		o = a[i];
		if (Class(o) == 'Button' || HasMatch(Class(o), /Mode/)) {
			o.onmouseover = On;
			o.onmouseout = Off;
		}
	}
	a = Merge(Tags('INPUT'), Tags('SELECT'), Tags('TEXTAREA'));
	for (i in a) {
		if ((o = a[i]) && Class(o).S(0, 8) == 'Required') {
			if (!o.onblur) o.onblur = function() { Require(this); };
			if (!o.onchange) o.onchange = function() { Require(this); if (this.form.CHANGES) this.form.CHANGES.value++ };
			if (!o.onmouseup) o.onmouseup = function() { Require(this, 1) };
			if (!o.onkeyup) o.onkeyup = function() { Require(this, 1) };
			if ((o.type == 'checkbox' || o.type == 'radio') && !o.onkeydown) o.onkeydown = function() { Require(this) };
			if (o.name && HasMatch(o.name, /_MM$/)) o.onblur = o.onchange = o.onmouseup = o.onkeyup = o.onkeydown = function() { Require(this, 1) };
		} else if (o && o.form && o.form.CHANGES) {
			if (!o.onchange) o.onchange = function() { this.form.CHANGES.value++ };
		}
	}
	a = Tags('TR');
	for (i in a) {
		if ((o = a[i]) && o.id && HasMatch(Class(o), /^Row[01]/)) {
			if (!o.onmouseover) o.onmouseover = function(){RowOn(this)};
			if (!o.onmouseout) o.onmouseout = function(){RowOff(this)};
			if (!o.onclick) o.onclick = function(){RowClick(this)};
			if (!o.ondblclick) o.ondblclick = function(){RowEdit(this)};
			if (!o.onmouseup) o.onmouseup = function(){RowUp(this)};
		}
	}
	ScrollSizing(Scrolls);
	Loaded = 1;
}
