﻿// JScript File

   
    function readCookie(cookies)
    {
        
      var txtuname=  document.getElementById('txtemail');
      var txtpass=  document.getElementById('txtpwd');
             
   
  if (document.cookie.length>0 && txtuname.value.length>0 )
  {
    // check the index of the username that is entered by user in Username text box 
     var  c_start=document.cookie.indexOf(txtuname.value);
      if (c_start!=-1)
        { 
      
  
        var    c_end=document.cookie.indexOf(";",c_start);
  
                if (c_end==-1) 
                {
                    c_end=document.cookie.length;
  
                }
      
      var value= unescape(document.cookie.substring(c_start,c_end));
  
           var arr = new Array(10);
           arr= value.split('=');
            // if only 0ne equal sign is present that is default one 
            if(arr[0]==txtuname.value && arr.length==2)
            {
                
                txtpass.value=arr[1];
             }
             // if the password contain =(equal) signs in it 
             else if(arr[0]==txtuname.value  && arr.length > 2)
             {
                 var pass=arr[1];
                 for(i=2;i<arr.length;i++)
                 {
                    pass += arr[i];
                 }
               
                  txtpass.value=pass;
             }
             else
             {
                  txtpass.value="";
             }
        }
            
           else
           {
                 txtpass.value="";
           }
    }
    else
    {
        txtpass.value="";
    }

    } 



