var port=42412;
function createChatControl(chatDivId){

try{
var chatDiv=document.getElementById(chatDivId);
if(chatDiv==null){
	chatDiv=document.createElement("div");
	chatDiv.id=chatDivId;
	document.body.appendChild(chatDiv);
	return;
}
var compId=getCookie('CompId');
	if(compId==null){
	signin();
	return;
   }
var userName=getCookie('UserId');   
 var htmlStr='<OBJECT ';
   htmlStr+='classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"';
   htmlStr+=' width="615" height="360" ';
   htmlStr+=' codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,mn">';
  htmlStr+='<PARAM name="code" value="client/LlamaChat.class">';
  htmlStr+='<PARAM name="archive" value="LlamaChat.jar">';
  htmlStr+='<PARAM name="type" value="application/x-java-applet;version=1.4">';
 htmlStr+=' <PARAM name="scriptable" value="true">';
  htmlStr+='<param name="username" value="'+userName+'">';
  htmlStr+='<param name="port" value="'+port+'">';
   htmlStr+='<param name="MAYSCRIPT" value="true">';
htmlStr+='<COMMENT>';
htmlStr+='<EMBED type="application/x-java-applet;version=1.4"'; 
 htmlStr+='  width="615" height="360" ';
 htmlStr+='  code="client/LlamaChat.class" archive="LlamaChat.jar"';
 htmlStr+='  pluginspage="http://java.sun.com/j2se/1.4.1/download.html"';
 htmlStr+='  MAYSCRIPT=true';
htmlStr+=' username="'+userName+'"';
htmlStr+=' port="'+port+'">';
htmlStr+=' 	<NOEMBED>';
htmlStr+='		No Java 1.4 plugin';
htmlStr+='	</NOEMBED></EMBED>';
htmlStr+='</COMMENT>';
htmlStr+='</OBJECT>' ;
   
   chatDiv.innerHTML=htmlStr;
  
    createChatFloatingPane(chatDiv.id,htmlStr);
   
}catch(e){}
}

function createChatFloatingPane(div,content){
try{ 
if(dojo.byId(div)==null) {
var embedDiv=document.createElement("div");
embedDiv.id=div;
document.body.appendChild(embedDiv);
}
dojo.byId(div).style.display = "block";
var fPane=dojo.widget.createWidget("FloatingPane", { 
        id:"chatPane",
        bgcolor:        "white",
        bgOpacity:      "0.5",
        toggleDuration: "250", 
        cacheContent: false, 
        hasShadow: true, 
                toggle: "fade", 
                displayMinimizeAction: true, 
                displayMaximizeAction: false, 
                displayCloseAction: true, 
                executeScripts: true, 
                scriptSeparation: false, 
                constrainToContainer: false 

        },dojo.byId(div));
        
		//fPane.domNode.style.top="30px";
		//fPane.domNode.style.left="30px";

  		fPane.domNode.style.width ="645px" ;
        fPane.domNode.style.height = "360px";       
 
 	var cPane= dojo.widget.createWidget("ContentPane", {  layoutAlign: "top" }) ; 
 
		//cPane.domNode.innerHTML=content;
  
   		fPane.addChild(cPane);
   		fPane.show();
		
  }catch(e){
  dojo.debug(e.message);
  }	
	
}