/* We default to the smallest screen in case this guy has a version of IE
 *   that doesn't have JavaScript 1.2
 */
var screen_width;
var screen_height;
var detected;

if (v < 1.2) {
	screen_width = 800;
	screen_height = 600;
	detected = false;
} else {
	screen_width = screen.width;
	screen_height = screen.height;
	detected = true;
}

if (navigator.appName == "Netscape" && navigator.javaEnabled())
{
  	if (!detected){
      var toolkit = java.awt.Toolkit.getDefaultToolkit();
		var screen_size = toolkit.getScreenSize();
		screen_width = screen_size.width;
		screen_height = screen_size.height;
	}
}

function launchChat(theDataString)
{	
   var url = '';

   url = '/Chat/servlet/AppMain?' + theDataString;
   popChatWindow(url);
}

// never call this directly
function popChatWindow(url)
{
   initialX =	(screen_width - 800)/2;
	initialY = 	(screen_height - 600)/2;
   d = new Date();

   if (navigator.appName == "Netscape"){
      wispWindow = open(url,
                        'Chat_'+d.getTime(),
                        'width=800,height=600,' +
                        'screenX=' + initialX + ',screenY=' + initialY +
                        ',scrollbars,resizable');
      wispWindow.focus();		// make sure our new window is in front
   }else{
      wispWindow = open(url,
                        'Chat_'+d.getTime(),
                        'width=800,height=600' +
                        ',left=' + initialX + ',top=' + initialY +
                        ',scrollbars,resizable');
   }
}

function autotab(original,destination){
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
	    destination.focus()
}
