// Setup some varibles
var profiles;
var connections = [];
var active_profile;
var active_chat;
// Load the profiles
fs.readFile("profiles.json", "utf-8", function(err, data)
{
try
{
// Throw an error if there is one
if(err) throw err;
// Try to load it from the data
profiles = JSON.parse(data);
}
catch(e)
{
// Set the profiles varible to its default value
profiles = [];
}
// Reload the profiles
profiles_reload();
// Connect to all the profiles
for(var i=0;i"
+connections[id].chats[i].name+"";
}
// Create a users menu
var users_menu = "";
// Loop over the users
var users_array = Object.keys(connections[id].users);
for(var i=0;i"+users_array[i]+"";
}
// Set the html data
document.getElementById("chat-main").innerHTML = "\
\
\
\
\
";
// Set the title
document.title = title(id);
}
function chat_switch_to(id)
{
// Create the chat html
var chat_html = "";
// Setup some memory varibles
var last_chat_user = "";
var last_chat_date = "";
// Loop over the messages
for(var i=0;i "+date+"
";
}
// Add some html data to the chat
chat_html += "\
"+message_header+"\
"+text_to_html(connections[active_profile].chats[id].messages[i].message)+"
\
\
";
}
// Set the HTML
document.getElementById("chat-area").innerHTML = "\