////////////////////
//Chat Window Manager functions
////////////////////
var nBox = 0;
var maxBox = 5;
var chatBoxWidth = 230;
var chatBoxHeight = 170;
var videoBoxHeight = 150;
var visibleChatBoxes = new Array();
var offsetForFlowBox = 0;
var chatBoxSeparation = chatBoxWidth+12;
function createChatBox(guest_slug,guest_name,guest_jid,user_name,user_jid){
//Create chatbox for new conversations
//Open chatbox for old conversations
//Box Variable name = getChatVariableFromSlug(guest_slug)
if (typeof window[getChatVariableFromSlug(guest_slug)] == 'undefined') {
//Add div with id = guest_slug
$("#chat_divs").append("
")
//Offset Management for new box
boxParams = getBoxParams();
var offset = boxParams[0];
var position = boxParams[1];
window[getChatVariableFromSlug(guest_slug)] = $("#" + guest_slug).chatbox({id: user_name,
user:{key : "value"},
hidden: false,
offset: offset, // relative to right edge of the browser window
width: chatBoxWidth, // width of the chatbox
height: chatBoxHeight, // height of the chatbox
video: 0, //height of the videoBox
title : guest_name,
position: position,
priority: visibleChatBoxes.length+1,
boxClosed: function(id) {
position = $("#" + guest_slug).chatbox("option", "position");
for (i=position+1;i tmp.chatbox("option", "priority")) {
tmp = visibleChatBoxes[i];
}
}
return visibleChatBoxes.indexOf(tmp);
}
function rotatePriority(guest_slug){
priority = $("#" + guest_slug).chatbox("option", "priority")
if(priority>1){
for (i=0;i"
}
///////////////////////////
// Create Main Chat Box
///////////////////////////
var mainChatBox;
var chatSlugId="SocialStream_MainChat";
function createMainChatBox(){
if (mainChatBox==null){
//createChatBox(guest_slug,guest_name,guest_jid,user_name,user_jid)
if (createChatBox(chatSlugId,"Chat","Any","Any","Any")){
mainChatBox = window[getChatVariableFromSlug(chatSlugId)]
//Modify default box
//Delete closeTick and video Tick
$(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").find(".ui-icon-closethick").remove();
$(mainChatBox.parent().parent()).find(".ui-videobox-icon").remove();
//Delete nofitications div
$(mainChatBox.parent()).find(".ui-chatbox-notify").remove();
//Delete video div
$(mainChatBox.parent()).find(".ui-videobox").remove();
//Delete input
$(mainChatBox.parent()).find(".ui-chatbox-input").remove();
//Set height
window[getChatVariableFromSlug(chatSlugId)].css( "height", "180" );
//Set width
var windowWidth=150;
window[getChatVariableFromSlug(chatSlugId)].parent().parent().css( "width", windowWidth );
$(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").css( "width", windowWidth-6 );
$(mainChatBox).css( "width", windowWidth-6 );
//Adjust window offset
offsetForFlowBox = 235-windowWidth;
//CSS Adjusts
$("#chat_partial").css("margin-top",-3)
$("#chat_partial").css("margin-left",-3)
$(".dropdown dd ul").css("min-width",147)
//Header title
updateConnectedUsersOfMainChatBox();
}
}
}
function addContentToMainChatBox(content){
if (mainChatBox != null) {
$(mainChatBox.parent()).find("#" + chatSlugId).html(content);
}
}
function modifyChatPartialIfMainBox(chatPartial){
if (mainChatBox != null) {
p = $(chatPartial)
$(p).find(".header").remove();
$(p).find(".dropdown dd ul").css("min-width",147);
return $(p);
}
return chatPartial;
}
function changeMainChatBoxHeaderTitle(title){
if (mainChatBox != null) {
$($(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").find("span")[0]).html(title);
}
}