//----------------------------------------------------------------

//  Usernames, Passwords & User Pages - These require configuration.

//----------------------------------------------------------------

var successpage = "test.html"; // The page users go to after login, if they have no personal page.

var loginpage = "logintest.html"; //Change this to the page the login panel is on.



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("Tammi","Matt","t+m webx3_watermark/"); // Change these two entries to valid logins.

users[1] = new Array("air","traffic","ATC web/");          // Add addtional logins, straight after these, as

users[2] = new Array("cherie","john","cherie web/");          // required, followig the same format. Increment the 

users[3] = new Array("cassandra","ryan","c+r_her prep/");// numbers in the square brackets, in new each one. Note:

users[4] = new Array("Lilly","Ky","Lilly_Ky test/");

users[5] = new Array("tati","kelly","kelly/");

users[6] = new Array("april","food","april/");

users[7] = new Array("bretagne","photojason","vince/");

users[8] = new Array("skate","july","Skaters");

users[9] = new Array("sarah","arthur","sarah allen/");

users[10] = new Array("lilly","birthday","lilly's 2nd/");

users[12] = new Array("nicole","chris","nicole fraser/");

users[11] = new Array("sonya","macisaac","sonya/");

users[13] = new Array("maya","steele","maya/");

users[14] = new Array("austin","123","austin/");

users[15] = new Array("keaton","123","keaton/");

users[16] = new Array("angela","marcel","angie/");

users[17] = new Array("nathalie","angus","angus/");

users[18] = new Array("cheryl","adam","cheryl/");

users[19] = new Array("lukas","jonas","lukas and jonas/");

users[20] = new Array("black","union","black union/");

users[21] = new Array("online","portfolio","online portfolio/");

users[22] = new Array("strut","linda","strut/");

users[23] = new Array("lori","eric","lori/");

users[24] = new Array("green","monster","greenmonster/");

users[25] = new Array("zander","elissa","zander/");

users[26] = new Array("julie","josh","josh/");

users[27] = new Array("golden","gala","gold/");

users[28] = new Array("sara","bryan","now/");

users[29] = new Array("megan","stephen","megan/");

users[30] = new Array("diane","patrick","diane/");

users[31] = new Array("jacquelyn","anthony","jacquelyn/");

users[32] = new Array("tracey","brent","tracey/");

users[33] = new Array("nikki", "andrew", "nikki/");

users[34] = new Array("angela", "charles", "angela 4 web/");

users[35] = new Array("samantha", "doug", "samantha_2008/");

users[36] = new Array("astrid", "anthony", "anthony web/");

users[37] = new Array("vicki", "ben", "Vicki_web/");

users[38] = new Array("bluenose", "cruise", "bluenose/");

users[39] = new Array("melissa", "jason", "melissa/");

users[40] = new Array("karen", "kristopher", "karen and kristopher/");

users[41] = new Array("bettina", "benjamin", "Bettina_Benjamin/");

users[42] = new Array("janice", "kris", "janice_kris/");

users[43] = new Array("mrazek", "family", "mrazek_web/");

users[44] = new Array("kelly-jo", "stuart", "web_kelly-jo/");

users[45] = new Array("danielle", "michael", "danielle/");

users[46] = new Array("veronique", "cyprian", "veronique/");

users[46] = new Array("veronique", "cyprian", "veronique/");

users[47] = new Array("test", "test", "veronique-v1/");

users[48] = new Array("amy", "brendan", "amy-brendan/");

users[49] = new Array("krista", "andrew", "krista-andrew/");

users[50] = new Array("melanie", "richard", "melanie_richard/");

users[51] = new Array("katherine", "mark", "katherine-mark/");

users[52] = new Array("michelle", "ian", "michelle_ian/");

users[53] = new Array("erin", "dave", "erin-dave/");

users[54] = new Array("erin", "greg", "erin-greg/");

users[55] = new Array("louphi", "leo", "louphi-leo/");

users[56] = new Array("anne", "richard", "anne-richard/");


		   					              

										  // 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.

//----------------------------------------------------------------

//  Login Functions

//----------------------------------------------------------------





function login(username,password){

 var member = null;

 var loggedin = 0;

 var members = users.length;

 for(x=0;x<members && !loggedin; x++){

 if((username==users[x][0])&&(password==users[x][1])){

    loggedin = 1;

    member = x;

	break; // User validated, terminate the for loop.

   }

 } 

 

 if(loggedin==1){

  if(users[member][2] != "") {

   successpage = users[member][2];

  }

  setCookie("login",1);

  if (top.location.href != location.href){

   location.href = successpage;           

  }else{

   top.location.href = successpage;  

  }

 }else{

  alert('Sorry, that username and password combination is not valid.  Please try again.');

 }  

}



function logout() {

 deleteCookie("login");

 if (top.location.href != location.href){

  location.href = loginpage;           

 }else{

  top.location.href = loginpage;  

 }

}





//----------------------------------------------------------------

// Cookie Handler

//----------------------------------------------------------------

var ckTemp = document.cookie;



function setCookie(name, value) { 

 if (value != null && value != "")

  document.cookie=name + "=" + escape(value) + ";";

 ckTemp = document.cookie;

 }

 

function deleteCookie(name) {

  if (getCookie(name)) {

    document.cookie = name + "=" +

    "; expires=Thu, 01-Jan-70 00:00:01 GMT";

  }

}



function getCookie(name) { 

 var index = ckTemp.indexOf(name + "=");

 if(index == -1) return null;

  index = ckTemp.indexOf("=", index) + 1;

 var endstr = ckTemp.indexOf(";", index);

 if (endstr == -1) endstr = ckTemp.length;

 return unescape(ckTemp.substring(index, endstr));

 }

  

function checkCookie() {

 var temp = getCookie("login");

 if(!temp==1) {

  alert('access denied'); 

  if(top.location.href != location.href){

   location.href = loginpage;           

  }else{

   top.location.href = loginpage;  

  }

 }

}



//----------------------------------------------------------------

// Login Panel

//----------------------------------------------------------------



function BuildPanel() {

document.write('<form target="new" name="logon"><table align="center" border="0"><tr><td align="right">');

document.write('<xx-large><font face="Verdana">Username:</font></small></td>');

document.write('<td><small><font face="Verdana"><input type="text" name="username" size="20"></font></small></td></tr>');

document.write('<tr><td align="right"><xx-large><font face="Verdana">Password:</font></small></td>');

document.write('<td><small><font face="Verdana"><input type="password" name="password" size="20"></font></small></td></tr>');

if(imgSubmit == ""){

 document.write('<tr><td align="right" colspan="2"><p><input type="button" value="Logon" name="Logon" onclick="login(username.value,password.value)">'); 

} else {

 document.write('<tr><td align="right" colspan="2"><p><input type="image" src="'+imgSubmit+'" name="Logon" onclick="login(username.value,password.value)">');

}



document.write('</p></td></tr></table></form>');

}

