function colorMeBadd(pClickObj, pActiveCol, pInactiveCol) {
	$EL('delete-item').style.background = pClickObj.checked ? pActiveCol : pInactiveCol;
}

function closeError() {
	$EL('form-errors').style.display = 'none';
}

function $EL(pElement) {
	return document.getElementById(pElement);
}

function confirmAdminLogout() {
	return confirm('Möchten Sie sich wirklich aus der Extranet-Administration abmelden?');
}

function generatePassword(pLength) {

	if (undefined == pLength) {
		pLength = 6;
	}
	
	var pass = new Array(pLength); 

	for (var i = 0; i < pLength; i++) { 
		var capitalize = Math.round( Math.random() * 2 ); 
	
		if (0 == capitalize)  {
			// small letters
			var nmr = Math.round( Math.random() * (121 - 97) ) + 97; 
		} else if (1 == capitalize) { 
			// capitals
			var nmr = Math.round( Math.random() * (90 - 65) ) + 65; 
		} else {
			// numbers
			var nmr = Math.round( Math.random() * (57  - 48) ) + 48; 
		}
		
		pass[i] = String.fromCharCode(nmr);
	} 

	return pass.join('');
}

function displayGeneratedPassword(pElement) {
	$EL(pElement).value = generatePassword();
}

function copyValue(pSourceElement, pTargetElements) {
	if ( typeof pTargetElements != 'object' ) {
		pTargetElements = Array(pTargetElements);
	}
	for (var i = 0; i < pTargetElements.length; i++) {
		$EL( pTargetElements[i] ).value = $EL(pSourceElement).value;
	}
}
