/*****************************************************/
/* Simple login script written for Ledbetter Systems */
/*                                                   */
/* Author:  Ross Hytnen                              */
/* Contact: rhytnen@yahoo.com                        */
/*****************************************************/

function verify_login() {

    // Total_Clients should be the total number of users
    var Total_Clients = 2;
    userlist = new Array(4);

    userlist[0] = "Do not use this field"; // for counting reasons

    // Each user has 3 properties; name, password, personal page
    // Just make sure you add them sequetially and that you understand
    // all three elements are case sensative.
    // For the third element, the personal page, you may either use an URL
    // or a direct path/filename but a path/filename is preferable.

    userlist[1] = "client1";
    userlist[2] = "Password";
    userlist[3] = "page.htm";
   
    userlist[4] = "client2";
    userlist[5] = "password";
    userlist[6] = "http://cnn.com";

    userlist[7] = "client3";
    userlist[8] = "brennan";
    userlist[9] = "http://www.sasserhomes.com/brennan";

    for (var sentinel = 0; sentinel < Total_Clients + 1 ; sentinel = sentinel + 1) {

 	var index = sentinel*3;
        if (userlist[index + 1] == document.loginform.clientname.value) {
	    if (userlist[index + 2] == document.loginform.password.value) {
		location.assign(userlist[index+3]);
 	        break;
            } else { 
                alert("Invalid Username or Password");
	        break;
            }   
        }        
        if (sentinel == Total_Clients) {
            alert("Invalid Username or Password");
            break;
        }
    }
    
}

    

