/**************DO NOT EDIT!****************
login and getcookie routine both made by *
Michael                                  *
For help look at readme.txt.             *
**************DO NOT EDIT!****************/

//login script 
var ttl=2                                          //+1 each time user is added or script won't work
var users=new Array(3)              //put new line here for every user added also add 1 to the number after new Array
users[0]="Created with"
users[1]="Java"
users[2]=""                        //leave this line here! just change the number!
var passs=new Array(3)             //Same as above only with their password
passs[0]="JavaScript"                          //User name and password is CaSe SeNsEtIvE!
passs[1]="is awesome"
passs[2]=""                        //leave this line here! just change the number!
function loginm(){
var user=document.logn.usr.value      //get user name
var pasw=document.logn.pass.value //get password
if(user=="")         //if user name is blank change to NaN is this is not there the person get's let in if they did
user="NaN"        //not type anything
if(pasw=="")       //same here
pasw="NaN"
for (y=0;y!=ttl;y++){                                                                                       //for loop to check wich area of the array to check
if (users[y]==user&&passs[y]==pasw){           //Check for a match
alert("You are now logged in!")                                                                 //if match found then
window.location="rightpage.htm"                                                            //change rightpage.htm to whatever you want
document.cookie="logged: {"+user+"|"                                                   //make cookie
y=ttl-1                                                                                                             //stop loop
}
}
}
var user
//Mike's get cookie routine!
function getCookie(){
var where=0                                                             //where to start getting cookie                                                            
var cookie=document.cookie                                //get cookie
var now=0                                                                 //what we have from the cookie so far
                                                                  //what we finaly have explained below
var to=0                                                                    //where to s
if (cookie.indexOf("logged: {")!=-1)                                    //if "{" found in 
where=cookie.indexOf("logged: {")                                   //where to start c
for (y=where;y<=100;y++){                                   //loop adds 1 to y explained below
now=cookie.substring(where, y)                       //each time 1 is added the more of cookie is checked
if(now.indexOf("|")!=-1){                                       //if "|" is found it is end of cookie
to=y                                                                         //knows where to end cookie
y=100                                                                     //stop loop
}
}
user=cookie.substring(where+9, to-1)        //user = from where+1 to get rid of { and to-1 to get rid of |
}
