// ChatWin interface
// Carlos R. del Moral
// chatwin.js
// Thu Nov 9 09:45:45 WET 2006
// Update para compatibilidad IE : Sun Dec 24 12:18:59 WET 2006
// Para el motor de dating (sitios de contactos). Afilweb.com
//-
function checkwhere(e) {
if (document.layers){
xCoord = e.x;
yCoord = e.y;
}
else if (document.all){
xCoord = event.clientX;
yCoord = event.clientY;
}
else if (document.getElementById){
xCoord = e.clientX;
yCoord = e.clientY;
}
//X = xCoord;
X = window.innerWidth / 2;
Y = document.body.scrollTop;
//self.status = "X= "+ xCoord + " Y= " + yCoord;
}
document.onmousemove = checkwhere;
if(document.captureEvents) {document.captureEvents(Event.MOUSEMOVE);}
var nprivs=0;
function createChatWindow(profile)
{
create_chatwin(10,10,profile,nprivs);
privs[nprivs] = profile;
nprivs = nprivs + 1;
}
function create_chatlayout(profile)
{
var _profile = profile;
//alert( _profile );
var clayout = document.createElement('div');
//clayout.style.backgroundColor = '#ffffff';
clayout.style.background = 'url(backchat.gif)';
clayout.style.backgroundRepeat = 'no-repeat';
clayout.style.padding = '2px';
clayout.style.width = '250px';
// clayout.style.height= '300px';
clayout.innerHTML = "
| Chateando con "+profile+" |
"+
" |
"+
""+
" "+
" "+
" "+
" "+
" "+
" "+
" "+
" "+
" "+
" "+
" |
"+
" |
";
return clayout;
}
function destroy_chatwin(id,profile)
{
var el = document.getElementById(id);
el.setAttribute('id',null);
document.body.removeChild(el);
destroyed(profile);
}
function create_chatwin(X,Y,profile,nprivs)
{
//alert("0");
var layout = create_chatlayout(profile);
var chatwin = document.createElement('div');
var titlebar = document.createElement('div');
//alert("1");
titlebar.setAttribute('id','titlebar'+nprivs);
var a = document.createAttribute("name");
a.nodeValue = "chatwin"+nprivs;
titlebar.setAttributeNode(a);
titlebar.setAttribute('name','chatwin'+nprivs);
//alert("2");
titlebar.setAttribute('style','');
titlebar.style.height ='25px';
titlebar.style.width ='254px';
titlebar.style.backgroundImage = 'url( titlebar.png )';
titlebar.setAttribute('onmouseup','dragEnd(\'chatwin'+nprivs+'\')');
titlebar.setAttribute('onmousedown','dragStart(event,\'chatwin'+nprivs+'\')');
//alert ("5");
chatwin.setAttribute('id','chatwin'+nprivs);
chatwin.setAttribute('name',''+profile+'');
chatwin.setAttribute('style','top:5px;left:5px;');
chatwin.style.backgroundColor = '#ffffff';
//alert ("6");
//alert("6.1");
chatwin.style.top = ''+Y+'px';
chatwin.style.left = ''+X+'px';
//alert("6.1.1");
//alert ("7");
chatwin.style.position = 'absolute';
titlebar.style.backgroundImage = 'url( titlebar.png )';
titlebar.innerHTML =
"";
//alert ("8");
chatwin.appendChild(titlebar);
chatwin.appendChild(layout);
document.body.appendChild(chatwin);
//alert ("!");
//document.getElementById('chatwin'+nprivs).innerHTML = 'TEST
';
}
function test()
{
//alert("TEST");
}