﻿function aa(str)
         {
            var user= document.getElementById("tbName").value;
            var dds=""+str;
            var cookies = WM_readCookie(dds);
           
            if(cookies)
            {
                var arry=cookies.split('&');
                if(arry.length>0)
                {
                var name=decodeURIComponent(arry[0].split('=')[1]);
                
                
                if(user==name)
                {
                    var pwd=arry[1].split('=')[1];
                    document.getElementById("tbPassword").value=pwd;
                }else
                {
                    document.getElementById("tbPassword").value="";
                }
                }
            }
         }
         
        function WM_readCookie(name)
        {

        //如果没有cookie则返回false或者取得值并返回该值
        if(document.cookie == '')
        {     
            return false;
        }
        else
            return unescape(WM_getCookieValue(name));
        }



        function WM_getCookieValue(name)
        {
            // Declare variables.
            var firstChar,lastChar;
            // Get the entire cookie string.
            // (This may have othername=value pairs in it.)
            var theBigCookie = document.cookie;
            // Grabjust this cookie from theBigCookie string.
            // Find the start of'name'.
            firstChar = theBigCookie.indexOf(name);
            // If you found it,
            if(firstChar != -1)
            {
                // skip 'name' and '='.
                firstChar +=name.length + 1;
                // Find the end of the value string (i.e. the next';').
                lastChar = theBigCookie.indexOf(';', firstChar);
                if(lastChar == -1) lastChar = theBigCookie.length;
                // Return thevalue.
                return unescape(theBigCookie.substring(firstChar, lastChar));

            } else
            {
                // If there was no cookie, return false.
                return false;
            }
        }
