﻿function chkpass() {
    var hidPas = document.getElementById("rememberpass");
    if (document.getElementById("rememberpass").checked) {
        hidPas.value = "y";
        if (document.getElementById('rePon') != null)
            document.getElementById('rePon').className = 'checkboxCss_on';

    }
    else {
        hidPas.value = "n";
        if (document.getElementById('rePon') != null)
            document.getElementById('rePon').className = 'checkboxCss';

    }
}
function getCookie(name) {
    var value = "";
    var allcookies = document.cookie;
    var cookie_pos = allcookies.indexOf("" + name + "");
    if (cookie_pos != -1) {
        cookie_pos += name.length + 1;
        var cookie_end = allcookies.indexOf(";", cookie_pos);
        if (cookie_end == -1) {
            cookie_end = allcookies.length;
        }
        value = unescape(allcookies.substring(cookie_pos, cookie_end));
    }
    return value;
}
$(document).ready(function() {
    // chkpass();
    var hidPas = getCookie("hidPas");
    var username = getCookie("username");
    var txtPwd = getCookie("txtPwd");
    if (hidPas != null) {
        if (hidPas == "1") {
            document.getElementById("rememberpass").checked = false;
            document.getElementById("rememberpass").value = "n";
            if (document.getElementById('rePon') != null) {
                document.getElementById('rePon').className = 'checkboxCss';
            }

            $("#username").val("");
            $("#txtPwd").val("");
        }
        else {
            document.getElementById("rememberpass").checked = true;
            document.getElementById("rememberpass").value = "y";
            if (document.getElementById('rePon') != null) {
                document.getElementById('rePon').className = 'checkboxCss_on';
            }
            $("#username").val(username);
            $("#txtPwd").val(txtPwd);

        }
    }
    reloadcode();
});


function reloadcode() {
    $("#imgValicode").attr("src", "../../Main/Valicode.aspx?rand=" + Math.random());
}
