/* page.js */

function urlencode(str) {
	return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

function urldecode(str) {
	return unescape(str.replace('+', ' '));
}

/**
 * join the user into given channel name.
 * \param channel an URL encoded channel name the user is about to join.
 * \param nick the nick to use when chatting in in this chat-session
 */
function ChatJoin(channel, nick) {
	window.location = baseUrl 
					+ "/chat.csp?name=" + channel
					+ "&nick=" + encodeURIComponent(nick);
}
