

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

var loginpage = "af.htm"; //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("seq1","italy","af2.htm"); // Change these two entries to valid logins.

users[1] = new Array("olivetti","rocks","");          // Add addtional logins, straight after these, as

users[2] = new Array("göteborg","dfg158","img/deactivated.htm");

users[3] = new Array("imw","hjk651","");

users[4] = new Array("emwe","awk845","");

users[5] = new Array("tomelilla","cbf549","");

users[6] = new Array("teamoffice","ytd583","img/deactivated.htm");

users[7] = new Array("hasse","sft924","img/deactivated.htm");

users[8] = new Array("ahlsen","kyt948","img/deactivated.htm");

users[9] = new Array("faxia","hui541","img/deactivated.htm");

users[10] = new Array("affärsmedia","jil894","img/deactivated.htm");

users[11] = new Array("actor","ljk516","img/deactivated.htm");

users[12] = new Array("butikstjänst","dmg315","img/deactivated.htm");

users[13] = new Array("lars.k","hkl394","img/deactivated.htm");

users[14] = new Array("gotland","gji615","img/deactivated.htm");

users[15] = new Array("iteam","qwe834","img/deactivated.htm");

users[16] = new Array("kalle.a","gjp942","");

users[17] = new Array("sweway","mdl492","");

users[18] = new Array("kontorsfac","tdy135","");

users[19] = new Array("entertek","kdt213","");

users[20] = new Array("kisab","dcf653","");

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

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

//  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); 

  top.location.href = successpage;           

  }

 else {

  alert('access denied');

  }  

}



function logout() {

 deleteCookie("login");

 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'); 

 top.location.href=loginpage; }

}



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

// Login Panel

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



function BuildPanel() {

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

document.write('<small><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"><small><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="center" colspan="2"><p><input type="button" value="Logon" name="Logon" onclick="login(username.value,password.value)">'); 

} else {

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

}

if(imgReset == ""){

 document.write('<input type="reset" value="Reset" name="Reset">');

} else {

 document.write('<input type="image" src="'+imgReset+'" name="Reset" onclick="logon.reset();">');

}

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

}



