/*
-------------------------------------------------------------------
 Login Script Version 1.9
 By H G Laughland 
 http://www.laughland.biz

This script can be used free of charge and may only be
redistributed the same way. The disclaimer must remain
intact.

DISCLAIMER: Use this script with caution. This script is not 
the most secure method available, for protecting material. Its
main purpose is to demonstrate the javascript techniques used.
The author takes no responsibility for data loss
resulting from the use of this script.
-------------------------------------------------------------------

INSTRUCTIONS - Read Before Using Script

If you are using frames, the code referred to in steps 2 - 5 must be put in the 
pages displayed in the frames and NOT in the parent document.

Step 1
In the Usernames & Passwords section, configure the variables as
indicated by the comments.
 
Step 2:
Add the following code to the <head> section of your login page: 
 <script src="scripts/login.js"></script> 
Change "scripts/login.js" to reflect the correct path to this script
file on your server. 
 
Step 3:
Add this code to the login page, at the place you want the login
panel to show:
 
 <script language="JavaScript">
  BuildPanel();
 </script>
 
Step 4:
Add the following code to the <head> section of each page procteded
by this script:
 
 <script src="../scripts/login.js"></script>
 <script language="JavaScript">
  checkCookie();
 </script>

Change "scripts/login.js" to reflect the correct path to the script
file on your server.
 
Step 5: 
On the page that is to have the logout button, paste this code where you
want the button to be:

 <form action="" name="frmLogoff">
  <input type="button" name="btLogoff" value="log out" onclick="logout();">
 </form>
 
 To use your own image instead of the grey button change the type from button to image
 and add src="myimage.gif" where myimage.gif is the image (including the path to it if
 needed, you want to use.
 
Step 6:
Upload this script and your html pages to the relevant directories
on your server. 




*/

//----------------------------------------------------------------
//  Usernames, Passwords & User Pages - These require configuration.
//----------------------------------------------------------------

var sPath = window.location.pathname;
var sPagelogin = sPath.substring(sPath.lastIndexOf('/') +1);
var fullurl = window.location.href;

var successpage = fullurl.substring(fullurl.lastIndexOf('?') +1); // The page users go to after login, if they have no personal page.
if (successpage == fullurl)
{
	successpage = "index.html";}
	else {successpage = successpage;}
	
var loginpage = "login2.html"; //Change this to the page the login panel is on.
var logoutpage = ""; //leave blank to set it to the login page
var cookiename = "journeys2"; //set this to unique cookie name so you cannot access other parts of the site with this login

var imgSubmit = ""; //Change to the path to your login image,if you don't want the standard button, otherwise do not change.
var imgReset = "";  //Change to the path to your reset image,if you don't want the standard button, otherwise do not change.


var users = new Array();

//users[0] = new Array("niresource","journeys01","resources.html");
users[0] = new Array("niresource","Hodderjourneys02","resources.html");
// Add addtional logins, straight after these, as
// required, followig the same format. Increment the
// numbers in the square brackets, in new each one. Note:
// the 3rd parameter is the the page that user goes to
// after successful login. Ensure the paths are correct.
// Make this "" if user has no personal page.


