/*
 * ----------------------------------
 * SocketJS Functions
 * ----------------------------------
 * (c) 2006 by Manfred Weber
 * ----------------------------------
 */
/*
 * SocketOnInit()
 * Event Handler is called when Flash File is loaded
 */
 function SocketOnInit(){};
/*
 * SocketOnData()
 * Event Handler is called when received Data
 */
 function SocketOnData(data){
     document.getElementById("output").value += "\n"+data;
     document.getElementById("output").scrollTop = document.getElementById("output").scrollHeight;
 }
/*
 * SocketOnConnect(success);
 * Event Handler is called when socket is connected
 */
 function SocketOnConnect(success){
     if(success=="true"){
         document.getElementById("output").value += "\n Connection established";
         connect_user();
     } else{
         document.getElementById("output").value += "\n Connection failed";
     }
 }
/*
 * SocketOnClose
 * Event Handler is calles when socket is closed
 */
 function SocketOnClose(){
     document.getElementById("output").value += "\n Connection closed";
 }
/*
 * SocketClose()
 * Close the Socket
 */
 function SocketClose(){
     window.document.socket.TCallLabel("/", "close" );
 }
/*
 * SocketConnect(host,port)
 * Connect to socket. Notice that host must be the same where the .swf file resides!
 */
 function SocketConnect(host,port){
     nickname = document.getElementById("nickname").value;
     window.document.socket.SetVariable("host", host);
     window.document.socket.SetVariable("port", port);
     window.document.socket.TCallLabel("/", "connect" );
 }
/*
 * SocketSend(data)
 * Send data to open socket
 */
 function SocketSend(data){
     window.document.socket.SetVariable("data", data);
     window.document.socket.TCallLabel("/", "send" )
 }
//-----------------------------------------------

