﻿function switchimg(id,img)
{
    document.getElementById(id).src = img;
}
function getCookie(sName) {
    // cookies are separated by semicolons
    var aCookie = document.cookie.split("; ");
    for (var i = 0; i < aCookie.length; i++) {
        // a name/value pair (a crumb) is separated by an equal sign
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0])
            return unescape(aCrumb[1]);
    }
    // a cookie with the requested name does not exist
    return null;
}

/*function encp(pwdCtrlId,keyServiceUrl) {
    var key = getEncryptKey(keyServiceUrl);    
    var pwdctrl = document.getElementById(pwdCtrlId);
    var pwd = pwdctrl.value;
    var encrypt = new String('');
    for (var i = 0; i < pwd.length; i++) {
        var a = pwd.charCodeAt(i);
        var b = key.charCodeAt(key.length - (i + 1));
        var c = a ^ b;
        encrypt = encrypt + String.fromCharCode(c);
    }
    pwdctrl.value = encrypt.valueOf();
}

function getEncryptKey(keyServiceUrl) {
    var request = new XMLHttpRequest();
    request.open("GET", keyServiceUrl, false);
    request.send(null);
    return request.responseText.valueOf();
}*/