/*
This script contains variable settings for the AnoBBS window
Name: anobbs_vars.js
It should be called _before_ the script anobbs.js
This revision: # v. 1.0 # June/July 2008. 
Code by Knut Møgster # mogster@boomdesign.no | http://www.redesign.no #
*/

// Set the php-script for the bbs treatment
var urlbs = 'anobbs.php';
var curdoc;
// Set language data
var bbslang = new Array();
bbslang[0] = 'Nickname';
bbslang[1] = 'Auth code (Code phrase)';
bbslang[2] = '* mandatory fields';
bbslang[3] = 'Forum name (*)';
bbslang[4] = 'Forum description';
bbslang[5] = 'Group name (*)';
bbslang[6] = 'Group description';
bbslang[7] = 'Login';
bbslang[8] = 'Edit forum';
bbslang[9] = 'Edit users';
bbslang[10] = 'Show forum';
bbslang[11] = 'New topic';
bbslang[12] = 'Save BBS';
bbslang[13] = 'Update forum';
bbslang[14] = 'Migrate BBS';
bbslang[15] = 'Delete BBS';
bbslang[16] = 'Forum name is mandatory';
bbslang[16] = 'hosted by';
bbslang[17] = 'Topic (Replies)';
bbslang[18] = 'Author';
bbslang[19] = 'Posted';
bbslang[20] = 'Last post - author';
bbslang[21] = 'Status';
bbslang[22] = 'Open';
bbslang[23] = 'Locked';
bbslang[24] = 'Print topic';
bbslang[25] = 'Print thread';
bbslang[26] = 'Save thread';
bbslang[27] = 'Subject&nbsp;(max&nbsp;70&nbsp;chrs): ';
bbslang[28] = 'Replies:';
bbslang[29] = 'Reply';
bbslang[30] = 'Edit';
bbslang[31] = 'Delete';
bbslang[32] = 'Reply headline:';
bbslang[33] = 'Reply headline is mandatory';
bbslang[34] = 'Topic title is mandatory';
bbslang[35] = 'No topics to display';
bbslang[36] = 'Forumdata not set, forum not open yet';
bbslang[37] = 'Forum';
bbslang[39] = '<b>This is a saved AnoBBS topic.</b><br>It is 3DES encrypted, so you need to type in the code phrase for decryption to see the content.';
bbslang[40] = '<b>This is a saved AnoBBS forum.</b><br>It is 3DES encrypted, so you need to type in the code phrase for decryption to see the content.';
bbslang[41] = 'The code phrase is not correct';
bbslang[42] = 'Code phrase:';
bbslang[43] = 'Decrypt';
bbslang[44] = '<br><br><br>No users yet<br><br><br>';
bbslang[45] = 'Today';
bbslang[46] = 'Delete thread';
bbslang[47] = 'Edit topic';
bbslang[48] = 'Lock thread';
bbslang[49] = 'Nick';
bbslang[50] = 'Userlevel';
bbslang[51] = 'Action';
bbslang[52] = 'Make user';
bbslang[53] = 'Make moderator';
bbslang[54] = 'Make admin';
bbslang[55] = 'Last active';
bbslang[56] = 'User posts';
bbslang[57] = 'Open thread';
bbslang[58] = 'Status: ';
bbslang[59] = 'This will delete the thread. Are you sure?';
bbslang[60] = 'This will delete the post. Are you sure?';
bbslang[61] = 'Sticky on';
bbslang[62] = 'Sticky off';
bbslang[63] = 'Delete user';
bbslang[64] = 'This will delete the user (but not the user posts). Are you sure?';
bbslang[65] = 'Print AnoBBS thread:';
bbslang[66] = 'Saved:';
bbslang[67] = 'Log out';
bbslang[68] = 'Topics:';
bbslang[69] = 'Users:';
bbslang[70] = 'BBS created: ';
bbslang[71] = 'Delete BBS';
bbslang[72] = 'You may save the BBS first, using the Save BBS link above.<br>If you save that page locally, the BBS will be saved in one flat encrypted HTML-file, which will be fully browsable for later reference. You may also export the BBS to an XML file for restore later by choosing Export BBS (XML).';
bbslang[73] = 'This will delete this BBS and all topics. Are you sure?';
bbslang[74] = 'Type your password:';
bbslang[75] = 'You must type your password to confirm deletion.\nPassword did not pass first check';
bbslang[76] = 'Set auth code';
bbslang[77] = 'Visitors:';
bbslang[78] = '  Logged in successfully';
bbslang[79] = '  Fetching content ...';
bbslang[80] = '  Decrypting ...';
bbslang[81] = '  Executing ...';
bbslang[82] = '  Done!';
bbslang[83] = 'Export BBS';
bbslang[84] = 'Export the BBS to a XML file. If needed the BBS can be restored later using the import function.<br>NB! This will send the K2 key (forum authentication encryption key) over the net as this is saved in the forum file.<br>There is no way around this.'
+'<br><br>How to import the BBS:<br>Create a BBS with the same key as the one saved, then choose Import BBS (XML). The imported file data will replace the data in the newly created BBS and restore the old BBS instead.';
bbslang[85] = 'Import BBS';
bbslang[86] = 'Import the BBS from a XML file, AnoBBS formatted. NB! This BBS wll be replaced with the imported BBS.';
bbslang[87] = 'Upload BBS file (XML)';
bbslang[88] = 'Upload';
bbslang[89] = 'The file type is not correct. The file need to be XML, AnoBBS formatted';
bbslang[90] = 'Direct link to this forum. Copy and distribute for easier access';

// Set states for user navigation
var tlinukrowstates = new Array();
tlinukrowstates[0] = 'sforum';
tlinukrowstates[1] = 'ntopic';
// Set states for admin navigation
var tlinkarowstates = new Array();
tlinkarowstates[0] = 'eforum';
tlinkarowstates[1] = 'emods';
tlinkarowstates[2] = 'saveforum';
tlinkarowstates[3] = 'deleteforum';

var authtforumlinkrows = '';
var authtforumlinkstates = '';

var xdays = new Array();
xdays[0] = 'Sunday';
xdays[1] = 'Monday';
xdays[2] = 'Tuesday';
xdays[3] = 'Wednesday';
xdays[4] = 'Thursday';
xdays[5] = 'Friday';
xdays[6] = 'Saturday';

// How long before user cannot edit his own post anymore? / 15 mins
//var pDiff = 900;
// 5 minutes
var pDiff = 300;
// Off. User can always edit his previous posts
//var pDiff = 0;

function doextTimestamp(rstamp) {
	var atime = new Date(rstamp * 1000);
	var vsRtime = atime.toLocaleString();
	return vsRtime;
}

function doulistTimestamp(rstamp) {
	var atime = new Date(rstamp * 1000);
	var aday = atime.getDay();
	var vsRtime = xdays[aday]+', '+dformat(atime.getDate())+'.'+dformat(atime.getMonth()+1)+'-'+atime.getFullYear().toString()+'';
	return vsRtime;
}

function doulistshrtTimestamp(rstamp) {
	var atime = new Date(rstamp * 1000);
	var vsRtime = dformat(atime.getHours())+':'+dformat(atime.getMinutes())+'';
	return vsRtime;
}

function doTimestamp(rstamp) {
	var atime = new Date(rstamp * 1000);
	var vsRtime = dformat(atime.getDate())+'.'+dformat(atime.getMonth()+1)+'-'+atime.getFullYear().toString().substr(-2)+' '+dformat(atime.getHours())+':'+dformat(atime.getMinutes())+'';
	return vsRtime;
}

function dayRet(stmestmp) {
	var atime = new Date(stmestmp * 1000);
	var vsRtime = atime.getDay();
	return vsRtime;
}

function comparedateRet(stmestmp) {
	var atime = new Date(stmestmp * 1000);
	var vsRtime = dformat(atime.getDate())+'.'+dformat(atime.getMonth()+1)+'-'+atime.getFullYear().toString().substr(-2)
	return vsRtime;
}

// Smiley array
var scodearr= new Array(17);
scodearr[0]='icon_biggrin.gif=:biggrin:';
scodearr[1]='icon_smile.gif=:smile:';
scodearr[2]='icon_wink.gif=:wink:';
scodearr[3]='icon_sad.gif=:sad:';
scodearr[4]='icon_confused.gif=:confused:';
scodearr[5]='icon_lol.gif=:lol:';
scodearr[6]='icon_mad.gif=:mad:';
scodearr[7]='icon_cool.gif=:cool:';
scodearr[8]='icon_rolleyes.gif=:rolleyes:';
scodearr[9]='icon_scared.gif=:scared:';
scodearr[10]='icon_eek.gif=:eek:';
scodearr[11]='icon_razz.gif=:razz:';
scodearr[12]='icon_death.gif=:death:';
scodearr[13]='icon_cry.gif=:cry:';
scodearr[14]='icon_nerd.gif=:nerd:';
scodearr[15]='icon_sleep.gif=:sleep:';
scodearr[16]='icon_hoho.gif=:hoho:';

// Colors and text for the user list in the chat.
function colorUsers(lined, utst, servtime) {
	var gtime = (parseInt(servtime) - parseInt(utst));
	if(comparedateRet(utst) == comparedateRet(servtime)) {
		var vsLastvisit = doulistshrtTimestamp(utst);
		} else {
		var vsLastvisit = doTimestamp(utst);
	}	
	return '<span class="ulist1"><b>'+lined+'</b> '+vsLastvisit+'</span>';
}

// For linkrow
var tlinkrowuser = "";
var tlinkrowadm = "";
var tlinklogout = "";

function retMainlinks() {
	// Make links for user navigation
	tlinkrowuser = '<a href="#" name="sforum" id="sforum" class="pstate_on" onClick="loadBBSlayer(\'sforum\');return false" onFocus="this.blur()">'+bbslang[10]+'</a>'
	+'<a href="#" name="ntopic" id="ntopic" class="pstate_off" onClick="loadBBSlayer(\'ntopic\');return false" onFocus="this.blur()">'+bbslang[11]+'</a>';
	// Make links for admin navigation
	tlinkrowadm = tlinkrowuser+'<a href="#" name="eforum" id="eforum" class="pstate_off" onClick="loadBBSlayer(\'eforum\');return false" onFocus="this.blur()">'+bbslang[8]+'</a>'
	+'<a href="#" name="emods" id="emods" class="pstate_off" onClick="loadBBSlayer(\'emods\');return false" onFocus="this.blur()">'+bbslang[9]+'</a>'
	+'<a href="#" name="saveforum" id="saveforum" class="pstate_off" onClick="iniBBSave();return false" onFocus="this.blur()">'+bbslang[12]+'</a>'
	+'<a href="#" name="deleteforum" id="deleteforum" class="pstate_off" onClick="loadBBSlayer(\'deleteforum\');return false" onFocus="this.blur()">'+bbslang[15]+'</a>';
	// Logout link
	tlinklogout = '<a href="#" name="dologout" id="dologout" class="pstate_off" onClick="log_out();return false" onFocus="this.blur()">'+bbslang[67]+'</a>';
}

var enablepersist = "off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious = "yes" //Collapse previously open content when opening present? (yes/no)

