function openChatWindow(channel,lang){

  if (typeof(channel)=='undefined'){
    alert('Channel not defined!');
    return;
  }
    
  if (typeof(lang)=='undefined')
    var lang  = '';
    
  if (typeof(chatWindow)=='undefined')
    chatWindow  = false;
 
  var height  = 430;
  var width   = 600;
 
  var params  = "status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no"; 
 
  params += ",height=" + height + ",innerHeight=" + height;
  params += ",width=" + width + ",innerWidth=" + width;
  
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;
    params += ",left=" + xc + ",screenX=" + xc;
    params += ",top=" + yc + ",screenY=" + yc;
  }
 
  if (!chatWindow || (chatWindow && chatWindow.closed))
    chatWindow = window.open("http://chat.chronopay.com/browsertest.php?channel="+channel+"&lang="+lang,'chat_'+String(Math.round(Math.random()*10000)),params);
    
  chatWindow.focus();
  
}