function passwordStrength(password) {

	var addDelimiter = false;
	var passwordIncludeNumeric = document.getElementById("passwordIncludeNumeric").value;
	var passwordIncludeUpperCase = document.getElementById("passwordIncludeUpperCase").value;
	var passwordIncludeSpecialChar = document.getElementById("passwordIncludeSpecialChar").value;
	var passwordMinimumLength = document.getElementById("passwordMinimumLength").value;
	var str="";

	if (password.length <= passwordMinimumLength) {
		str = "Password must be at least "+passwordMinimumLength+" characters";
		addDelimiter = true
	}
	if (passwordIncludeNumeric || passwordIncludeUpperCase || passwordIncludeSpecialChar) {
		var tempstr="";
		var tempstr1="";
		if (addDelimiter) {
			tempstr = " and";
			addDelimiter = false;
		}else{
			tempstr = "password";
		}
		tempstr = tempstr + " must contain at least";
		if (passwordIncludeNumeric && !password.match(/\d+/)) {
			tempstr1 = tempstr1 + " one numeric";
			addDelimiter = true
		}
		if (passwordIncludeUpperCase && !password.match(/[A-Z]/)) {
			if (addDelimiter) {
				tempstr1 = tempstr1 + ",";
				addDelimiter = false;
			}
			tempstr1 = tempstr1 + " one upper case";
			addDelimiter = true
		}
		if (passwordIncludeSpecialChar && !password.match(/.[!,@#$%^&*?_~\-().|<>]/)) {
			if (addDelimiter) {
				tempstr1 = tempstr1 + " and";
				addDelimiter = false;
			}
			tempstr1 = tempstr1 + " one punctuation or special";
		}
		if (tempstr1.length > 0) {
			str = str +tempstr+tempstr1+" character";
		}
	}
	document.getElementById("passwordDescription").innerHTML = str;
	if(str.length <=0)
		document.getElementById("isPaswordChanged").value = 'true'
}

function saveValues(role) {
	var containsStrongPw = document.getElementById("containsStrongPw").value; // Property
	// file
	// field
	// for
	// strong
	// PW(enabled
	// or
	// disabled).
	var containsPwdExpire = document.getElementById("containsPwdExpire").value; // Property
	// file
	// field
	// for
	// PW
	// expiry(enabled
	// or
	// disabled).
	if (containsStrongPw == 'true' && containsPwdExpire != 'true') { // condition
		// when
		// strong
		// PW is
		// enabled
		var enforceStrongPasswordChkBox = document
				.getElementById("enforceStrongPassword").checked;
		if (enforceStrongPasswordChkBox == true) {
			checkStrongPassword();
		} else {
			fullScreenPleaseWait();
			document.getElementById("form").submit();
		}
	} else if (containsStrongPw != 'true' && containsPwdExpire == 'true') { // condition
		// when
		// strong
		// PW
		// is
		// diabled
		// and
		// PwExpiry
		// is
		// enabled
		checkPwCanExpire();
	} else if (containsStrongPw == 'true' && containsPwdExpire == 'true') {
		var enforceStrongPasswordChkBox = document
				.getElementById("enforceStrongPassword").checked;
		var pwCanExpire = document.getElementById("pwdExpireHddn").value;
		if (enforceStrongPasswordChkBox == true) {
			checkStrongPassword();
		} else if (enforceStrongPasswordChkBox != true && pwCanExpire == 'true') {
			checkPwCanExpire();
		} else {
			fullScreenPleaseWait();
			document.getElementById("form").submit();
		}
	} else {
		fullScreenPleaseWait();
		document.getElementById("form").submit();
	}
}

function checkPwCanExpire() {
	var str = document.getElementById("password1").value;
	if (str.length > 0) {
		document.getElementById("isPaswordChanged").value = 'true';
	} else {
		document.getElementById("isPaswordChanged").value = 'false';
	}
	document.getElementById("form").submit();
}

function checkStrongPassword() {
	var str = document.getElementById("passwordDescription").innerHTML;
	if(str.length <=0){
		document.getElementById("form").submit();
	} else {
		alert("Password Not Strong Enough, Please reset the Password");
		return false;
	}
}
