function UsernameBehaviour(eventId, usernameId, defaultText) {
    var username = document.getElementById(usernameId);

    if ((username != null)) {       

        if (((eventId == "click") || (eventId == "focus")) &&
        (username.value == defaultText)) {

            username.value = "";
        }
        else if ((eventId == "blur") && (username.value == "")) {
            username.value = defaultText;
        }
    }
}
function PasswordBehaviour(passwordId, plainPasswordId, direction) {
    var postField = document.getElementById("txtPassword");
    var password = document.getElementById(passwordId);
    var plainPassword = document.getElementById(plainPasswordId);
    if ((postField != null) && (password != null) && (plainPassword != null)) {
        postField.value = password.value;

        if (direction == 1) {
            if (password.value.length == 0) {
                password.style.display = "none";
                plainPassword.style.display = "block";
            }
        }
        else if (direction == 2) {
            password.value = "";
            password.style.display = "block";
            plainPassword.style.display = "none";
            password.focus();
            password.value = "";
        }
    }
}
function SetHiddenPassword(passwordId) {
    var postField = document.getElementById("txtPassword");
    var password = document.getElementById(passwordId);

    if ((postField != null) && (password != null)) {
        postField.value = password.value;
    }
}

function loadTime() {
    var cur = new Date();
    var time =  cur.getHours() + ":" + cur.getMinutes() + " " + cur.getDate() + "-" + cur.getMonth() + "-" + cur.getFullYear();
    document.getElementById("time").innerHTML = time;
}

function callSubmit(value,form){
    var obj;
	var txtID = 'txtID';
	if(form == 1) txtID = 'txtIDs';
    obj=document.getElementById(txtID);
    if(obj.value=='Tên đăng nhập'){
        obj.focus();
        alert('Bạn chưa điền tên đăng nhập.');
        return false;
    }
    var txtPW = 'txtPW';
	if(form == 1) txtPW = 'txtPWs';
    obj=document.getElementById(txtPW);
    if(obj.value==''){
        obj.focus();
        alert('Bạn chưa điền mật khẩu.');
        return false;
    }
    var txtCode = 'txtCode';
	if(form == 1) txtCode = 'txtCodes';
    obj=document.getElementById(txtCode);
    if(obj.value=='Mã code'){
        obj.focus();
        alert('Bạn chưa điền mã xác nhận. ');
        return false;
    }
    return true;
}



