/*
var c_CurrentlyChattingWith = null;
var c_NewMessagesForAlert = new Array();
var c_AlertNewMessage_Started = false;
var c_ListnerReqCount = 0;
var c_ShowOpenConverstationsInterval = false;

// confs 
function c_ShowOpenConfs()
{
	var oc = g('Shell_OpenConfs');
	oc.style.display = 'block';
	var eyeLeftPos = calcLeftPosition(g('ShellConfsTable'));
	oc.style.left = eyeLeftPos;
	document.onmousemove = c_ShowOpenConfsMM;
	
	HideZIndexHaters();
}

function c_ShowOpenConfsMM(e)
{
	if(!c_ShowOpenConfsMM_Class('Shell_OpenConfsFLAG' , e))
		c_HideOpenConfs()
}

function c_ShowOpenConfsMM_Class(name , e)
{   
	var startElement = e ? e.target : event.srcElement;
	
	while(true)
	{
		if(startElement && startElement.className && startElement.className.indexOf(name) != -1)
			return true;
		
		if(startElement.parentNode)
			startElement = startElement.parentNode;
		else
			return false;
	}
	
	return true;
}

function c_HideOpenConfs()
{
	g('Shell_OpenConfs').style.display = 'none';
	document.onmousemove = getMousePos;
	
	ShowZIndexHaters();
}
// end confs

function c_ShowOpenConversations()
{
	var oc = g('Shell_OpenConversations');
	oc.style.display = 'block';
	var eyeLeftPos = calcLeftPosition(g('ShellChatTable'));
	oc.style.left = eyeLeftPos;
	document.onmousemove = c_ShowOpenConversationsMM;
	g('ShellChatEye').style.backgroundColor = '#E3E3E3';
	
	HideZIndexHaters();
}

function c_ShowOpenConversationsMM(e)
{
	if(!c_ShowOpenConversationsMM_Class('Shell_OpenConversationsFLAG' , e))
		c_HideOpenConversations()
}

function c_ShowOpenConversationsMM_Class(name , e)
{   
	var startElement = e ? e.target : event.srcElement;
	
	while(true)
	{
		if(startElement && startElement.className && startElement.className.indexOf(name) != -1)
			return true;
		
		if(startElement.parentNode)
			startElement = startElement.parentNode;
		else
			return false;
	}
	
	return true;
}

function c_HideOpenConversations()
{
	g('Shell_OpenConversations').style.display = 'none';
	document.onmousemove = getMousePos;
	g('ShellChatEye').style.backgroundColor = '#ffffff';
	
	ShowZIndexHaters();
}

function c_OpenChat(chatingWith)
{
	c_CurrentlyChattingWith = chatingWith;
	var chatArea = g('CHATAREA');
	chatArea.style.display = '';
	chatArea.style.position = 'absolute';
	chatArea.style.zIndex = 100;
	
	if(chatArea.innerHTML.length == 0) // get whole chat area
	{
		chatArea.innerHTML = aj_c('getchatUI=' + chatingWith);
	}
	else // refersh just sections
	{
		g('CHATAREA_PARTIALDATA').innerHTML = aj_c('getchatUI=' + chatingWith + '&partial=t');
		g('Wind_OpenConversations').innerHTML = g('Wind_OpenConversations_Partial').innerHTML;
		g('ChatTopDiv').innerHTML =	g('ChatTopDiv_Partial').innerHTML;
		g('CHATAREA_PARTIALDATA').innerHTML = ''
	}
		
	PositionFloatingElement(chatArea);
	c_RemoveNewMessage_FromAlert(chatingWith);
	g('CONVOWIND' + chatingWith).style.backgroundColor = '#efefef';
	var chatTopDiv = g('ChatTopDiv');
	chatTopDiv.scrollTop = chatTopDiv.scrollHeight;
	c_TBFocus();
}

function c_IsChatWindowOpen()
{
	return g('CHATAREA').style.display == '';
}

function c_TBFocus()
{
	var cTB = g('CHATTEXTBOX');
	cTB.focus();
}

function c_ChatTextBoxKeyPress(e)
{
	if(DetectEnter(e))
	{
		c_SubmitChatText();
	}
}

function c_ChatTextBoxKeyUp(e)
{
	if(DetectEnter(e))
	{	
		var tb = g('CHATTEXTBOX');
	    tb.value = '';
		c_TBFocus();
	}
}

function c_SubmitChatText()
{
	var tb = g('CHATTEXTBOX');
	var txt = tb.value;
	
	if(IsEmptyText(txt))
		return;
	
	var q = 'submitChatTxt=' + lescape(txt) + '&sendTo=' + c_CurrentlyChattingWith;
	var chatTopDiv = g('ChatTopDiv');
	chatTopDiv.innerHTML = aj_c(q);
	chatTopDiv.scrollTop = chatTopDiv.scrollHeight;
		
	if(g('CONVOSHELL' + c_CurrentlyChattingWith) == null)
		g('Shell_OpenConversations').innerHTML = aj_c('getOpenConvosFor=shell');
}

function c_ChatClose()
{
	var chatArea = g('CHATAREA');
	chatArea.style.display = 'none';
}

function c_ToogleInvisible()
{
	var eyeIcon = g('Shell_ChatEyeIcon');
	var isOpen = eyeIcon.src.indexOf('EyeIcon.gif') > 0;
	var chatTbl = g('ShellChatTable');
	
	if(isOpen)
	{
		aj_c('setInvisibleMode=on');
		chatTbl.className = 'ShellChatBoxInvisible';
		eyeIcon.src	= ip() + 'EyeIconClosed.gif';
	}
	else
	{	
		aj_c('setInvisibleMode=off');
		chatTbl.className = 'ShellChatBox';
		eyeIcon.src	= ip() + 'EyeIcon.gif';		
	}
}

function c_BackgroundListner_Start()
{
	// window.setInterval(c_BackgroundListner_MakeRequest , 500);
}

var c_Request_Count = 0;
function c_BackgroundListner_MakeRequest()
{
	if(c_Request_Count != 0)
		if(c_Request_Count != 	c_ResponseCount)
			return;
	
	if(g('__CURENTUSER') != null)
	{
	    if(g('__HOSTED_IN_MAIN').value == 'False')
            return;
            
        if(g('__CHAT_DISABLED'))
            return;
        
        var COMM_VIEWING_COMMENTS = g('COMM_VIEWING_COMMENTS');
        
            
		if (window.XMLHttpRequest) { http_request_c_list = new XMLHttpRequest();  } else if (window.ActiveXObject) {  try { http_request_c_list = new ActiveXObject("Msxml2.XMLHTTP"); } 	catch (e) { try { http_request_c_list = new ActiveXObject("Microsoft.XMLHTTP"); } 	catch (e) {} } }
		http_request_c_list.open('GET', 'Graphics/AJAX/chat.aspx?pingChat=t&blrc=' + (c_ListnerReqCount++) + (COMM_VIEWING_COMMENTS  ? '&currentComments=' + COMM_VIEWING_COMMENTS.value : '') , true);
		http_request_c_list.onreadystatechange = c_BackgroundListner_Response;
		http_request_c_list.send(null);
		c_Request_Count++;
	}
}

var c_AlertNewMessage_Start_ClearIntervalID = null;
var c_PlayedSound = false;

function c_AlertNewMessage_Start()
{
	if(!c_AlertNewMessage_Started)
	{
		c_PlayedSound = false;
		c_AlertNewMessage_Started = true;
		c_AlertNewMessage_Start_ClearIntervalID = 
			window.setInterval(c_AlertNewMessage_Loop , 400);
	}
}

function c_AlertNewMessage_Loop()
{
	if(c_NewMessagesForAlert.length == 0)
	{
		window.clearInterval(c_AlertNewMessage_Start_ClearIntervalID);
		c_AlertNewMessage_Started = false;
		return;
	}
	
	if(!c_PlayedSound && !c_IsChatWindowOpen())
	{
		// SoundObject.PlaySound();
		c_PlayedSound = true;
	}
	
	for(var i = 0; i < c_NewMessagesForAlert.length; i++)
	{	
		var itmShl = g('CONVOSHELL' + c_NewMessagesForAlert[i]);
		
		if(itmShl)
		{
		    if(itmShl.style.backgroundColor != '#ccffcc')
			    itmShl.style.backgroundColor = '#ccffcc';
		    else
			    itmShl.style.backgroundColor = 'white';
        }
	
		var itmWnd = g('CONVOWIND' + c_NewMessagesForAlert[i]);
		if(itmWnd != null) 
		{
			if(itmWnd.style.backgroundColor != '#ccffcc')
				itmWnd.style.backgroundColor = '#ccffcc';
			else
				itmWnd.style.backgroundColor = 'white';
		}
		
		var shellChatEye = g('ShellChatEye');
		if(shellChatEye)
		{
		    if(shellChatEye.style.backgroundColor != '#ccffcc')
			    shellChatEye.style.backgroundColor = '#ccffcc';
		    else
			    shellChatEye.style.backgroundColor = 'white';
		}
		
		if(c_IsChatWindowOpen() && c_CurrentlyChattingWith == c_NewMessagesForAlert[i])
		{
			c_OpenChat(c_CurrentlyChattingWith);
			c_RemoveNewMessage_FromAlert(c_NewMessagesForAlert[i]);
			// MAKE MESSAGE BLINK THREE TIMES
		}
	}
}

function c_RemoveNewMessage_FromAlert(fromID)
{
	GLOBAL_array_removeByVal(fromID , c_NewMessagesForAlert);	

	var itmShl = g('CONVOSHELL' + fromID);
	if(itmShl != null)
		itmShl.style.backgroundColor = 'white';

	var itmWnd = g('CONVOWIND' + fromID);
	if(itmWnd != null)
		itmWnd.style.backgroundColor = 'white';
		
	c_TBFocus();
}

var c_ResponseCount = 0;

function c_BackgroundListner_Response()
{
	if(!http_request_c_list)
	    return;
	    
	if(http_request_c_list.readyState == 4)
	{
		if (http_request_c_list.status == 200)
		{
			if(http_request_c_list.responseText != '<>')
			{			
			    var responseTxt = http_request_c_list.responseText.substring(2 , http_request_c_list.responseText.length);
	
                var CHATAREA_PARTIALDATA2_Obj = g('CHATAREA_PARTIALDATA2');
               
                CHATAREA_PARTIALDATA2_Obj.innerHTML = responseTxt;
                
                var CHAT_NMA_Obj = g('CHAT_NMA');
                var COMMENTS_REFRESH_Obj = g('COMMENTS_REFRESH');
                
                if(COMMENTS_REFRESH_Obj)
                    g('comm_CommentRecords').innerHTML = COMMENTS_REFRESH_Obj.innerHTML;
                
			    
                if(!CHAT_NMA_Obj)
                    return;
                    
				var newMessages = CHAT_NMA_Obj.innerHTML.split(',');
				
                CHATAREA_PARTIALDATA2_Obj.innerHTML = '';
				
				
				for(var i = 0; i < newMessages.length; i++)
				{ 
					var convoShell = g('CONVOSHELL' + newMessages[i]);
					
					if(convoShell == null)
						g('Shell_OpenConversations').innerHTML = aj_c('getOpenConvosFor=shell');
					
					if(c_IsChatWindowOpen())
					{
						var convoWind = g('CONVOWIND' + newMessages[i]);
						if(convoWind == null)
						{
							g('Wind_OpenConversations').innerHTML = aj_c('getOpenConvosFor=' + c_CurrentlyChattingWith);
						}
					}
					
                    GLOBAL_array_addUnique(newMessages[i] , c_NewMessagesForAlert);
					c_AlertNewMessage_Start();
				}
			}
			
			c_ResponseCount++;	
		}
		else if (http_request_c_list.status == 777)
		{
			window.location = 'app.aspx?urlref=' +  window.location;
		}
	}
}
*/