function concatValues(name) {
	var field = document.getElementsByName(name);
	var value = "";
	var lastSelected = null;
	
	for (var i = 0; i != field.length; i++) {
		if (field[i].checked) {
			if (value.length != 0) {
				value += "|";
			}
			value += field[i].value;
			lastSelected = field[i];
		}
	}
	
	if (lastSelected != null) {
		lastSelected.value = value;
	}
}

function showPart(selectionElement, elementName) {
	elementName = elementName.replace(/\[/g, '^').replace(/\]/g, '~').replace(/\^\~/g, '[]');
	
	for (var i = 0; i != selectionElement.options.length; i++) {
		var display = null;
		
		if (i == selectionElement.selectedIndex) {
			display = 'block';
		}
		else {
			display = 'none';
		}

		if (i != 0) {
			document.getElementsByName(elementName.replace('SUB', selectionElement.options[i].value))[0].style.display = display;
		}
	}
}

function confirmPasswords( type ) {
	
	if( type == 'changePass'){
	
		newPasswordConfirmationObj1	= document.getElementById('newPasswordConfirmation1');
		newPasswordConfirmationObj2	= document.getElementById('newPasswordConfirmation2');
		passwordObj = document.getElementById('password');
		
		if ((newPasswordConfirmationObj2.value) && (newPasswordConfirmationObj2.value)) {
			passwordConfirmationObj = document.getElementById('passwordConfirmation');
			
			if (hex_md5(passwordConfirmationObj.value) != passwordObj.value) {
				
				if (totalAlert.length != 0) {
					totalAlert += "\n";
				}
				totalAlert += "Senha incorrecta.";
				totalFlag = false;
				return false
			
			}else if( newPasswordConfirmationObj1.value != newPasswordConfirmationObj2.value ){
			
				if (totalAlert.length != 0) {
					totalAlert += "\n";
				}
				totalAlert += "Por Favor verique se as passwords sao iguais";
				totalFlag = false;
				return false
				
			}
			
			passwordObj.value = newPasswordConfirmationObj2.value;
		}
		else {
			passwordObj.value = null;
		}
		return true
		
	}else if ( type == 'newPass') {
	
		passwordObj = document.getElementById('password');
		passwordConfirmationObj = document.getElementById('passwordConfirmation');
		
		if( passwordObj.value != passwordConfirmationObj.value ){
			if (totalAlert.length != 0) {
				totalAlert += "\n";
			}
			totalAlert += "Por Favor verique se as passwords sao iguais";
			totalFlag = false;
			return false
		}
	}

}