function _validateStandard(formObj){
	totalElements=formObj.length;
	for(index=0;index<totalElements;++index){
		inputType=formObj.elements[index].type;
		switch(inputType){
			case "text":
			case "password":
						if(typeof(validationRuleArray[formObj.elements[index].name])!="undefined"){
							_validateTextBox(formObj.elements[index]);
						}
						break;
			case "radio": 
						if(typeof(validationRuleArray[formObj.elements[index].name])!="undefined"){
							_validateRadioGroupBox(formObj.elements[index]);
						}
						break;
			case "checkbox":
						if(typeof(validationRuleArray[formObj.elements[index].name])!="undefined"){  
							_validateCheckBoxGroup(formObj.elements[index]);
						}
						break;								
		}
	}
 	/*if(typeof(formObj.confirm_password != 'undefined')) {	
 			errorFlag=false;
			errorId=validationRuleArray['confirm_password']['errorMessageId'];
			if(validationRuleArray['confirm_password']['required']){    			
				if(formObj.confirm_password.value==''){    				 
					document.getElementById(errorId).innerHTML="<img src='images/error.gif'> " + validationRuleArray['confirm_password']['requireErrorMessage'];
					document.getElementById(errorId).style.visibility='visible';
					errorFlag=true;
				} else {
					document.getElementById(errorId).innerHTML="";
					document.getElementById(errorId).style.visibility='hidden';
				}
			} else if (typeof(validationRuleArray['confirm_password']['validateErrorMessage']) != 'undefined') {
				if (formObj.confirm_password.value != formObj.password.value) {
					document.getElementById(errorId).innerHTML="<img src='images/error.gif'> " + validationRuleArray['confirm_password']['validateErrorMessage'];
					document.getElementById(errorId).style.visibility='visible';
					errorFlag=true;
				} else {
					document.getElementById(errorId).innerHTML="";
					document.getElementById(errorId).style.visibility='hidden';
				}
 			}
 			
 			if(errorFlag==false) {
				document.getElementById(errorId).innerHTML="<img src='images/ok.gif'> "
				document.getElementById(errorId).style.visibility='visible';
				validationRuleArray['confirm_password']['validStatus']=true;
			}
 	}
	*/
	for(index=0;index<totalElements;++index){
		inputTypeName=formObj.elements[index].name;
		if( typeof(validationRuleArray[inputTypeName])!="undefined" && !validationRuleArray[inputTypeName]['validStatus']){
			alert(validationRuleArray[inputTypeName]);
			init();
			return false;
		}    		
	}

	return true;
}

function _validateCheckBoxGroup(checkBoxObj){
	checkBoxName=checkBoxObj.name;
	errorFlag=false;
	errorId=validationRuleArray[checkBoxName]['errorMessageId'];
	if(validationRuleArray[checkBoxName]['required']){
		if(!checkBoxObj.checked && !validationRuleArray[checkBoxName]['validStatus']){
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> " + validationRuleArray[checkBoxName]['requireErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;				
		}else {
			validationRuleArray[checkBoxName]['validStatus']=true;
			formSubmitFlag=true;
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';
		}
	}
	if(errorFlag==false){
		document.getElementById(errorId).innerHTML="<img src='images/ok.gif'> "
		document.getElementById(errorId).style.visibility='visible';
	}
}
function _validateRadioGroupBox(radioButtonObj){ 
	radioButtonName=radioButtonObj.name;
	errorFlag=false;
	errorId=validationRuleArray[radioButtonName]['errorMessageId'];
	if(validationRuleArray[radioButtonName]['required']){
		if(!radioButtonObj.checked && !validationRuleArray[radioButtonName]['validStatus']){
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> " + validationRuleArray[radioButtonName]['requireErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;
		}else {
			validationRuleArray[radioButtonName]['validStatus']=true;				 
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';
		}
	}
	if(errorFlag==false){
		document.getElementById(errorId).innerHTML="<img src='images/ok.gif'> "
		document.getElementById(errorId).style.visibility='visible';
	}    
}

function _validateTextBox(textBoxObj){
	textBoxName=textBoxObj.name;
	errorFlag=false;
	errorId=validationRuleArray[textBoxName]['errorMessageId'];
	if(validationRuleArray[textBoxName]['required']){    			
		if(textBoxObj.value==''){    				 
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> " + validationRuleArray[textBoxName]['requireErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;
		}else {
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';
		}
	}
		
	if(typeof(validationRuleArray[textBoxName]['regExp'])!="undefined"  && validationRuleArray[textBoxName]['regExp']!='' && errorFlag==false){    			
		regularExpression=validationRules[validationRuleArray[textBoxName]['regExp']];
		if(!regularExpression.test(textBoxObj.value)){
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> "+ validationRuleArray[textBoxName]['validateErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;
		}else if(document.getElementById(errorId).style.visibility!='visible'){
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';    				
		}
	}
	
		if(typeof(validationRuleArray[textBoxName]['minLength'])!="undefined"  && validationRuleArray[textBoxName]['minLength']!='' && errorFlag==false){    			
		minimumLength=validationRuleArray[textBoxName]['minLength'];
		if(textBoxObj.value.length < minimumLength){
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> "+ validationRuleArray[textBoxName]['minLengthErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;
		}else if(document.getElementById(errorId).style.visibility!='visible'){
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';    				
		}
	}    		
	
	if(typeof(validationRuleArray[textBoxName]['maxLength'])!="undefined"  && validationRuleArray[textBoxName]['maxLength']!='' && errorFlag==false){
		maximumLength=validationRuleArray[textBoxName]['maxLength'];
		if(textBoxObj.value.length > maximumLength){
			document.getElementById(errorId).innerHTML="<img src='images/error.gif'> "+validationRuleArray[textBoxName]['maxLengthErrorMessage'];
			document.getElementById(errorId).style.visibility='visible';
			errorFlag=true;
		}else if(document.getElementById(errorId).style.visibility!='visible'){
			document.getElementById(errorId).innerHTML="";
			document.getElementById(errorId).style.visibility='hidden';    				
		}
	}
	if(errorFlag==false){
		document.getElementById(errorId).innerHTML="<img src='images/ok.gif'> "
		document.getElementById(errorId).style.visibility='visible';
		validationRuleArray[textBoxName]['validStatus']=true;
	}
}