
/*
-------------------------------------------------------------------
 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="../test-login/scripts/test/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="../test-login/scripts/test/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. 

*/
var rootfolder = ""; //add root folder name here
var cookiename = ""; //set this to unique cookie name so you cannot access other parts of the site with this login. 
var cookiename2 = ""; //set this to unique cookie name so you cannot access other parts of the site with this login. 
var cookiename3 = ""; //set this to unique cookie name so you cannot access other parts of the site with this login. 
var fullurl = window.location.href; //leave as is
var sPath = window.location.pathname; //leave as is
var sPath = sPath.replace(/%2D/gi, "-"); //takes out the %2D from the file path that is casued when you click on the breadcrumbs 
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";}//set this incase the user goes straight to login page and url string is not set
	else {successpage = successpage;}
	
if (successpage == "")
{
	var successpage = "index.html";
}
else
{successpage = successpage;
	
}	
		

var logoutpage = ""; //leave blank to set it to the login page. 

var show = ""; //leave blank and  set this same variable in the password file if needed
var show2 = ""; //leave blank and  set this same variable in the password file if needed
var show3 = ""; //leave blank and  set this same variable in the password file if needed
var show4 = ""; //leave blank and  set this same variable in the password file if needed
var showhide1 = "show";
