//===========================================================================================
//
// the first set of functions are for testing the new tracker applet feature which allows
// a javascript function to be called when the tracker graphic is clicked -- instead of
// opening a page.


function imRequestChatFunction(fromUser, requestedAction, actionURL, actionTarget) {

	popupURL = actionURL +"&fromUser=" + fromUser;
	
	thewidth = 385;
	theheight= 275;

	if (document.all) {
	
		window.open (popupURL, actionTarget, 'leftmargin=0,topmargin=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + parseInt(thewidth) + ',height=' + parseInt(theheight) + ',left=20,top=20');
		
	} else {
		window.open (popupURL, actionTarget, 
		
	'leftmargin=0,topmargin=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + parseInt(thewidth) + ',height=' + parseInt(theheight) + ',screenx=20,screeny=20');
	
	}


}



//============================================================================================
//=== used by normal chat applet demos
//    this one uses the normal room (not the invite room used for tracking)

function initiateHavChatIM(fromUser, toUser) {

	myImPage = "http://www.hav.com/include/chat/chatIMCPopup.htm?auto=1&fromUser=" 
	             + fromUser + "&aliasedUser=" + toUser;
	
	imWindowName = "havChatImWin";
	
	thewidth = 385
	theheight= 275
	
	initiateHavChatIMOpen(myImPage, thewidth, theheight, imWindowName);
}

//============================================================================================
//=== used by tracker applet on pages
//    this one specifies the invite roomID when opening the IM popup

function initiateHavChatIMroomInvite (fromUser, toUser) {

	myImPage = "http://www.hav.com/include/chat/chatIMCPopup.htm?auto=1&fromUser=" 
	             + fromUser + "&aliasedUser=" + toUser + "&roomID=invite";
	
	imWindowName = "havChatImWin";
	thewidth = 385;
	theheight= 275;
	
	initiateHavChatIMOpen(myImPage, thewidth, theheight, imWindowName);
}



//============================================================================================
//=== this actually performs the IM popup window opening call

function initiateHavChatIMOpen (popupTarget, thewidth, theheight, winName) {

	if (top.frames.length == 2) {
		parent.havChatImWin.location = popupTarget;

	} else {
		if (document.all) {
		
			window.open (popupTarget, winName, 'leftmargin=0,topmargin=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + parseInt(thewidth) + ',height=' + parseInt(theheight) + ',left=20,top=20');
			
		} else {
			window.open (popupTarget, winName,		
		'leftmargin=0,topmargin=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + parseInt(thewidth) + ',height=' + parseInt(theheight) + ',screenx=20,screeny=20');
		
		}
	}
}


