function change_flag(country_var_id, flag_url) {
   country_obj = document.getElementById(country_var_id) ;
   country_img_obj = document.getElementById("country_img") ;
   
   var country_short = country_obj.options[country_obj.selectedIndex].value ;
   var new_flag = "" ;
   if (country_short == 'Earth') {
      new_flag = flag_url + "glob.gif" ;	
   } else {	
      new_flag = flag_url + country_short.toLowerCase() + ".gif" ;
   }
   
   country_img_obj.src = new_flag ;
} // function change_flag()

function chat_start() {
   var XMLHttpRequestObject = false; 
      
   if (window.XMLHttpRequest) {
      XMLHttpRequestObject = new XMLHttpRequest();
   } else if (window.ActiveXObject) {
      XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
   }

   if (!XMLHttpRequestObject) {
      return ;	
   }
   
   XMLHttpRequestObject.onreadystatechange = function() { 
      if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
         respone_text = XMLHttpRequestObject.responseText;
      } 
   }
   
   XMLHttpRequestObject.open("GET", "session_chat.php");
   XMLHttpRequestObject.send(null);
}

function go_chat(member_id, group_id) {
   var  message1 = 'You are about to start Instant Messaging with the selected UBpedia member.' + "\n" ;
   message1 += 'Please act in a respectful manner.' + "\n\n" ;
   message1 += 'pressing "OK" will continue to the chat window' ; 
   
   if (confirm(message1) ) {
   	  document.cookie = "allowchat=1" ;   	  
      window.location = "http://www.ubpedia.com/chat.php?member_id=" + member_id + "&kgroup_id=" + group_id ;	
   }	
} // function go_chat(member_id, group_id) 

function test_re() {
   var text_line = "vv :-) bb " ;	
   var img_index = "smile" ;
   var symbol_index = /:-\)/g ;
   var replace_to = '<img src="images/' +  img_index + '_24.gif" border=0>'  ;
   var textline2 = text_line ;
   
   textline2 = textline2.replace(symbol_index, replace_to ) ;	
   alert(textline2) ;	
}