/*
 * ProFrom - Professzionális Felhasználói Felületek $Id: proform.js,v 1.89 2005/12/08 10:09:39 gyuris Exp $
 */

var proform = {
	/**
	 * Működési beállítások tárolása
	 */
	config : {
		// globális beállítások
		repetitionSeparatorNameBefore : '[',   // a mezők többszörözésekor alkalmazott elválasztó előtag a name attribútumon
		repetitionSeparatorNameAfter : ']',    // a mezők többszörözésekor alkalmazott elválasztó utótag a name attribútumon
		repetitionRegExpName : /\[([\d]+)\]$/, // a name attribútumra illeszkedő kifejezés ( az $1 maga a szám)
		repetitionSeparatorIdBefore : ':',     // a mezők többszörözésekor alkalmazott elválasztó előtag az id attribútumon
		repetitionSeparatorIdAfter : '',       // a mezők többszörözésekor alkalmazott elválasztó utótag az id attribútumon
		repetitionRegExpId : /:([\d]+)$/,      // az id attribútumra illeszkedő kifejezés ( az $1 maga a szám)
		idEnding : '_[a-zA-Z0-9_]+',           // nem lézető ID esetén megkeresett elemek végződése (merging!)
		alertOnError : true,                   // rendszerüzenet: nem elküdhető form
		alertOnIEDisabledOption : true,        // IE alatt, ha egy select > option disabled, annak kiválasztásakor van-e hibaüzenet (-> IEDisabledOptionAlert, activeForm.htc )
		overwriteSubmit : null,                // a form elküldésének szabályait figyelmen kivül hagyja - ha nem null - és true vagy hamis értékkel tér vissza az isSendable
		
		// blokk színtű beállítások
		autoFocus : true,                      // lap indulása és új blokk beszúrásakor
		errorFocus : true,                     // hibás kitöltés után van-e fókusz?
		autoInsertText : true,                 // az insertText automatikus generálása, ha hiányzik
		insertBlockPosition : 'before',        // egy új blokk beszúrásának helye: 'before', 'after'
		showRepetitionPanel : true,            // a többszöröző panel megjelenik-e?
		disableButtonAdd : false,
		disableButtonRemove : false,
		disableButtonMoveup : false,
		disableButtonMovedown : false,
		disableOnInit : false,                 // az onInit esemény ellenőrzése kimarad
		onlyFocusOut : false,                  // csak a mező elhagyásakor van esemény
		onlyFireElement : false,               // gyorsítás: csak azt az elemet adjuk át, amely kiváltotta az eseményt (névhivatkozás nincs, összefüggés nincs)
		
		// CSS osztályok nevei
		proform : 'proform',
		required : 'required',
		warning : 'warning',
		panel : 'panel',
		disabled : 'disabled',
		add : 'add',
		remove : 'remove',
		moveup : 'moveup',
		movedown : 'movedown',
		insert : 'insert',
		insertNonVisible : 'insert-nonvisible',
		proformtime : 'timepicker',				//timepicker (óra) classja
		proformstepper : 'stepper',				//stepper (léptető) classja
		proformselect : 'proform-select',
		proformselectvalue : 'proform-select-value',
		
		//helpz
		helpz : true,							//helpz warning ki(false)/be(true) kapcsoló 
		helpz_r : false,						//helpz required ki(false)/be(true) kapcsoló 
		
		helpz_warning : 'helpz_warning',		//heplz sor classja (warning)
		helpz_required : 'helpz_required',		//heplz sor classja (required)
		
		//helpz_box : true,						//helpz_box ki(false)/be(true) kapcsoló 
		//helpz_box_class : 'helpz_box',		//helpz_box doboz classja
		checkwarning : true,					//ha vannak warningok a form elküldésekor, helpz sort tesz rá(true), nem tesz rá(false).
		
		//alertbox
		overlay_class : 'div.overlay-div',		//sötétítés
		alert_class : 'div.alert-window',		//az alert box class-ja
		alert_classname : 'alert-window',		//az alert box className-je
		alert_id : 'alertbox',					//az alert box id-je
		alert_level_0 : 'alert-error-0', 		//az alert box ikonja (Súlyos hiba)	
		alert_level_1 : 'alert-error-1', 		//az alert box ikonja (hiba)
		alert_level_2 : 'alert-error-2', 		//az alert box ikonja (Figyelmeztetés)
		alert_level_3 : 'alert-info', 			//az alert box ikonja (Info)
		alertyesbutton : 'Igen', 				//az alert box gombjának felirata (yes)
		alertnobutton : 'Nem', 					//az alert box gombjának felirata (no)
		alertokbutton : 'Rendben', 				//az alert box gombjának felirata (oK)
		alertcancelbutton : 'Mégse', 			//az alert box gombjának felirata (cancel)
		
		
		
		
		// fordítások
		submitError : 'Az adatok rögzítéséhez a megjelölt mezők helyes kitöltése szükséges.',
		IEDisabledOptionAlert : 'A kért elem nem kiválasztható!',
		insertText : 'A mező beillesztéséhez kattintson ide.',
		addTitle : 'Új blokk hozzáadása',
		removeTitle : 'Aktuális blokk törlése',
		moveupTitle : 'Blokk mozgatása felfelé',
		movedownTitle : 'Blokk mozgatása lefelé',
		// debug beállítás
		debug : false                          // az ellenőrzéseket kikapcsolja
	},
	groupConfig : [ 'autoFocus', 'errorFocus', 'autoInsertText', 'insertBlockPosition', 
	                'showRepetitionPanel', 'disableButtonAdd', 'disableButtonRemove', 'disableButtonMoveup', 'disableButtonMovedown',
	                'disableOnInit', 'onlyFocusOut', 'onlyFireElement',
	                'insertText', 'addTitle', 'removeTitle', 'moveupTitle', 'movedownTitle' ],
	/**
	 * Működési beállítások változtatása
	 * @param	sConfig 	String  A beálítás azonosítója, l.: this.config
	 * @param	sValue		String   
	 */
	setConfig: function( sConfig, sValue ) {
		
		if(sConfig && sValue)
			this.config[sConfig] = sValue;
		else {
			console.debug("Bemenő paraméter: sConfig, sValue [setConfig] 97.sor, Add meg a bemenő paramétereket!");
			return false;
		}
	},
	
	/**
	 * translateStrings
	 * @param	sConfig 	String  A beálítás azonosítója, l.: this.config 
	 */
	translateStrings: function( oConfig ) {
		if( oConfig ) {
			var i;
			for ( i in oConfig ) {
				proform.setConfig( i, oConfig[i] );
			};
		}
		else {
			console.debug("Bemenő paraméter: oConfig [translateStrings] 111.sor, Add meg a bemenő paramétert!");
			return false;
		
		}
	},
	/**
	 * A form inicializálása, ellenőrzés indítása
	 */
	initForm : function( sId, fOnBeforeSubmit ) {
		
		if( !sId ) {
			console.debug('Bemenő paraméter: sId [initForm], Add meg a bemenő paramétert (A form id-jét)');
			return false;
		}
		
			proform.form = document.getElementById( sId );
			proform.onBeforeSubmit = ( typeof fOnBeforeSubmit == 'undefined' ) ? null : fOnBeforeSubmit;
			proform.form.onreset = function() { setTimeout( function() { proform.isSendable() }, 100 ) };
			proform.form.onsubmit = function() { 
				var bIsSendable = proform.isSendable();
				if ( bIsSendable == true && proform.onBeforeSubmit != null ) {
					proform.onBeforeSubmit( proform.form );
				};
				return bIsSendable;
			};

	},
	/**
	 * Ellenőrzések tárolása
	 */
	form : null,
	groups : {},
	/**
	 * Csoport - <formfields> hozzáadása ellenőrzésre
	 * @param	oConfig		Object, beállítási objektum
	 */
	addGroup : function( oConfig, bMerge ) {
		/**
		 * Lézető objektumok megkeresés: normál és merge
		 * Általában minden elemet a saját ID-n kell megadni, úgy hogy az ne tartalmazza az ismétlődési elemeket. Ez alól 
		 * kivétel a választógomb (input type=radio), amit a name értékvel kell megadni. Az Id-k automatikusan meg lesznek
		 * keresve hozzá.
		 * Ha egy olyan azonosító van megadva, amely nem látezik, akkor megpróbálja megkeresni azokat az elemeket amelyek
		 * végződésükkel illeszkednek erre az aznosítóra ( tipikusan ilyenek a több tagból álló mezők: text_a, text_2...)
		 */
		function getExistings( el ) {
			var i, j, rArray = [], sId, sName, oEndingRegExp, oNameRegExp, aMatch, aId, bRepeat, sBase, sSide;
			function checkEnding( els ) {
				for ( j = 0; j < els.length; j++ ) {
					if ( ( aMatch = els[j].id.match( oEndingRegExp ) ) != null ) rArray.push( aMatch[1] );
				};
			};
			oNameRegExp = new RegExp( '^(.+)' + ( proform.config.repetitionSeparatorIdBefore != '' ? '\\' + proform.config.repetitionSeparatorIdBefore : '' ) + '0' + ( proform.config.repetitionSeparatorIdAfter != '' ? '\\' + proform.config.repetitionSeparatorIdAfter : '' ) + '$' );
			aId = el.pfConfig.elements;
			bRepeat = el.pfConfig.repeat;
			for ( i = 0; i < aId.length; i++ ) {
				sBase = bMerge ? aId[i].substring( 0, aId[i].length - 2 ) : aId[i];
				sSide = bMerge ? aId[i].substring( aId[i].length - 1 ) : '';
				// normál sima és normál sima ismétlődő + merge sima és merge sima ismétlődő összeállítása
				sId = bRepeat ? sBase + ( bMerge ? proform.config.repetitionSeparatorIdBefore + sSide + proform.config.repetitionSeparatorIdAfter : '' ) + proform.config.repetitionSeparatorIdBefore + '0' + proform.config.repetitionSeparatorIdAfter :
				                sBase + ( bMerge ? proform.config.repetitionSeparatorIdBefore + sSide + proform.config.repetitionSeparatorIdAfter : '' );
				if ( document.getElementById( sId ) == null || 
				     document.getElementById( sId ).type == 'radio' ) { // bunkó IE
					// input type=radio vizsgálata
					sName = bRepeat ? sBase + ( bMerge ? proform.config.repetitionSeparatorNameBefore + sSide + proform.config.repetitionSeparatorNameAfter : '' ) + proform.config.repetitionSeparatorNameBefore + '0' + proform.config.repetitionSeparatorNameAfter : 
					                  sBase + ( bMerge ? proform.config.repetitionSeparatorNameBefore + sSide + proform.config.repetitionSeparatorNameAfter : '' );
					els = document.getElementsByName( sName ); // XXX azt is le kellene ellnőrizni, hogy az adott blokkon belül van-e...
					for ( j = 0; j < els.length; j++ ) {
						if ( bRepeat ) {
							if ( ( aMatch = els[j].id.match( oNameRegExp ) ) != null ) rArray.push( aMatch[1] );
						} 
						else rArray.push( els[j].id );
					};
					// kiegészítő típusú illeszkedés vizsgálata, egyszerűsítve: '^(' + sBase + proform.config.idEnding + ( bMerge ? proform.config.repetitionSeparatorIdBefore + sSide + proform.config.repetitionSeparatorIdAfter : '' ) + ')' + proform.config.repetitionSeparatorIdBefore + '0' + proform.config.repetitionSeparatorIdAfter + '$' : 
					oEndingRegExp = bRepeat ? 
					                new RegExp( '^(' + sBase + proform.config.idEnding + ( bMerge ? ( proform.config.repetitionSeparatorIdBefore != '' ? '\\' + proform.config.repetitionSeparatorIdBefore : '' ) + sSide + ( proform.config.repetitionSeparatorIdAfter != '' ? '\\' + proform.config.repetitionSeparatorIdAfter : '' ) : '' ) + ')' + ( proform.config.repetitionSeparatorIdBefore != '' ? '\\' + proform.config.repetitionSeparatorIdBefore : '' ) + '0' + ( proform.config.repetitionSeparatorIdAfter != '' ? '\\' + proform.config.repetitionSeparatorIdAfter : '' ) + '$' ) : 
					                new RegExp( '^(' + sBase + proform.config.idEnding + ( bMerge ? ( proform.config.repetitionSeparatorIdBefore != '' ? '\\' + proform.config.repetitionSeparatorIdBefore : '' ) + sSide + ( proform.config.repetitionSeparatorIdAfter != '' ? '\\' + proform.config.repetitionSeparatorIdAfter : '' ) : '' ) + ')' + '$' );
					checkEnding( el.getElementsByTagName('input') );
					checkEnding( el.getElementsByTagName('select') );
					checkEnding( el.getElementsByTagName('textarea') );
				}
				else { // normál sima és normál sima ismétlődő + merge sima és merge sima ismétlődő összeállítása
					rArray.push( aId[i] );
				};
			};
			return rArray;
		};
		function initItem( el ) {
			if ( isSpecified( el, 'title' ) ) {	// alapértelmezett title attribútum eltárolása a warning hibaüzenet után-ra
				el.setAttribute( 'normTitle', el.getAttribute( 'title' ) );
			};
		};
		var el, elInput, j, k, els;
		// alapértelmezett értékek
		if ( typeof oConfig.repeat == 'undefined' ) {
			oConfig.repeat = false;	
		};
		if ( typeof oConfig.repeatMin == 'undefined' ) {
			oConfig.repeatMin = 0; // ha nem ad meg repeatMin-t, de repeat-true, akkor törölni lehet!
		};
		if ( typeof oConfig.repeatMax == 'undefined' ) {
			oConfig.repeatMax = Number.MAX_VALUE;
		};
		if ( typeof oConfig.alter == 'undefined' ) {
			oConfig.alter = null;
		};
		if ( typeof oConfig.config == 'undefined' ) {
			oConfig.config = {};
		};
		if ( typeof oConfig.mode == 'undefined' ) {
			oConfig.mode = 1; // 1 - normál; 2 - merging
		};
		if ( typeof oConfig.processor == 'undefined' ) {
			oConfig.processor = oConfig.checkFunction || function() { return true };
		};
		if ( typeof oConfig.elements == 'undefined' ) {
			oConfig.elements = oConfig.checkElements || [];
		};
		if ( typeof oConfig.validate == 'undefined' ) {
			oConfig.validate = false;
		};
		// csoport csatolás
		if ( ( el = document.getElementById( oConfig.id ) ) == null ) {; // TABLE
			return false;
		};
		el.pfConfig = oConfig;
		el.pfConfig.insertObjAvailable = ( el.pfConfig.repeat && el.pfConfig.repeatMin == 0 && typeof el.pfConfig.insertId != 'undefined' ) ? true : false;
		// repeat == true && repeatMin == undefined || 0 -> repeatText generálás;
		// Ha elfelejti megadni az insertId-t, akkor nem lehet insertText-el kezdeni, de nem okoz hibát, legeneráljuk a 
		// repeatText alapján. Ha megadja a insertId-t ( és a táblázat előtt közvetlenül ott van a XHTML-ben is), akkor attól
		// függ, hogy melyikkel kezdünk, hogy melyiken van az insertNonVisible (table vagy span)
		if ( el.pfConfig.insertObjAvailable ) {
			el.insertObj = document.getElementById( el.pfConfig.insertId );
		};
		// a csoporthoz tartozó mezők incializációja
		if ( el.pfConfig.validate == true ) {
			el.pfConfig.elements = getExistings( el );
		};
		els = {};
		for ( j = 0; j < el.pfConfig.elements.length; j++ ) {
			if ( !el.pfConfig.repeat ) { // egyes elemek inicializálása
				if ( ( elInput = document.getElementById( el.pfConfig.elements[j] ) ) != null  ) {
					initItem( elInput );
					els[el.pfConfig.elements[j]] = true; // eseménykötések megjegyzése
				};
			}
			else { // ismételhető elem
				k = 0;
				while ( ( elInput = document.getElementById( el.pfConfig.elements[j] + proform.config.repetitionSeparatorIdBefore + k + proform.config.repetitionSeparatorIdAfter ) ) != null ) {
					initItem( elInput );
					k++;
				};
				if ( k > 0 ) {
					els[el.pfConfig.elements[j]] = true; // eseménykötések megjegyzése
				};
			};
		};
		el.pfConfig.elements = els;
		// csoport regisztrálása
		proform.groups[el.pfConfig.id] = el;
	},
	

	
	/**
	 * Inicializálja a teljes dokumentumban a klónozást és az ellenőrzéseket. Itt kezdődik a futás.
	 */
	init : function() {
		var i, j, k = 0, f, elTable;
		// segédek inidítása
		/*proform.helper.initTextAreaMaxLength();*/
		proform.initPlugin();
		proform.timePickerinit();
		proform.stepperinit();
		
		
		
		if ( document.body.activeForm ) {
			document.body.activeForm.alertOnDisabledOption = proform.config.alertOnIEDisabledOption;
			document.body.activeForm.disabledOptionAlert = proform.config.IEDisabledOptionAlert;
		};
		// csoportok inicializálása
		els = proform.form.getElementsByTagName('fieldset');
		for ( i in proform.groups ) {
			elTable = proform.groups[i];
			// globális config átvétel
			for ( f = 0; f < proform.groupConfig.length; f++ ) {
				if ( typeof elTable.pfConfig.config[proform.groupConfig[f]] == 'undefined' ) {
					elTable.pfConfig.config[proform.groupConfig[f]] = proform.config[proform.groupConfig[f]];
				};					
			};
			// autoFocus megvalósítása, a form első elemére
			if ( elTable.pfConfig.config.autoFocus && k == 0 && elTable.tBodies.length > 0 ) {
				proform.moveFocus( 'firstElement', proform.getBlockElements( elTable.tBodies[0], 0 ).elements );
			};
			k++;
			// KLÓNOZÁS inicializáció
			if ( elTable.pfConfig.repeat ) {
				// klónozás előkészítése
				elTable.cloneBase = ( elTable.tBodies.length > 0 ) ? elTable.tBodies[elTable.tBodies.length - 1].cloneNode( true ) : null;
				// gombok készítése
				if ( elTable.pfConfig.config.showRepetitionPanel ) {
					for ( j = 0; j < elTable.tBodies.length; j++ ) {
						proform.createPanel( elTable.tBodies[j] );
					};
				};
				// ID-k és gombok beállítása
				proform.finish( elTable );
				// beszúrási szöveg inicializáció!
				if ( elTable.pfConfig.repeat && elTable.pfConfig.repeatMin == 0 ) {
					// ha nem volt megadva beszúró szöveg
					if ( !elTable.pfConfig.insertObjAvailable && elTable.pfConfig.config.autoInsertText ) {
						elTable.insertObj = document.createElement( 'span' );
						elTable.insertObj.className = proform.config.insert;
						elTable.insertObj.appendChild( document.createTextNode( elTable.pfConfig.config.insertText ) );
						elTable.parentNode.insertBefore( elTable.insertObj, elTable );
						elTable.pfConfig.insertObjAvailable = true;
					}
					if ( elTable.pfConfig.insertObjAvailable ) {
						elTable.insertObj.onclick = function() { proform.insert( this ); return false };
						// beszúró szöveg vagy az első blokk jelenik meg?
						if ( hasClass( elTable, proform.config.insertNonVisible ) ) {
							while( elTable.tBodies.length != 0 ) {
								elTable.removeChild( elTable.tBodies[0] );
							};
							removeClass( elTable.insertObj, proform.config.insertNonVisible );	
						} 
						else {
							addClass( elTable.insertObj, proform.config.insertNonVisible );	
						};
					};
				};
			};
			// kötelező mezők inicializálása - cloneBase után IE miatt!
			proform.addEvent( elTable.getElementsByTagName('input'),    elTable.pfConfig );
			proform.addEvent( elTable.getElementsByTagName('textarea'), elTable.pfConfig );
			proform.addEvent( elTable.getElementsByTagName('select'),   elTable.pfConfig );
			
			
			
			// ellenörzés első futás
			if ( !elTable.pfConfig.config.disableOnInit ) {
				proform.process( elTable, 'onInit' );
			};
		};
	},
	/**
	 * insert
	 * @param	elP	
	 */
	
	insert : function( elP ) {
		if(elP) {
			var elTable = getNextElement( elP );
			removeClass( elTable, proform.config.insertNonVisible );
			addClass( elP, proform.config.insertNonVisible );
			if ( elTable.tBodies.length == 0 ) {
				proform.addRepetitionBlock( elTable );
			}
			else {
				if ( elTable.pfConfig.alter != null && typeof elTable.pfConfig.alter.onAddRepetitionBlock != 'undefined'  ) {
					elTable.pfConfig.alter.onAddRepetitionBlock( elTable, elTable.tBodies[0], proform.getBlockElements( elTable.tBodies[0], 0 ).elements );
				};
				proform.process( elTable, 'onAddRepetitionBlock' );
			};
		}
		else {
			console.debug("Bemenő paraméter: elP [insert], Add meg a bemenő paramétert!");
			return false;

		}
		
		
	},
	/**
	 * Duplikálás
	 * @param	elReference		elDOMElement, Az a gomb, amelynek blokkjához viszonyítva kell duplikálni. A gombot generáljuk a createPanel-ban.
	 */
	addRepetitionBlock : function( elReference ) {
	
		if(elReference) {
			var elTable, elTBody = null, elNewTBody, elsInput, i, oEls;
			switch( elReference.nodeName.toLowerCase() ) {
				case 'table' : // insert -> nincs egyetlen elem sem (külső vagy belső)
					elTable = elReference;
					break;
				case 'tbody' : // külső meghívás
					elTBody = elReference;
					elTable = elTBody.parentNode;
					break;
				case 'span' : // normál belső hívás
					elTBody = elReference.parentNode.parentNode.parentNode.parentNode;
					elTable = elTBody.parentNode;
					break;
				default : 
					return false;
			};
			// leklónozzuk a táblázat utolsó TBODY-ját
			if ( elTable.cloneBase == null ) {
				return false;
			};
			elNewTBody = elTable.cloneBase.cloneNode( true );
			// ellenőrzés inicializálása, amelyiknél szükséges
			proform.addEvent( elNewTBody.getElementsByTagName('input'),    elTable.pfConfig );
			proform.addEvent( elNewTBody.getElementsByTagName('textarea'), elTable.pfConfig );
			proform.addEvent( elNewTBody.getElementsByTagName('select'),   elTable.pfConfig );
			// INPUT, TEXTAREA elemek üresítése, OPTION mezők selected értékének ürítése
			elsInput = elNewTBody.getElementsByTagName('input');
			for ( i = 0; i < elsInput.length; i++ ) {
				if ( elsInput[i].type == 'text') {
					elsInput[i].value = '';
				};
				if ( elsInput[i].type == 'checkbox' || elsInput[i].type == 'radio' ) {
					elsInput[i].checked = false;
				};
			};
			elsInput = elNewTBody.getElementsByTagName('textarea');
			for ( i = 0; i < elsInput.length; i++ ) {
				elsInput[i].value = '';
			};
			elsInput = elNewTBody.getElementsByTagName('select');
			for ( i = 0; i < elsInput.length; i++ ) {
				elsInput[i].selectedIndex = elsInput[i].type == 'select-one' ? 0 : -1;
			};
			// elhelyezés
			if ( elTBody != null ) {
				if ( elTable.pfConfig.config.insertBlockPosition == 'after' || ( is.gecko && is.geckoRv < 1.4 ) ) { // mozilla1.0 bug: csak after lehet mozilla1.0-ban
					elTable.insertBefore( elNewTBody, elTBody.nextSibling );
				}
				else if ( elTable.pfConfig.config.insertBlockPosition == 'before' ) {
					elTable.insertBefore( elNewTBody, elTBody );
				};
			}
			else {
				elTable.appendChild( elNewTBody );
				if ( is.gecko && is.geckoRv < 1.4 ) { // mozilla1.0 bug: különben nem jelneik meg a képernyőn...
					elTable.style.display = 'table';
				};
			};
			// a kezelőfelülete legyártása
			if ( elTable.pfConfig.config.showRepetitionPanel ) {
				proform.createPanel( elNewTBody );
			};
			// rendbetétel: újraszámozás és '-' gomb (kötelező blokkcsoport vizsgálata)
			proform.finish( elTable );
			// autoFocus a beszúrt blokk első elemére
			oEls = proform.getBlockElements( elNewTBody ).elements;
			if ( elTable.pfConfig.config.autoFocus ) {
				proform.moveFocus( 'firstElement', oEls );
			};
			// módosító
			if ( elTable.pfConfig.alter != null && typeof elTable.pfConfig.alter.onAddRepetitionBlock != 'undefined'  ) {
				elTable.pfConfig.alter.onAddRepetitionBlock( elTable, elNewTBody, oEls );
			};
			// pluginek újrainicializálása
			proform.resetPlugin();
			// ellenőrzés
			proform.process( elTable, 'onAddRepetitionBlock' );
			/*proform.helper.initTextAreaMaxLength();*/
		}
		else {
			console.debug("Bemenő paraméter: elReference [addRepetitionBlock], Add meg a bemenő paramétert!");
			return false;
		}
	},
	/**
	 * Törlés
	 * @param	elReference		elDomElement    Az a gomb, amelynnek a blokk-ját el kell távolítani.  A gombot generáljuk a createPanel-ban.
	 */
	removeRepetitionBlock : function( elReference ) {
		
		if(elReference) {
			var elTBody, elTable, oEls;
			switch( elReference.nodeName.toLowerCase() ) {
				case 'tbody' :
					elTBody = elReference;
					elTable = elTBody.parentNode;
					break;
				case 'span' :
					elTBody = elReference.parentNode.parentNode.parentNode.parentNode;
					elTable = elTBody.parentNode;
					break;
				default : 
					return false;
			};
			// törlés előtt lekérjük az elemeket
			oEls = proform.getBlockElements( elTBody );
			elTable.removeChild( elTBody );
			// rendbetétel: újraszámozás és '-' gomb (kötelező blokkcsoport vizsgálata)
			proform.finish( elTable );
			// módosító
			if ( elTable.pfConfig.alter != null && typeof elTable.pfConfig.alter.onRemoveRepetitionBlock != 'undefined'  ) {
				elTable.pfConfig.alter.onRemoveRepetitionBlock( elTable, elTBody, oEls.elements );
			};
			// ellenőrzés
			proform.process( elTable, 'onRemoveRepetitionBlock' );
			// insert Object beszúrása
			if ( elTable.tBodies.length == 0 && elTable.pfConfig.insertObjAvailable ) { // vagyis repeatMin == 0 és repeat == true
				removeClass( elTable.insertObj, proform.config.insertNonVisible );
			};
		}
		else {
			console.debug("Bemenő paraméter: elReference [removeRepetitionBlock], Add meg a bemenő paramétert!");
			return false;
		}
	},
	/**
	 * Mozgatás fel és le
	 * @param	elReference		elDomElement    Az a gomb, amelynnek a blokk-ját el kell távolítani.  A gombot generáljuk a createPanel-ban.
	 * @param	nDirection		Number           Az irány jelzése ( 1 vagy -1), külső meghívása nincs.
	 */
	moveRepetitionBlock : function ( elReference, nDirection ) {
	
	if(elReference && nDirection) {
	
			var elTBody, elSibling;
			switch( elReference.nodeName.toLowerCase() ) {
				case 'tbody' :
					elTBody = elReference;
					break;
				case 'span' :
					elTBody = elReference.parentNode.parentNode.parentNode.parentNode;
					break;
				default : 
					return false;
			};
			if ( nDirection == -1 ) {
				if ( ( elSibling = getPreviousElement( elTBody ) ).nodeName.toLowerCase() == 'tbody' ) {
					if ( is.gecko && is.geckoRv < 1.4 && elSibling == elSibling.parentNode.tBodies[0] ) { // mozilla1.0 bug, első helyre nem lehet beszúrni
						if ( elSibling.parentNode.tBodies.length == 2 ) {
							elSibling.parentNode.appendChild(elSibling);
						}
						else {
							elTBody.parentNode.insertBefore( elSibling, getNextElement( elTBody ) )
						};
					}
					else {
						elTBody.parentNode.insertBefore( elTBody, elSibling );
					};
				};
			}
			else {
				if ( ( elSibling = getNextElement( elTBody ) ) != null ) {
					if ( is.gecko && is.geckoRv < 1.4 && elTBody == elTBody.parentNode.tBodies[0] ) { // mozilla1.0 bug, első helyre nem lehet beszúrni
						if ( elSibling.parentNode.tBodies.length == 2 ) {
							elTBody.parentNode.appendChild(elTBody);
						}
						else {
							elTBody.parentNode.insertBefore( elTBody, getNextElement( elSibling ) )
						};
					}
					else {
						elTBody.parentNode.insertBefore( elSibling,  elTBody );
					};
				};
			};
			proform.finish( elTBody.parentNode );
			// módosító
			if ( elTBody.parentNode.pfConfig.alter != null && typeof elTBody.parentNode.pfConfig.alter.onMoveRepetitionBlock != 'undefined'  ) {
				elTBody.parentNode.pfConfig.alter.onMoveRepetitionBlock( elTBody.parentNode, elTBody, proform.getBlockElements( elTBody ).elements );
			};
			proform.process( elTBody.parentNode, 'onMoveRepetitionBlock' );
		
		}
		else {
			console.debug("Bemenő paraméterek: elReference, nDirection [moveRepetitionBlock], Add meg a bemenő paramétereket!");
			return false;
		}
		
		
		
		
		
	},
	/**
	 * Az id-k és name-k beállítása, +-▲▼  gombok beállítása, repeatMin és repeatMax alapján
	 * A hozzáadások és törlések során kialakult sorrendben beszámozza az elemeket egy táblázatban (beállítható config a
	 * formája). Meghívódik törléskor és duplikáláskor is.
	 * @param	elTable		HTMLTableElement  A táblázat, amelynek mezőit rakjuk rendbe.
	 */
	finish : function( elTable ) {
	
	
	if(elTable) {
			var i, elsInput, aCollected = [], els, bDisable = false, sFor;
			function changeIds( els, nId, bLabel ) {
				if(els && nId) {
					var i;
					for ( i = 0; i < els.length; i++ ) {
						if ( !bLabel ) {
							// input type=radio name és id különbözik!
							if ( els[i].id.indexOf( proform.config.repetitionSeparatorIdBefore ) > -1 ) {
								els[i].name = els[i].name.replace( proform.config.repetitionRegExpName, proform.config.repetitionSeparatorNameBefore + nId + proform.config.repetitionSeparatorNameAfter );
								els[i].id = els[i].id.replace( proform.config.repetitionRegExpId, proform.config.repetitionSeparatorIdBefore + nId + proform.config.repetitionSeparatorIdAfter );
							};
						}
						else {
							sFor = ( is.ie ) ? 'htmlFor' : 'for'; // stupid IE, nagyon stupid : isSpecified esetén 'for' attribútum, getAttribute pedig 'htmlFor'
							if ( isSpecified( els[i], 'for' ) && els[i].getAttribute(sFor).indexOf( proform.config.repetitionSeparatorIdBefore ) > -1 ) {
								els[i].setAttribute( sFor, els[i].getAttribute(sFor).replace( proform.config.repetitionRegExpId, proform.config.repetitionSeparatorIdBefore + nId + proform.config.repetitionSeparatorIdAfter ) );
							};
						};
					};
				}
				else {
					console.debug("Bemenő paraméterek: els, nId [changeIds] 604.sor, Add meg a bemenő paramétereket!");
					return false;
				}
				
			};
			if ( !elTable.pfConfig.config.showRepetitionPanel ) {
				return true;
			};
			for ( i = 0; i < elTable.tBodies.length; i++ ) {
				// egy táblázatban levő űrlapelemeket növekvő sorrendben újraszámozzuk (táblázat = csoport)
				changeIds( elTable.tBodies[i].getElementsByTagName('input'), i, false );
				changeIds( elTable.tBodies[i].getElementsByTagName('textarea'), i, false );
				changeIds( elTable.tBodies[i].getElementsByTagName('select'), i, false );
				changeIds( elTable.tBodies[i].getElementsByTagName('label'), i, true );
				// minden +-▲▼ gomb feloldása
				if ( !elTable.pfConfig.config.disableButtonAdd ) { 
					removeClass( elTable.tBodies[i].panelButtons.add, proform.config.disabled );
				};
				if ( !elTable.pfConfig.config.disableButtonRemove ) {
					removeClass( elTable.tBodies[i].panelButtons.remove, proform.config.disabled );
				};
				if ( !elTable.pfConfig.config.disableButtonMoveup ) {
					removeClass( elTable.tBodies[i].panelButtons.moveup, proform.config.disabled );
				};
				if ( !elTable.pfConfig.config.disableButtonMovedown ) {
					removeClass( elTable.tBodies[i].panelButtons.movedown, proform.config.disabled );
				};
				// +- tiltás: repeatMin és repeatMax szerint
				if ( elTable.pfConfig.repeatMin == elTable.tBodies.length ) {
					addClass( elTable.tBodies[i].panelButtons.remove, proform.config.disabled );
				};
				if ( elTable.pfConfig.repeatMax == elTable.tBodies.length ) {
					addClass( elTable.tBodies[i].panelButtons.add, proform.config.disabled );
				};
			};
			// ▲▼ tiltás: első és utolsó blokkban
			if ( elTable.tBodies.length > 0 ) {
				addClass( elTable.tBodies[0].panelButtons.moveup, proform.config.disabled );
				addClass( elTable.tBodies[elTable.tBodies.length - 1].panelButtons.movedown, proform.config.disabled );
			};
		
		}
		else {
			console.debug("Bemenő paraméter: elTBody [finish], Add meg a bemenő paramétert!");
			return false;
		}
		
	},
	/**
	 * A kezelő gombok legyártása
	 */
	createPanel : function( elTBody ) {
		
		if(elTBody) {
			var elPanel, panelButtons;
			function createButton( sClass, sTitle, fClick ) {
				var elButton;
				elButton = document.createElement('span');
				elButton.className = sClass + ' ' + proform.config.disabled;
				elButton.setAttribute( 'type', 'proformpanelbutton' );
				elButton.setAttribute( 'title', sTitle );
				elButton.setAttribute( 'onclick', fClick );
				return elButton;
			};
			if ( typeof proform.panelBase == 'undefined' ) { // teljesítmény miatt ezt fogjuk csak másolni
				elPanel = document.createElement('div');
				elPanel.className = proform.config.panel;
				elPanel.appendChild( createButton( proform.config.movedown, elTBody.parentNode.pfConfig.config.movedownTitle, 'if ( !hasClass( this, proform.config.disabled ) ) { proform.moveRepetitionBlock(this, 1) }' ) );
				elPanel.appendChild( createButton( proform.config.moveup,   elTBody.parentNode.pfConfig.config.moveupTitle,   'if ( !hasClass( this, proform.config.disabled ) ) { proform.moveRepetitionBlock(this, -1) }' ) );
				elPanel.appendChild( createButton( proform.config.remove,   elTBody.parentNode.pfConfig.config.removeTitle,   'if ( !hasClass( this, proform.config.disabled ) ) { proform.removeRepetitionBlock(this) }' ) );
				elPanel.appendChild( createButton( proform.config.add,      elTBody.parentNode.pfConfig.config.addTitle,      'if ( !hasClass( this, proform.config.disabled ) ) { proform.addRepetitionBlock(this) }' ) );
				proform.panelBase = elPanel;
			};
			if ( is.ie ) { // teljesítménykülönbség miatt más módszerrel
				elTBody.rows[0].cells[0].innerHTML += proform.panelBase.outerHTML;
				elTBody.panelButtons = elTBody.rows[0].cells[0].lastChild;
			}
			else {
				elTBody.panelButtons = proform.panelBase.cloneNode( true );
				elTBody.rows[0].cells[0].appendChild( elTBody.panelButtons );
			};
			elTBody.panelButtons.movedown = elTBody.panelButtons.childNodes[0];
			elTBody.panelButtons.moveup   = elTBody.panelButtons.childNodes[1];
			elTBody.panelButtons.remove   = elTBody.panelButtons.childNodes[2];
			elTBody.panelButtons.add      = elTBody.panelButtons.childNodes[3];
			proform.helper.activeForm.update( elTBody );
		}
		else {
			console.debug("Bemenő paraméter: elTBody [createPanel], Add meg a bemenő paramétert!");
			return false;
		}
	
	},
	
	
	
	/**
	 * Hozzáadja a szükséges formelemekhez az ellenőrzés kérését.
	 * @param	elsInput	namedNodeMap  Az elemek, amelyekre esetleg inicializálni kell;
	 * @param	oPfConfig	-
	 */
	addEvent : function( elsInput, oPfConfig ) {
		if(elsInput) {
			var j, sId = 'undefined', rE;
			for ( j = 0; j < elsInput.length; j++ ) {
				if ( !oPfConfig.repeat ) {
					sId = elsInput[j].id;
				}
				else if ( ( rE = elsInput[j].id.match( proform.config.repetitionRegExpId ) ) != null ) {
					sId = elsInput[j].id.substring( 0, rE.index );
				};
				if ( oPfConfig.elements[sId] ) {
					if ( elsInput[j].nodeName.toLowerCase() == 'input' && ( elsInput[j].type == 'radio' || elsInput[j].type == 'checkbox' ) ) {
						addEvent( elsInput[j], 'change', proform.onModify ); 
						addEvent( elsInput[j], 'click', proform.onModify ); 
						//addEvent( elsInput[j], 'blur', proform.helpz_boxclose(elsInput[j]) ); 
					}
					else if ( elsInput[j].nodeName.toLowerCase() == 'select' ) {
						addEvent( elsInput[j], 'change', proform.onModify ); 
						
					}
					else { // input type=text, textarea
						if ( !oPfConfig.config.onlyFocusOut ) {
							//addEvent( elsInput[j], 'keyup', proform.onModify );
							addEvent( elsInput[j], 'blur', proform.onModify );
							
							//addEvent( elsInput[j], 'blur', function() {proform.helpz_box_close(elsInput[j]);}  ); 
						};
						addEvent( elsInput[j], 'blur', proform.onModify ); // a proform és a datepicker együttműködés miatt van erre szükség
					};
				};
			};
	
		}
		else {
				console.debug("Bemenő paraméter: elsInput [addEvent], Add meg a bemenő paramétert!");
				return false;
		}
		
	},
	/**
	 * Egy olyan mező hívja meg, amelynek ellenőrzését beállították az inicializációs előtt
	 */
	onModify : function( e, el ) {
		function getRoot( el ) {
			if(el) {
				if ( el.nodeName.toLowerCase() == 'tbody' ) {
					return el;
				};
				return getRoot( el.parentNode );
			}
			else {
				console.debug("Bemenő paraméter: el [getRoot], Add meg a bemenő paramétert!");
				return false;
			}
		};
		if ( is.ie ) {
			e = window.event;
		};
		if ( e == null ) { // datepicker onUpdate elkapása
			e = { type : '' };
		};
		if ( !el ) {
			el = this;
		};
		proform.process( getRoot( el ), ( e.type == 'blur' || e.type == 'change' ) ? 'onFocusOut' : 'onModify', el ); // TABLE, input mező
	},
	
	/**
	 * getBlockElements
	 * @param	elTBody 	HTMLTableElement  Az a táblázat, amelyben ellenőrzünk
	 * @param	j			?
	 * @param	elFire		?
	 */
	getBlockElements : function( elTBody, elFire, j ) {
		var oElements, i, el, sFireId = null;
		elTable = elTBody.parentNode;
		if ( typeof j == 'undefined' ) {
			for ( j = 0; j < elTable.tBodies.length; j++ ) {
				if ( elTable.tBodies[j] == elTBody ) {
					break;
				};
			};
		};
		oElements = {};
		for ( i in elTBody.parentNode.pfConfig.elements ) {
			el = elTBody.parentNode.pfConfig.repeat ? document.getElementById( i + proform.config.repetitionSeparatorIdBefore + j + proform.config.repetitionSeparatorIdAfter ) : document.getElementById( i );
			if ( typeof elFire != 'undefined' && el == elFire ) {
				sFireId = i;
			};
			oElements[ elTBody.parentNode.pfConfig.mode == 1 ? i : i.match( proform.merging.config.sideRegExpStart )[1] ] = el;
		};
		return  { elements : oElements, fireId : sFireId };
	},

	 /**
	 * Ellenőrzéseket kéri le.
	 * @param	el			HTMLTableElement  Az a táblázat, amelyben ellenőrzünk
	 * @param	Command		értéke lehet(onInit)
	 * @param	elFire		?
	 */
	process : function( elT, sCommand, elFire ) {

		var i, bReturn = true;
		function processElement( elTBody, elFire ) {
			var	sFireId, oElements = {};
			sFireId = elTBody.parentNode.pfConfig.repeat ? elFire.id.substring( 0, elFire.id.lastIndexOf( proform.config.repetitionSeparatorIdBefore ) ) : elFire.id;
			
			oElements[elTBody.parentNode.pfConfig.mode == 1 ? i : i.match( proform.merging.config.sideRegExpStart )[1]] = elFire;
			return elTBody.parentNode.pfConfig.processor( oElements, sCommand, sFireId );
		};
		
		function processBlock( elTBody, i ) {
			var oBlockElements = proform.getBlockElements( elTBody, elFire, i );
			return elTBody.parentNode.pfConfig.processor( oBlockElements.elements, sCommand, oBlockElements.fireId );
		};
		if ( elT.nodeName.toLowerCase() == 'tbody' ) { // csak egy TBODY-ra vizsgálunk
			if ( elFire && elT.parentNode.pfConfig.config.onlyFireElement ) {
				return processElement( elT, elFire );
			};
			return processBlock( elT );
		}
		else { // vagy egy egész táblázatra - ilyenkor nincs elFire...
			if ( elT.pfConfig.repeatMin == 0 && elT.tBodies.length == 0 ) {
				return true;
			};
			for ( i = 0; i < elT.tBodies.length; i++ ) {
				if ( processBlock( elT.tBodies[i], i ) == false ) {
					bReturn = false;
				};
			};
			return bReturn;
		};
	//}
	},
	/**
	 * Egy űrlap elküldhető-e, összesített csoport ellenőrzés
	 * display : none-os elemek nem kerülnek ellenőrzésre
	 elTable
	 */
	isSendable : function() {
		var i, elTable;
		if ( proform.config.overwriteSubmit != null ) {
			return proform.config.overwriteSubmit;
		};
		for ( i in proform.groups ) { // ha bármelyik csoport nem küldhető, akkor az egész form sem küldhető
			elTable = proform.groups[i];

			//tabnál szabadon változtatható a HTML alapján
			elTabContent = elTable.parentNode.parentNode.parentNode.parentNode
			

			if ( !proform.process( elTable, 'onIsSendable' ) && (elTable.parentNode.style.display!='none' || elTable.parentNode.className=='tabs')  && (elTabContent.style.display != 'none')) {
			
				if ( proform.config.alertOnError ) {


					
					proform.searchrequired(proform.form);
					
					//if(proform.config.checkwarning) 
					//proform.searchwarning(proform.form);


				};
				if ( elTable.pfConfig.config.errorFocus ) {
					proform.moveFocus( 'firstError', proform.form );
				};
				return false;
			};
		};
		return true;
	},
	/**
	* autoFocus megvalótítása, hidden FIELDSET-ekbe nem keres.
	* @param	sCommand	
	* @param	el 			amelyik elemben keres (form)
	*/
	moveFocus : function( sCommand, el ) {
		var i;
		switch ( sCommand ) {
			case 'firstElement' :
				for ( i in el ) {
					if ( el[i].type != 'hidden' && el[i].disabled != true && el[i].readOnly != true  ) {
						try {
							el[i].focus();
						} catch( ex ) {};
						break;
					};
				};
				break;
			case 'firstError' : // el -> form
				for ( i = 0; i < el.elements.length; i++ ) {
					if ( el.elements[i].nodeName.toLowerCase() == 'input' && ( el.elements[i].type == 'checkbox' || el.elements[i].type == 'radio' ) ) {
						if ( hasClass( proform.helper.getLabel( el.elements[i], true ), proform.config.required ) ) {
							el.elements[i].focus();
							break;
						};
					}
					else if ( hasClass( el.elements[i], proform.config.required ) || hasClass( el.elements[i], proform.config.helpz_warning ) ) {
						el.elements[i].focus();
						return el.elements[i];
						break;
					};
				};
				break;
		};
	},
// Kisegítők 
	/**	Figyelmeztető sort szúr be az elem alá (helpz)
	* @param attention_element	az elem amelyik alá beszúrja a figyelmeztető sort
	* @param atype				[opcionális] hogy milyen legyen a sor class-ja (warning, required)
	*/
	attention : function( attention_element, atype ) {
		if(attention_element) {
			var error_element = attention_element;
			var parent_element = error_element.parentNode;
			/*id ben kicseréli a kettőspontot.*/
			/*error_element.id = error_element.id.replace(/\:/, "_");*/
			
			
			var ifiserrorbox = error_element.id+'_helpz';
	
			if(attention_text[error_element.id]) {
			
				if(!document.getElementById(ifiserrorbox)) {
					attention_box = document.createElement('P');
				if(atype)
					attention_box.className = atype;
				else
					attention_box.className = proform.config.helpz_warning;
				
				addClass(attention_box, 'proform-equal');
				
				attention_box.innerHTML = attention_text[error_element.id];
				attention_box.id = error_element.id+'_helpz';
				
				parent_element.appendChild(attention_box);
				}
			}
		}
		else {
			console.debug("Bemenő paraméter: attention_element [attention], Add meg a bemenő paramétert ( melyik elemben keressen)");
			return false;
		}
		
	},
	/** 
	*	eltávolítja a figyelmeztető sort (helpz)
	* @param	attention_element	az elem amelyikről szeretnénk eltávolítani
	*/
	removeattention : function ( attention_element ) {
		if(attention_element) {
			var parent_element = attention_element.parentNode;
			var remove_element_id = attention_element.id+'_helpz';
			
			var r_element = document.getElementById(remove_element_id);
			if(r_element) {
				//$("p.helpz_warning").animate({height: 'toggle', opacity: 'toggle'}, "fast");
				parent_element.removeChild(r_element);
				}
		}
		else {
			console.debug("Bemenő paraméter: attention_element [removeattention], Add meg a bemenő paramétert ( melyik elemről el szeretnénk távolítani)");
			return false;
		}	
	}, 
	
	/**
	* megkeresi az összes warning elemet a beadott el -en belül és ráteszi az attention boxokat
	* @param	el - ebben az elemben keres
	*/
	searchwarning : function ( el ) {
		if(el) {
			var i;
			var formLength;
			var formElement;
			formLength=el.elements.length;
		
			for ( i=0 ; i<formLength; i++)	{
				formElement=el.elements[i];
				if (hasClass( formElement, proform.config.warning)) {
					proform.attention(formElement, proform.config.helpz_warning);
					
					proform.moveFocus( 'firstError', proform.form );
					
				}
			}
		}
		else {
			console.debug("Bemenő paraméter: el [searchwarning], Add meg a bemenő paramétert (melyik elemben keressen)");
			return false;
		}
	},
	/**
	* megkeresi az összes required elemet a beadott el -en belül és ráteszi az attention boxokat
	* @param	el - ebben az elemben keres
	*/
	searchrequired : function ( el ) {
		if(el) {
			var i;
			var formLength;
			var formElement;
			formLength=el.elements.length;
			
			for ( i=0 ; i<formLength; i++)	{
				formElement=el.elements[i];
				
				if (hasClass( formElement, proform.config.required) && proform.config.helpz_r) {
					proform.attention(formElement, proform.config.helpz_required);
					
					proform.moveFocus( 'firstError', proform.form );
					
					
				}
			}
		}
		else {
			console.debug("Bemenő paraméter: el [searchrequired], Add meg a bemenő paramétert (melyik elemben keressen)");
			return false;
		}
		
	},
	/** elsötétíti a képenyőt */
	darkOverlay : function ( color ) {

	var objBody = document.getElementsByTagName("body").item(0);
		//ellenőrzés
		if( !objBody ) {
			console.debug("Függvényben létrehozott változó: objBody [darkOverlay], Nem találta meg a objBody = document.getElementsByTagName('body').item(0)");
			return false;
		}

	
		
		var prev_overlay = document.getElementById('overlay');
		if(prev_overlay)
			document.body.removeChild(prev_overlay);
		
		var objOverlay = document.createElement("div");
		objOverlay.id = 'overlay';
		objOverlay.className = 'overlay-div';
		
		objBody.appendChild(objOverlay);
		
		// kihúzza a képernyő széléig a hátteret
		var arrayPageSize = getPageSize();
		
		
		//a select mezők miatt
		if(is.ie) {
			var alertiframe  = document.createElement('iframe');
			alertiframe.src = 'blank.html';
			alertiframe.id = 'alertiframe';
		if( color )
			alertiframe.style.backgroundColor = "#"+color;
		else
			alertiframe.style.backgroundColor = "#000";
			document.body.appendChild(alertiframe);
		}
		//console.debug(arrayPageSize);
		objOverlay.style.width = arrayPageSize[0]+"px";
		objOverlay.style.height = arrayPageSize[1]+"px";
		
		if(is.ie) {
			alertiframe.style.width = arrayPageSize[0]+"px";
			alertiframe.style.height = arrayPageSize[1]+"px";
		}

		//animálás
		if(!is.ie)
			$(proform.config.overlay_class).animate({ opacity: "show"}, 200);
		
		return true;
	},
	
	/** eltünteti a sötétítést */
	darkOverlayend : function () {

		var objOverlay = document.getElementById('overlay');
		if(objOverlay) {
			//animálás
			if (is.ie)
				document.body.removeChild(objOverlay);
			else
				$(proform.config.overlay_class).animate({ opacity: "hide"}, 200);

		}
		else {
			console.debug("Függvényben létrehozott változó: objOverlay [darkOverlayend] 1096.sor, Nem találta meg a objOverlay-t");
			return false;
		}
	return true;
	},
	
	
	
	/**
	* felugró figyelmeztető ablak
	* (az id-t és a class-t a configból veszi,)
	* @param	alert_head		STRING a boxban lévő cím szövege 
	* @param	alert_text		STRING a boxban lévő üzenet szövege
	* @param	alert_level		NUM A Hiba szintje (ikon) ( level_0: súlyos hiba, level_1: általános hiba, level_2:Figyelmeztetés, level_3:Info)
	* @param	alert_button	NUM gombok száma ( level_1: OK; level_2: IGEN,NEM; level_3:IGEN,NEM,MÉGSE )
	*/
	alertbox : function ( alert_head, alert_text, alert_level, alert_button ) {
		
		var body = document.getElementsByTagName('body')[0];
	
		if(window.scrollbars)
			window.scrollbars.visible = false; 
			
		proform.darkOverlay();
			
			
		//ablak létrehozása
		var alertdiv  = document.createElement('div');
		alertdiv.id = proform.config.alert_id;
		alertdiv.className = proform.config.alert_classname;
		
		alertdiv.style.display = 'none';
		
		//ablak létrehozása
		var alertcontentdiv  = document.createElement('div');
		if(alert_level) {
			if(alert_level == 'level_0')
				alertcontentdiv.className = proform.config.alert_level_0;
			if(alert_level == 'level_1')
				alertcontentdiv.className = proform.config.alert_level_1;
			if(alert_level == 'level_2')
				alertcontentdiv.className = proform.config.alert_level_2;
			if(alert_level == 'level_3')
				alertcontentdiv.className = proform.config.alert_level_3;
		}
		else {
			console.debug("Bemenő paraméter: alert_level [alertbox], Add meg a bemenő parmétert (Hiba aszintje, ikon)");
			return false;
		}
		//ablak tetejének létrehozása
		var alerttop  = document.createElement('h1');
		alerttop.innerHTML = '&nbsp;';
		
		//cím létrehozása
		var alerttitle  = document.createElement('h2');
		if(alert_head)
			alerttitle.innerHTML = alert_head;
		else {
			console.debug("Bemenő paraméter: alert_head [alertbox], Add meg a bemenő parmétert (cím szövege)");
			return false;
		}
		//üzenet létrehozása
		var alerttext  = document.createElement('p');
		if(alert_text)
			alerttext.innerHTML = alert_text;
		else {
			console.debug("Bemenő paraméter: alert_text [alertbox], Add meg a bemenő parmétert (üzenet szövege)");
			return false;
		}
		
		
		
		

		document.body.appendChild(alertdiv);
		alertdiv.appendChild(alertcontentdiv);
		//alertcontentdiv.appendChild(alertcloser);
		alertcontentdiv.appendChild(alerttop);
		alertcontentdiv.appendChild(alerttitle);
		alertcontentdiv.appendChild(alerttext);
	
	
		var confirmdiv = document.createElement('DIV');
		confirmdiv.className = 'text-center';
		alertcontentdiv.appendChild(confirmdiv);
	
		if(alert_button) {
			if(alert_button == 'button_1') {
	
				var alertokbutton  = document.createElement('BUTTON');
				alertokbutton.innerHTML = proform.config.alertokbutton;
				
				alertokbutton.onclick= proform.removeAlert;
				
				confirmdiv.appendChild(alertokbutton);
	
			}
			if(alert_button == 'button_2') {
			
	
				var alertYesbutton  = document.createElement('BUTTON');
				var alertNobutton  = document.createElement('BUTTON');
				alertYesbutton.innerHTML = proform.config.alertyesbutton;
				alertNobutton.innerHTML = proform.config.alertnobutton;
				
				
				alertNobutton.onclick= proform.removeAlert;
				
				confirmdiv.appendChild(alertYesbutton);
				confirmdiv.appendChild(alertNobutton);
	
				alertYesbutton.onclick = function () {
					proform.removeAlert();
					
					//itt küldi el a formot
					document.forms[0].submit();
				} 
			}
			
			if(alert_button == 'button_3') {
			
	
				var alertYesbutton  = document.createElement('BUTTON');
				var alertNobutton  = document.createElement('BUTTON');
				var alertCancelbutton  = document.createElement('BUTTON');
				alertYesbutton.innerHTML = proform.config.alertyesbutton;
				alertNobutton.innerHTML = proform.config.alertnobutton;
				alertCancelbutton.innerHTML = proform.config.alertcancelbutton;
				
				
				alertNobutton.onclick= proform.removeAlert;
				alertCancelbutton.onclick= proform.removeAlert;
				
				confirmdiv.appendChild(alertYesbutton);
				confirmdiv.appendChild(alertNobutton);
				confirmdiv.appendChild(alertCancelbutton);
	
				alertYesbutton.onclick = function () {
					proform.removeAlert();
					
					//itt küldi el a formot
					document.forms[0].submit();
				} 
			}
		}
		else {
			console.debug("Bemenő paraméter: alert_button [alertbox], Add meg a bemenő parmétert (gombok száma)");
			return false;
		}
		
		
		//pozicionálás
		AlertposY = body.offsetHeight/2 - 100 + 'px';
		AlertposX = body.offsetWidth/2 - 150 + 'px';
		
		alertdiv.style.top = '300px';
		alertdiv.style.left = AlertposX;


		//Ez jeleníti meg az abalakot. 		
		$(proform.config.alert_class).animate({ opacity: "show"}, 200);
	},
	
	/** eltávolítja az Alertboxot */
	removeAlert :  function () {

		proform.darkOverlayend();

		if(window.scrollbars)
			window.scrollbars.visible = true; 
		
		if(is.ie)
			document.body.removeChild(document.getElementById('alertiframe'));
		//document.getElementsByTagName('body')[0].style.overflow = 'auto';
		
		$(proform.config.alert_class).animate({ opacity: "hide"}, 200);
		
		el = document.getElementById(proform.config.alert_id);
		if(el)
			document.body.removeChild(el);
		else {
			console.debug("Függvényben létrehozott változó: el, [removeAlert], Nem tudta eltávolítani az alertablakot! ");
			return false;
		}
	},
	
	
	/** 
	timepickerinicializálás, gomb létrehozás  
	*/
	timePickerinit : function () {
		var elArray = document.body.getElementsByTagName('input');
		var elAL = elArray.length;
		elAL--;
		
		
	
		for ( elAL; elAL>=0 ; elAL--) {
			if( hasClass( elArray[ elAL ], proform.config.proformtime ) ) {
				
				var inputmin = elArray[ elAL ];
				var inputhour = inputmin.previousSibling.previousSibling;
	
	
				//a két óramezőt kitörli
				inputmin.value= "";
				inputhour.value= "";
	
				//óraikon hozzáadása
				var timebutton = document.createElement('button');
				
				timebutton.timemin = inputmin;
				timebutton.timehour = inputhour;
				timebutton.className = 'date-picker-time';
				timebutton.title = 'aktuális idő beszúrása';
				timebutton.id = inputmin.id + '_timebutton';
				timebutton.setAttribute('type', 'button');
				timebutton.onclick = proform.timePicker;
				inputmin.parentNode.appendChild(timebutton);
				
				timebutton = null;
				
				//kurzorugrató
				inputhour.timemin = inputmin;
				inputhour.timehour = inputhour;
			
				inputhour.onkeyup = proform.timeSwitch;
				

				inputhour.onclick = function () { this.select() };
				inputmin.onclick = function () { this.select() };
				}
			}
	},
	
	/** 
	* aktuális időt szúrja be a két inputmezőbe
	* @param	this	az őt meghívó függvény   
	*/
	timePicker : function () {
	
		var d = new Date(); 
		
		var hour = d.getHours();
		var minutes = d.getMinutes();
		
		

		// órakorrekció
		if(hour/10 < 1) {
			hour = hour.toString();
			hour = '0' + hour;
		}
		else if(hour < 10 && hour == 0)
			hour = '00';
		
		// perckorrekció
		if(minutes/10 <= 1) {
			minutes = minutes.toString();
			minutes = '0' + minutes;
		}
		else if(minutes == 0)
			minutes = '00';
		
		
		//aktuális óra értékének beszúrása
		Elinputhour = this.timehour;
		
		if(Elinputhour)
		Elinputhour.value = hour;
		
		
		Elinputmin = this.timemin;
	
		if(Elinputmin)
		Elinputmin.value = minutes;
	},
	
	timeSwitch : function () {

		Elinputhour = this.timehour;
		Elinputmin = this.timemin;
	
		if(Elinputhour.value.length == 2) {
		// Az exception hibát a Form autocomplete="off" kapcsolóval lehet kikapcsolni.
		Elinputmin.focus();
		Elinputmin.select();
		}
	},
	/* Léptető */
	stepperinit : function () {
		var elArray = document.body.getElementsByTagName('input');
		var elAL = elArray.length;
		elAL--;
		
		
	
		for ( elAL; elAL>=0 ; elAL--) {
			if( hasClass( elArray[ elAL ], proform.config.proformstepper ) ) {
				var inputstepper = elArray[ elAL ];



			}
		}
	},
	/*selectInit : function () {
		var elArray = document.body.getElementsByTagName('input');
		var elAL = elArray.length;
		elAL--;
	
	

		for ( elAL; elAL>=0 ; elAL--) {
			if( hasClass( elArray[ elAL ], proform.config.proformselect ) ) {
				
				
				var selectinput = elArray[ elAL ];
				
				
				
				var selectbutton = document.createElement('button');
				
				//A select div-je
				selectbutton.content = selectinput.nextSibling.nextSibling;
				selectbutton.input = selectinput;
				selectbutton.className = proform.config.proformselect;
				selectbutton.setAttribute('type', 'button');
				selectbutton.setAttribute('rel', selectbutton.content.id);
				
				selectbutton.onclick = proform.selectOpen;
				selectinput.parentNode.insertBefore(selectbutton, selectbutton.content);

				var SArrayl = selectbutton.content.childNodes.length;

				
				for(var SArrayl; SArrayl>=0; SArrayl--) {
					//if(typeof selectbutton.content.childNodes[SArrayl] != 'undefined' && selectbutton.content.childNodes[SArrayl].nodeType == 1 && hasClass(selectbutton.content.childNodes[SArrayl], proform.config.proformselectvalue))
					//selectbutton.content.childNodes[SArrayl].value;
						//console.debug(selectbutton.content.childNodes[SArrayl]);
						//selectbutton.contentvalue = selectbutton.content.childNodes[SArrayl]
						//var c = selectbutton.content.childNodes[SArrayl]
						//console.debug(c.title);
						
						
						//selectbutton.contentvalue = null;
						//console.debug(selectbutton.content.childNodes[SArrayl].onclick);
						//if(selectbutton.content.childNodes[SArrayl].onclick)
						//selectbutton.content.childNodes[SArrayl].onclick = proform.selectOpen;
		
				}
				
				selectbutton = null;
				selectinput = null;

			
			}
		}
	
	},
	
	selectOpen :  function () {
		//console.debug(this);
		this.content.style.display = "block";
		this.parentNode.position = "relative";
		this.content.style.position = "absolute";
		this.content.style.top = this.input.offsetTop;	
	},
	
	selectPastevalue : function () {
		//console.debug(this);
	},*/
	

	
	helper : {},
	plugin : {},
	initPlugin : function() {
		var i;
		for ( i in proform.plugin ) {
			proform.plugin[i].init();
		};
		
	},
	resetPlugin : function() {
		
	}
};
/**
 * Egyszerű feltételvizsgálatok
 */
proform.condition = {
	addFormat : function( sName, oRe, sFormat ) {
		var bReturn = ( typeof proform.condition.format[sName] == 'undefined' ) ? false : true;
		proform.condition.format[sName] = oRe;
		proform.plugin.datepicker.config.formatString[sName] = sFormat;
		return bReturn;
	},
	/* a dátumok date-[xy] fomátumúak */
	supportedDateFormats : /(?:^| )((datetime|local-datetime|date|month|week|time)(-[a-z]{2})?)(?:$| )/,
	/**
	 * datetime       : 1995-09-31T23:59:59.99Z  1995-09-31T23:59:59.99+12:00
	 * datetime-hu    : 2002.12.31. 23:59:59
	 * datetime-de    : 31.12.2002 23:59:59
	 * datetime-en    : 32-12-2002 23:59:59
	 * local-datetime :
	 * date           : 1995-12-31
	 * date-hu        : 1995.12.31. 
	 * date-de        : 31.12.1995
	 * date-en        : 31/12/1995
	 * month          : 1995-12
	 * month-hu       : 1995.12.
	 * month-de       : 12.1995
	 * month-en       : 12/1995
	 * week           : 1995-W52
	 * week-hu        : 1995 52. hét
	 * week-de        : 52. Woche 1995
	 * week-en        : 1995 52. week
	 * time           : 23:59:00.0 vagy 00:00:00.0000
	 * time-hu        : 23:59:00
	 * time-de        : 23:59:00
	 * time-en        : 23:59:00 (brit)
	 * number         : -12.1234567890
	 * phone          : +381 345-12-56(234)
	 */          
	format : {
		'datetime'       : /^\d{4}[\-]\d{2}[\-]\d{2}T\d{2}:\d{2}:\d{2}.\d{2}(Z|(\+|[\-])\d{2}:\d{2})$/,
		'datetime-hu'    : /^[\ ]*(\d{2,4})([\.\\\/]|[\.\\\/] |[ -])(\d{1,2})([\.\\\/]|[\.\\\/] |[ -])(\d{1,2})[\.]? (\d{1,2})[:\-\. ](\d{1,2})([:\-\. ](\d{1,2}))?$/,
		'datetime-de'    : /^[\ ]*(\d{1,2})([\.\\\/]|[\.\\\/] |[ -])(\d{1,2})([\.\\\/]|[\.\\\/] |[ -])(\d{2,4})[\.]? (\d{1,2})[:\-\. ](\d{1,2})([:\-\. ](\d{1,2}))?$/,
		'datetime-en'    : /^[\ ]*(\d{1,2})([\.\\\/]|[\.\\\/] |[ -])(\d{1,2})([\.\\\/]|[\.\\\/] |[ -])(\d{2,4})[\.]? (\d{1,2})[:\-\. ](\d{1,2})([:\-\. ](\d{1,2}))?$/,
		'local-datetime' : /^[1-2]{1}\d{3}-[0-1]{1}[0-9]{1}-[0-3]{1}[0-9]{1}T[0-2]{1}[0-9]{1}:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{2}(Z|(\+|\-)[0-2]{1}[0-9]{1}:[0-5]{1}[0-9]{1})?$/,
		'date'           : /^[1-2]{1}\d{3}-[0-1]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$/,
		'date-hu'        : /^[1-2]{1}\d{3}([\.\\\/]|[\.\\\/] |[ -])[0-1]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[0-3]{1}[0-9]{1}[\.]?$/,
		'date-de'        : /^[0-3]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[0-1]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[1-2]{1}\d{3}[\.]?$/,
		'date-en'        : /^[0-3]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[0-1]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[1-2]{1}\d{3}[\.]?$/,
		'month'          : /^[1-2]{1}\d{3}-[0-1]{1}[0-9]{1}$/,
		'month-hu'       : /^[1-2]{1}\d{3}([\.\\\/]|[\.\\\/] |[ -])[0-1]{1}[0-9]{1}[\.]?$/,
		'month-de'       : /^[0-1]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[1-2]{1}\d{3}[\. ]?$/,
		'month-en'       : /^[0-1]{1}[0-9]{1}([\.\\\/]|[\.\\\/] |[ -])[1-2]{1}\d{3}[\. ]?$/,
		'week'           : /^[1-2]{1}\d{3}-W[0-5]{1}[0-9]{1}$/,
		'week-hu'        : /^[1-2]{1}\d{3}([\.\\\/]|[\.\\\/] |[ -])[0-5]{1}[0-9]{1}[\. ]? hét$/,
		'week-de'        : /^[0-5]{1}[0-9]{1}[\.]? Woche [1-2]{1}\d{3}[\. ]?$/,
		'week-en'        : /^[1-2]{1}\d{3}([\.\\\/]|[\.\\\/] |[ -])[0-5]{1}[0-9]{1}[\. ]? week$/,
		'time'           : /^[0-2]{1}[0-9]{1}:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]+$/,
		'time-hu'        : /^[0-2]{1}[0-9]{1}[:\-\. ][0-5]{1}[0-9]{1}([:\-\. ][0-5]{1}[0-9]{1})?$/, 
		'time-de'        : /^[0-2]{1}[0-9]{1}[:\-\. ][0-5]{1}[0-9]{1}([:\-\. ][0-5]{1}[0-9]{1})?$/, 
		'time-en'        : /^[0-2]{1}[0-9]{1}[:\-\. ][0-5]{1}[0-9]{1}([:\-\. ][0-5]{1}[0-9]{1})?$/, 
		'number'         : /^(-)?[\d]+(\.[\d]+)?$/,
		//'phone'          : /^[a-zA-Z0-9\ \-\+\/\#\*\(\)]{6,40}$/ betűre is ellenőrzött azért remeltem ki
		'phone'          : /^[0-9\ \-\+\/\#\*\(\)]{0,40}$/
	},
	/**
	 * A feltételek összesített kiértékelés : nem lehet egy false sem
	 * @param	aCondition		feltétel
	 */
	totalize : function( aCondition ) {
		return ( aCondition.toString().indexOf('false') > -1 ) ? false : true;
	},
	/**
	 * Legegyszerűbb, egy feltétel kap, ha a feltétel igaz, akkor a kötelező 
	 * mező kijelzést illeszti a megadott elemre.
	 * @param	aEl Array           Az elemek, melyre 'kötelező'-t kell kijelezni
	 * @param	bCondition Boolean  A megkapott feltétel kiértékelése
	 * @return	Boolean				A bCondition fordítottját adja vissza.
	 */
	required : function ( bCondition, aEl ) {
		/**
		 * vagy az elemet, vagy ha szükséges a labeljét adja vissza
		 */
		function getRequiredElement( el ) {
			if ( is.saf ) {
				return proform.helper.getLabel( el, true );
			};
			if ( el.tagName.toLowerCase() == 'input' && ( el.type == 'checkbox' || el.type == 'radio' ) ) {
				return proform.helper.getLabel( el, true );
			};
			if ( is.cm && ( el.tagName.toLowerCase() == 'select' ) ) {
				return proform.helper.getLabel( el, true );
			};
			return el;
		};
		var i;
		if ( proform.config.debug ) {
			return true;
		};
		if ( bCondition ) {
			for ( i = 0; i < aEl.length; i++ ) {
				addClass( getRequiredElement( aEl[i] ), proform.config.required );
				/*if(proform.config.helpz_r)
					proform.attention(aEl[i], proform.config.helpz_required);*/
			};
		}
		else {
			for ( i = 0; i < aEl.length; i++ ) {
				removeClass( getRequiredElement( aEl[i] ), proform.config.required );
				/*if(proform.config.helpz_R || proform.config.checkwarning)
					proform.removeattention(aEl[i]);*/
			};
		};
		return !bCondition;
	},
	/**
	 * Egy feltétel kap, ha a feltétel igaz, akkor a rosszul kitöltött 
	 * mező kijelzést illeszti a megadott elemre.
	 * @param	aEl Array           Az elemek, melyre 'rosszul kitöltött'-et kell kijelezni
	 * @param	bCondition Boolean  A megkapott feltétel kiértékelése
	 * @return 	Boolean				A bCondition fordítottját adja vissza.
	 */
	warning : function ( bCondition, aEl, aErrorMessage ) {
		if ( proform.config.debug ) {
			return true;
		};
		if ( bCondition ) {
			for ( i = 0; i < aEl.length; i++ ) {
				addClass( aEl[i], proform.config.warning );
				aEl[i].setAttribute( 'title', aErrorMessage[i] );
				if(proform.config.helpz)
				proform.attention(aEl[i]);
			};
		}
		else {
			for ( i = 0; i < aEl.length; i++ ) {
				removeClass( aEl[i], proform.config.warning);
				if(proform.config.helpz || proform.config.checkwarning)
					proform.removeattention(aEl[i]);
				if ( isSpecified( aEl[i], 'normTitle' ) ) {
					aEl[i].setAttribute( 'title', aEl[i].getAttribute( 'normTitle' ) );
				}
				else {
					aEl[i].removeAttribute( 'title' );
				};
			};
		};
		return !bCondition;
	},
	checkFormat : function( sType ) {
		var i, aIP, sAtom, sWord, aDom, aMatch;
		if ( proform.config.debug ) {
			return true;
		};
		switch ( sType ) {
			case 'number' :
				return proform.condition.format.number.test( arguments[1] );
				break;
			case 'range' : // -123, -156, 346
				if ( proform.condition.checkFormat( 'number', arguments[1] ) ) {
					if ( arguments[1] >= arguments[2] && arguments[1] <= arguments[3] ) {
						return true;
					};
				};
				return false;
				break;
			case 'email' : // gellért@nexúm.hu  root@127.0.0.1
				sAtom = '\[^\\s\\(\\)<>@,;:\\\\\\\"\\.\\[\\]\]+';
				sWord = '(' + sAtom + '|(\"[^\"]*\"))';
				// alapvető megfelelés
				aMatch = arguments[1].match( /^(.+)@(.+)$/ );
				if ( aMatch == null ) {
					return false;
				};
				// user megfelel-e?
				if ( aMatch[1].match( new RegExp("^" + sWord + "(\\." + sWord + ")*$" ) ) == null ){
					return false;
				};
				// a domain ip?
				if ( proform.condition.checkFormat( 'ip', aMatch[2] ) ) {
					return true;
				}
				// a domain megfelel?
				if ( aMatch[2].match( new RegExp("^" + sAtom + "(\\." + sAtom +")*$") ) == null ) {
					return false;
				};
				aDom = aMatch[2].match( new RegExp( sAtom, "g" ) );
				if ( aDom[ aDom.length-1 ].length < 2 || aDom[ aDom.length-1 ].length > 3 ){
					return false;
				};
				if ( aDom.length < 2 ) {
					return false;
				};
				return true;
				break;
			case 'phone' :
				return proform.condition.format.phone.test( arguments[1] );
				break;
			case 'ip' : // 127.0.0.1
				if ( /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.test( arguments[1] ) ) {
					aIP = arguments[1].split( "." );
					for ( i = 0; i < 4; i++ ) {
						if ( aIP[i] > 255 ) {
							return false;
						};
					};	
					return true;
				};
				return false;
				break;
			default:
				// hibás kérés
				if ( typeof proform.condition.format[sType] == 'undefined' ) { 
					return false;
				};
				// dátumok
				aMatch = arguments[2].match( proform.condition.supportedDateFormats );
				if ( ( typeof proform.condition.format[aMatch[1]] == 'undefined' ) || ( sType != aMatch[2] ) ) { 
					return false; // nincs telepítve ilyen nyelvi dátumformátum, vagy nem felel-meg a kért nyelvi formátumnak
				};
				return proform.condition.format[aMatch[1]].test( arguments[1] ); // nyelvi formátum egyezésének visszaadása
		};
	}	
};
/**
 * az activeForm kiegészítése
 */
proform.helper.activeForm = {
	disableElement : function( bValue, el ) {
		// fontos a fordított sorrend, mert a disabled attribútum megállít minden propertychange eseményt!
		var elLabel;
		if ( bValue == false ) {
			el.removeAttribute('disabled');
			el.activeFormDisabled = bValue;
			if ( (elLabel = proform.helper.getLabel(el, false)) != null ) {
				removeClass( elLabel, proform.config.disabled );
			};
		}
		else {
			el.activeFormDisabled = bValue;
			el.setAttribute('disabled', 'disabled');
			if ( (elLabel = proform.helper.getLabel(el, false)) != null ) {
				addClass( elLabel, proform.config.disabled );
			};
		}
	},
	update : function( elRoot ) {
		// csak IE-ben va rá szükség!
		if ( typeof( document.body.activeFormUpdate ) != 'undefined' ) {
			document.body.activeFormUpdate( elRoot );
		};
	}
};
/**
 * A label for="" fordítottja, ha nem talál, akkor saját magát adja vissza.
 */
proform.helper.getLabel = function ( el, bReturnElement ) {
	
	if(el) {
		var els, i, sFor;
		sFor = ( is.ie ) ? 'htmlFor' : 'for';
		// tejesítményoptimalizáció: először csak a környezetében nézünk szét -
		els = el.parentNode.getElementsByTagName('label');
		for ( i = 0; i < els.length; i++ ) {
			if ( els[i].getAttribute( sFor ) == el.id ) {
				return els[i];
			};
		};
		// - majd, ha nem találjuk, akkor a teljes formban
		els = proform.form.getElementsByTagName('label');
		for ( i = 0; i < els.length; i++ ) {
			if ( els[i].getAttribute( sFor ) == el.id ) {
				return els[i];
			};
		};
		return bReturnElement ? el : null;
	}
	else
		return false;
};
/**
 * Textarea maxlength implementáció a cols attribútum alapján
	textarea átméretező
 */
proform.helper.initTextAreaMaxLength = function() {
	var els, i;
	els = proform.form.getElementsByTagName('textarea');
	for ( i = 0; i < els.length; i++ ) {
		els[i].maxLength = els[i].getAttribute('cols');
		if ( els[i].maxLength < 1 ) {
			els[i].maxLength = Number.MAX_VALUE;
		};
		els[i].onkeypress = function() {
			if ( this.value.length > this.maxLength ) {
				this.value = this.value.substring( 0, this.maxLength );
			};
		};
		els[i].onkeyup = els[i].onkeypress;
		els[i].onchange = els[i].onkeypress;
		// ie paste hack
		if ( is.ie ) {
			els[i].onbeforepaste = function() {
				window.event.returnValue = false;
			};
			els[i].onpaste = function() {
				var oTR;
				window.event.returnValue = false;
				oTR = this.document.selection.createRange();
				oTR.text = window.clipboardData.getData("Text").substr( 0, ( this.maxLength - this.value.length + oTR.text.length ) );
			};
		};
	};
};
 /**
  * XMLHttpRequest
  * @param	markUpdate		Megjelöli, hogy egy mező módosítva lett a háttérben (animáció)
  * @param	markUpdateOk	Megjelöli, hogy egy egysoros szöveges mező értéke a háttérben zajló kommunikáció során helyesnek találtatott (pipa)
  */

proform.helper.XMLHttpRequest = {
	config : {
		updateClass : 'xmlhttprequest-update-',
		updateUnit : 5,
		updateDelayFase1 : 1000,
		updateDelayFase2 : 50
	},
	/**
	* Megjelöli, hogy egy mező módosítva lett a háttérben (animáció)
	* @param el		a mező objektum
	*/
	markUpdate : function( el ) {
		
		if(el) {
			if ( el.updateState != null ) {
				return;
			};
			el.updateState = 0;
			addClass( el, proform.helper.XMLHttpRequest.config.updateClass + el.updateState );
			el.updateTime = ( is.ie ) ? setTimeout( 'proform.helper.XMLHttpRequest.doUpdatePhase1("' + el.uniqueID + '")', proform.helper.XMLHttpRequest.config.updateDelayFase1 ) : 
										setTimeout( proform.helper.XMLHttpRequest.doUpdatePhase1, proform.helper.XMLHttpRequest.config.updateDelayFase1, el );
		
		}
		else
			console.debug("Add meg a mezőt melyre szeretnéd hogy megjelölje!")
			return false;
	},
	/**
	* Megjelöli, hogy egy egysoros szöveges mező értéke a háttérben zajló kommunikáció során helyesnek találtatott (pipa)
	* @param	el		a mező objektum
	*/
	markUpdateOk : function( el ) {
		if(el)
			proform.helper.XMLHttpRequest.markUpdate( el );
		else
			return false;
	},
	/**
	* @param el
	*/
	doUpdatePhase1 : function( el ) {
	
		if(el) {
	
			if ( is.ie ) {
				el = document.all[el];
			};
			el.updateTime = ( is.ie) ? setInterval( 'proform.helper.XMLHttpRequest.doUpdatePhase2("' + el.uniqueID + '")', proform.helper.XMLHttpRequest.config.updateDelayFase2 ) : 
									   setInterval( proform.helper.XMLHttpRequest.doUpdatePhase2, proform.helper.XMLHttpRequest.config.updateDelayFase2, el );
		
		}
		else
			return false;
	},
	/**
	* @param el
	*/
	doUpdatePhase2 : function( el ) {
		if(el) {
			if ( is.ie ) {
				el = document.all[el];
			};
			if ( el.updateState < proform.helper.XMLHttpRequest.config.updateUnit ) {
				removeClass( el, proform.helper.XMLHttpRequest.config.updateClass + el.updateState );
				addClass( el, proform.helper.XMLHttpRequest.config.updateClass + ++el.updateState );
			}
			else {
				removeClass( el, proform.helper.XMLHttpRequest.config.updateClass + el.updateState );
				clearInterval( el.updateTime );
				el.updateState = null;
			};
		}
		else
			return false;
	}
 
};

proform.ajax = {
	/**
	* ellenőrzi hogy az XMl lekérdezés sikeres volt-e, ha igen TRUE ha nem FALsE
	* @param	el		az XMLHTTPRequest objektum
	*/
	ajaxRequestOk : function ( el ) {
		if(el) {
			if (el.readyState == 4) {
			// only if "OK"
				if (el.status == 200) {
					return true;
				}
				else  {
					return false;
				}
			}
			else {
					return false;
			}
		}
		else
			return false;
	},
	
	/**
	* az INPUT mező alatti boxban lévő rekordokat törli
	* @param	el		az INPUT mező alatti box objektum
	*/
	ajaxdelRecordlist : function ( el ) {
		if(el) {
			while ( el.childNodes.length != 1 ) {
			el.removeChild( el.lastChild );
			}
		}
		else
			return false;
	},
	
	/** 
	* egy listában lévő rekordot töröl
	* @param	list	lista objektum ahonnan törölni akarunk
	* @param	el		törölni kívánt objektum
	*/
	ajaxdelRecord : function ( list, el ) {
		if(list && el)
			el.removeChild( el.lastChild );
		else
			return false;
	},
	
	
	/**
	* törli egy táblázatban lévő rekordok sorait
	* @param	Tbody		amelyik tbody-ból ki akarjuk törölni a sorokat
	* @param	rowArray	A törlendő sorok(obj) egy tömbbe gyűjtve
	*/
	delRows : function (Tbody, rowArray ) {
		if(Tbody && rowArray) {
			var Rdel = rowArray.length -1;
			for ( Rdel; Rdel>=0 ; Rdel--) {
				Tbody.removeChild(rowArray[Rdel]);
			}
		}	
		else
			return false;
	},
	
	/** 
	* láthatatlanná teszik a sorokat a táblázatban
	* @param	Tbody		amelyik tbodyba(obj) akarjuk a műveletet végezni 
	* @param	rowArray	A sorok(obj) egy tömbbe gyűjtve
	*/
	hideRows : function (Tbody, rowArray ) {
		if(Tbody && rowArray) {
			var Rhide = rowArray.length -1;
			for ( Rhide; Rhide>=0 ; Rhide--) {
				rowArray[Rhide].style.display = 'none';
			}
		}
		else
			console.debug("add meg a tbody-t és a sort amelyiket láthatatlanná szeretnéd tenni");
			return false;
		
	},
	
	/** 
	* láthatatóvá teszik a sorokat a táblázatban
	* @param	Tbody		amelyik tbodyba(obj) akarjuk a műveletet végezni 
	* @param	rowArray	A sorok(obj) egy tömbbe gyűjtve
	* @param	idtext		A sorok idjének részlete
	*/
	showRows : function (rowArray, idtext) {
		if(rowArray && idtext) {
			var Rshow = rowArray.length-1;
			 
			
			for ( Rshow; Rshow>=0 ; Rshow--) {
			var id = idtext;
			id += rowArray[Rshow];
			
			
			document.getElementById(id).style.display = "";
			err = id+"_error"
			if(document.getElementById(err))
				document.getElementById(err).style.display = "";
				
			}
		}
		else
			console.debug("add meg a tbody-t és a sort amelyiket láthatatlanná szeretnéd tenni");
			return false;
	},
	
	/** 
	* összes sor megkeresése
	* @param	Tbody	amelyik tbody-ból amelyikből
	* @param	idtext	id szövegrészlet amelyre keresünk
	*/
	searchTR : function (Tbody, idtext) {
		if(Tbody && idtext) {
		var elArray = Tbody.getElementsByTagName('TR');
		var elAL = elArray.length;
		elAL--;
		var rows = new Array();
		var i = 0;
		
		for ( elAL; elAL>=0 ; elAL--) {
				if(elArray[ elAL ].id) {
					 if(elArray[ elAL ].id.indexOf(idtext) == 0 ) {
						rows[i] = elArray[ elAL ];
						i++;
					 }
				}
		}
		return rows;
		}
		else
			return false;
	},


	/** 
	* loading ikon megjelenítése
	* @param	el		a loading ikon elem
	*/
	loading : function ( el ) {
	
		if(el)
		el.style.visibility = 'visible';
		else {		
			console.debug("Bemenő paraméter: el [loading] 2041.sor, Add meg a bemenő paramétert (a loading ikon-t)");
			return false;
		}
	},

	/** 
	* loading ikon eltüntetése
	* @param	el		a loading ikon elem
	*/
	loadingend : function ( el ) {
	
		if(el)
		el.style.visibility = 'hidden';
		else {		
			console.debug("Bemenő paraméter: el [loading] 2055.sor, Add meg a bemenő paramétert (a loading ikon-t)");
			return false;
		}
	}

	


	


}
	/*billentyűleütést érzékel (a billentyű ascii kódjával tér vissza)
	* @param e		leütött billentyű
	*/
	/*checkKeycode : function (e) {
	
		var keycode;
		
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		//console.debug(keycode);
		return keycode;

	},*/
	
	/*lefele billentyűleütést érzékel
	* @param e		leütött billentyű
	* 
	*/
	/*downKeyarrow :  function ( e ) {
		
		var keycode;
		
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		
		
		if(keycode == 40){
			if(this.nextSibling.nextSibling) {
			//this.nextSibling.nextSibling.focus();
			//console.debug(this.nextSibling.nextSibling);
			//return true;
			
			}
		}
	
	},*/




