function openChatWindow(cw,offsetX,offsetY,chatWidth,chatHeight,filename){
	if(cw){
		if(cw.closed){
			cw = 0;
			cw = openChatWindow(cw,offsetX,offsetY,chatWidth,chatHeight,filename);
		}else{
			cw.focus();
		}
	}else{
		if (is.ns){
			_top=window.screenY+offsetY;
			_left=window.screenX+offsetX;
		}
		else{
			_top=window.screenTop+offsetY;
			_left=window.screenLeft+offsetX;
		}
		var r = /[^ \f\n\r\t\v\.]+/
		var a = filename.match(r);
		a=a.toString();
		r = /\//g
		a = a.replace(r,'');
		//alert(filename+'\n'+a+'\n'+'toolbar=0,titlebar=0,scrollbars=0,width='+chatWidth+',height='+chatHeight+',top='+_top+',left='+_left);
  		cw = window.open(
			filename,
			a, 
			'toolbar=0,titlebar=0,scrollbars=0,width='+chatWidth+',height='+chatHeight+',top='+_top+',left='+_left);
    }
    return cw;
		//if (!cw.focused) cw.focus();
}

function openChatWindow2(cw,offsetX,offsetY,chatWidth,chatHeight,filename){
	if(cw){
		if(cw.closed){
			cw = 0;
			cw = openChatWindow2(cw,offsetX,offsetY,chatWidth,chatHeight,filename);
		}else{
			cw.focus();
		}
	}else{
		if (is.ns){
			_top=window.screenY+offsetY;
			_left=window.screenX+offsetX;
		}
		else{
			_top=window.screenTop+offsetY;
			_left=window.screenLeft+offsetX;
		}
		var r = /[^ \f\n\r\t\v\.]+/
  		var a = filename.match(r);
		cw = window.open(
			filename,
		    a, 
		    'toolbar=0,titlebar=0,scrollbars=1,width='+chatWidth+',height='+chatHeight+',top='+_top+',left='+_left);
    	}
    return cw;
		//if (!cw.focused) cw.focus();
}

function openChatWindow3(cw,offsetX,offsetY,chatWidth,chatHeight,filename){
	if(cw){
		if(cw.closed){
			cw = 0;
			cw = openChatWindow3(cw,offsetX,offsetY,chatWidth,chatHeight,filename);
		}else{
			cw.focus();
		}
	}else{
		if (is.ns){
			_top=window.screenY+offsetY;
			_left=window.screenX+offsetX;
		}
		else{
			_top=window.screenTop+offsetY;
			_left=window.screenLeft+offsetX;
		}
		var r = /[^ \f\n\r\t\v\.]+/
  		var a = filename.match(r);
		cw = window.open(
			filename,
		    a, 
		    'toolbar=0,titlebar=0,scrollbars=1,width='+chatWidth+',height='+chatHeight+',top='+_top+',left='+_left);
    	}
    return cw;
		//if (!cw.focused) cw.focus();
}
