/**
 * @author John Pereira, <john.p@proporta.com>
 * This is the JS file for our chat system.
 * Just a few functions to query stuff
 */
$	= jQuery.noConflict();
if (typeof(_baseURL) == "undefined" || typeof(_baseURL) == null || _baseURL == ""){
	_baseURL	= "http://www.proporta.com";
}

function isActiveRoom(roomName) {
	$.get(_baseURL + "/chat-status/get-status", {"roomName":roomName}, function(data){
		parsedData	=	 eval("(" + data + ")" );

		if (parseInt(parsedData.STATUS) == 1) {//room is active 
			return true;
		} else {
			return false;
		}
	});
}

/**
 * Shows or hides the appropriate div
 * @param {String} chatDivId
 * @param {String} otherDivId
 */
function initChatDiv(roomName, chatDivId, otherDivId) { 
	
	$.get(_baseURL + "/chat-status/get-status", {"roomName":roomName}, function(data){
		
		parsedData	=	 eval("(" + data + ")" );

		if (parseInt(parsedData.STATUS) == 1) {//room is active 
			$("#" + chatDivId).show();
			$("#" + otherDivId).hide()
		} else {
			$("#" + otherDivId).show();
			$("#" + chatDivId).hide();
		}
	});

}

