var cmt_Language = Array();

var errorBGColor = 'D67D7D';
var defautBGColor = 'ffffff';

/*
#--------------------------------------------------------------------------------------------------------------#
# CHECK FORM  ------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------------------------#
*/


	function show_message(body){
		
		var message = body;
		
		alert(message);
		
		
	}
		

	function checkForm(){
			var a=checkForm.arguments;
	

			if (checkEmptyForm(a) && checkMailForm(a) && checkEgalForm(a) && checkLenForm(a)){
				
					return true;
				
			}
	
			return false;
	
	}



	function checkEmptyForm(a){
			
			var bool = true;
			
				with(document.axeFRM){
			
					for(i=4;i<(a.length);i++){
					
						if (eval(a[i]+".value")==''){
						
							eval(a[i]+".style.backgroundColor='"+errorBGColor+"'");
							bool = false;
							
						}else{eval(a[i]+".style.backgroundColor='"+defautBGColor+"'");}	
				
					}
			
			}
		
			if (!bool){show_message(cmt_Language['text_required_field_missing']);}
			
			return bool;
			
	}



	function checkEgalForm(a){
			
			if (a[0]!=""){ 
			
				with(document.axeFRM){

						if (eval(a[0]+".value")!=eval(a[1]+".value")){
				
							eval(a[0]+".style.backgroundColor='"+errorBGColor+"'");
							eval(a[1]+".style.backgroundColor='"+errorBGColor+"'");
							show_message(cmt_Language['text_password_must_same']);
							return false;
							
						}		
	
				}
			
			}
		
			return true;
			
	}



	function checkMailForm(a){
			
			var filter=/^.+@.+\..{2,3}$/
			
			if (a[2]!=""){ 
			
				with(document.axeFRM){
					
					if (!filter.test(eval(a[2]+".value"))){
						eval(a[2]+".style.backgroundColor='"+errorBGColor+"'");
						show_message(cmt_Language['text_mail_invalid']);
						return false;
					}
							
				}
			
			}
			
			return true;
			
	}

	
	function checkLenForm(a){
			
			if (a[3]!=""){ 
			
				with(document.axeFRM){
				
					if (eval(a[3]+".value").length<6){
						eval(a[3]+".style.backgroundColor='"+errorBGColor+"'");
						show_message(cmt_Language['text_password_must_be_6']);
						return false;
					}
							
				}
			
			}
			
			return true;
			
	}
	
	
	
	function checkIntervalForm(obj,intMin,intMax){
			
				with(document.axeFRM){
				
				
					
					if ((eval(obj+".value") < intMin) || (eval(obj+".value") > intMax)){
						eval(obj+".style.backgroundColor='"+errorBGColor+"'");
						show_message(cmt_Language['text_interval_value_invalid']);
						return false;
					}
							
				}
			
			
			
			return true;
			
	}
	
	function confirmSuppression(titleAlert,pathFile,objName){
	
			if (confirm('Voulez-vous vraiment supprimer l\'enregistrement N° '+objName)){
		
					window.location.href=pathFile;
		
  		}
   		
	}
	
	function confirmChgState(titleAlert,pathFile,objName){
	
			if (confirm('Voulez-vous vraiment changer l\'état de l\'enregistrement N° '+objName)){
		
					window.location.href=pathFile;
		
  		}
   		
	}
	
	function confirmActualiser(titleAlert,pathFile,objName){
	
			if (confirm('Voulez-vous vraiment Actualiser de l\'enregistrement N° '+objName)){
		
					window.location.href=pathFile;
		
  		}
   		
	}
	
	

/*
#--------------------------------------------------------------------------------------------------------------#
# SUBMIT  ------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------------------------#
*/
	

	function submitForm(name, action){
		
		eval("document."+name).action=action;
		eval("document."+name).submit();
	
	}


	
/*
#--------------------------------------------------------------------------------------------------------------#
# OPENER VALUE  ------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------------------------#
*/
	

	function setValueTo_opener(ctrl,val){
		
		eval("opener.document.axeFRM."+ctrl).value = val;
	
	}


function showElement_inDiv(path,elem){
				
				if (document.getElementById){
						document.getElementById(elem).src = path;
					
						
					
						
						
						
				}else if (document.all){
						document.all[elem].src = path;
						
				}

	}



/*
#--------------------------------------------------------------------------------------------------------------#
# CHECKBOX   ------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------------------------#
*/	

function is_oneCheck(obj){
			var i = 0;

			var tab = obj;

			var ctrl = eval('document.axeFRM.'+obj);

			with(document.axeFRM){

					if (eval(obj+".length")){

							for(i=0; i < eval(obj+".length"); i++){

								if (ctrl[i].checked){

										return true;
										break;
								}

							}

					}
			
				return false;

			}

	}

function is_oneCheckByName(obj){
			var i = 0;

		   	var ctrl = eval("document.getElementsByName('"+ obj + "')");





						  	for(i=0; i < ctrl.length; i++){

								if (ctrl[i].checked){

								        return true;
							  	    	break;
								}

							}



				return false;



	}



/*
#--------------------------------------------------------------------------------------------------------------#
# LIST   ------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------------------------#
*/
	
	
	
	
	function selectList(ctrlNameFrom,ctrlNameTo){
				
				with(document.axeFRM){
					
					selIdx = eval(ctrlNameFrom+".options");
					
					for (var i=0; i< selIdx.length; i++){
						
								if (eval(ctrlNameFrom+".options["+i+"].selected")){
								
										eval(ctrlNameTo+".options["+i+"].selected=true");
						
								}else{
								
									eval(ctrlNameTo+".options["+i+"].selected=false");
								
								}
					
					}
				
				}
		
	}
	