
/**
* ASP-ServerForm
* 
* @author Niels Bobogk <n.bobogk@i-d.de>
*/
(function (Form) {
	Form.MainForm = Class.create(iD.Form, {
		NAME: "iD.Form.MainForm",
		
		/**
		 * Liste der "Unterformulare" (siehe iD-dll)
		 */
		nestedForms: [],
		
		/**
		 * Liste der "Unter-Mailformulare" (siehe iD-dll)
		 */
		nestedMailForms: [],
		
		/**
		 * Initialisiert ASP-Hauptformulare und die iD-NestedForms 
		 * @param {Object} mainFormId - ID des ASP-ServerForms; default = "frmMain"
		 */
		initialize: function (mainFormId) {
			this.container = $(mainFormId) || $("frmMain");
			
			if (null != this.container) {
				try {
					// nestedforms sammeln
					$$('[data-nestedformtype="NestedForm"]').each(function(s){
						this.nestedForms.push(new iD.Form.NestedForm(s));
					}, this);
					
					// mailforms sammeln
					$$('[data-nestedformtype="MailForm"]').each(function(s){
						this.nestedMailForms.push(new iD.Form.NestedForm.MailForm(s));
					}, this);
					
					
				}
				catch(ex) {
					this.logError(ex);
				}
			}	
			
			this.container.fire(this.separatedName(":") + ":initialized");		
		}
	});
})(iD.Form);

