/**
 * Royalfish FormSection class
 */
	function RFFormSection(in_sectionvar, in_sectioncontainer, in_required, in_enabled) {
		this.sectionvar = in_sectionvar;
		this.sectioncontainer = document.getElementById(in_sectioncontainer);
		this.sectioncontainer._super = this;
		this.setRequired(in_required);
		this.setEnabled(in_enabled);
		this.form = null;
		this.fields = new Array();
	}
	
	RFFormSection.prototype.addField = function(in_field) {
		in_field.section = this;
		this.fields.push(in_field);
	}
	
	RFFormSection.prototype.resetStates = function() {
		reg = new RegExp('tableDataContent', '');
		show_field_count = -1;
		for(var i = 0; i < this.fields.length; i++) {
			if(this.fields[i].getVisible()) {
				show_field_count++;
				state = (show_field_count % 2 == 0) ? 'Even' : 'Odd';
				removeClassName(this.fields[i].fieldcontainer, 'tableRowOdd');
				removeClassName(this.fields[i].fieldcontainer, 'tableRowEven');
				addClassName(this.fields[i].fieldcontainer, 'tableRow'+state);
				tds = this.fields[i].fieldcontainer.getElementsByTagName('TD');
				for(var j = 0; j < tds.length; j++) {
					if(reg.test(tds[j].className)) {
						removeClassName(tds[j], 'tableDataContentOdd');
						removeClassName(tds[j], 'tableDataContentEven');
						addClassName(tds[j], 'tableDataContent'+state);
					}
				}
			}
		}
	}
	
	RFFormSection.prototype.getDescription = function() {
		spans = this.sectioncontainer.getElementsByTagName('SPAN');
		for(var i = 0; i < spans.length; i++) {
			if(spans[i].className == 'sectionDescription') {
				return spans[i].innerHTML;
			}
		}
		return 'No description found!';
	}
	
	RFFormSection.prototype.setDescription = function(in_description) {
		spans = this.sectioncontainer.getElementsByTagName('SPAN');
		for(var i = 0; i < spans.length; i++) {
			if(spans[i].className == 'sectionDescription') {
				spans[i].innerHTML = in_description;
			}
		}
	}
	
	RFFormSection.prototype.getRequired = function() {
		return this.required;
	}
	
	RFFormSection.prototype.setRequired = function(in_required) {
		this.required = in_required;
	}
	
	RFFormSection.prototype.getEnabled = function() {
		return this.enabled;
	}
	
	RFFormSection.prototype.setEnabled = function(in_enabled) {
		this.enabled = in_enabled;
	}
	
	RFFormSection.prototype.getVisible = function() {
		return (this.sectioncontainer.style.display != 'none') ? true : false;
	}
	
	RFFormSection.prototype.setVisible = function(in_visible) {
		this.sectioncontainer.style.display = (in_visible) ? "" : 'none';
	}
	
	RFFormSection.prototype.checkValue = function() {
		for(var i = 0; i < this.fields.length; i++) {
			this.fields[i].checkValue();
		}
	}
	
	RFFormSection.prototype.isCompleted = function() {
		this.checkValue();
		for(var i = 0; i < this.fields.length; i++) {
			if(this.fields[i].getError()) {
				return false;
			}
		}
		return true;
	}
	
	RFFormSection.prototype.registerEvents = function() {
		for(var i = 0; i < this.fields.length; i++) {
			this.fields[i].registerEvents();
		}
	}
	
	RFFormSection.prototype.scrollIntoView = function(focus_first_error_field) {
		scrollpx = 0;
		obj = this.sectioncontainer;
		if (obj.offsetParent) {
			scrollpx = obj.offsetTop;
			while (obj = obj.offsetParent) {
				scrollpx += obj.offsetTop;
			}
		}
		window.scrollTo(0, scrollpx);
		if(focus_first_error_field) {
			for(var i = 0; i < this.fields.length; i++) {
				if(this.fields[i].getError()) {
					this.fields[i].focus();
					break;
				}
			}
		}
		return true;
	}
	
	
/**
 * The extensions of the classes.
 */
	function RFFormSectionFieldset(in_sectionvar, in_sectioncontainer, in_required, in_enabled) {
		this.RFFormSection(in_sectionvar, in_sectioncontainer, in_required, in_enabled);
	}
	RFFormSectionFieldset.inherit(RFFormSection);
	
	function RFFormSectionFieldsetInnerSubmit(in_sectionvar, in_sectioncontainer, in_required, in_enabled) {
		this.RFFormSection(in_sectionvar, in_sectioncontainer, in_required, in_enabled);
	}
	RFFormSectionFieldsetInnerSubmit.inherit(RFFormSection);
	
	function RFFormSectionEmpty(in_sectionvar, in_sectioncontainer, in_required, in_enabled) {
		this.RFFormSection(in_sectionvar, in_sectioncontainer, in_required, in_enabled);
	}
	RFFormSectionEmpty.inherit(RFFormSection);
	
	function RFFormSectionAccessControl(in_sectionvar, in_sectioncontainer, in_required, in_enabled) {
		this.RFFormSection(in_sectionvar, in_sectioncontainer, in_required, in_enabled);
	}
	RFFormSectionAccessControl.inherit(RFFormSection);
	
