function messanger(){
  var messanger_place;
  var text_place;
  var text_place_f;
  var text_place_c;
  var flash;
  var closex;
  var center;
  var closexx;
  var bodyx;
  
  this.setCloseOnClick=setCloseOnClick;
  this.setDimension=setDimension;
  this.init=init;
  this.show=show;
  this.setText=setText;
  this.close=close;
  this.setWidth=setWidth;
  this.addElementX=addElementX;
  
  function init(){
    messanger_place=document.getElementById('messanger_place');
    text_place=document.getElementById('text_place');
    text_place_f=document.getElementById('text_place_f');
    text_place_c=document.getElementById('text_place_c');
    flash=document.getElementById('flash');
    closexx=document.getElementById('close');
    closex=document.getElementById('closex');
    center=document.getElementById('center');
    closex.style.cursor='pointer';

    closex.onclick=function(){
      msngr.close();
    }
    window.msngr=this;
    window.onscroll=function(){
      //msngr.setDimension();
    }
   /* bodyxxxx=document.getElementById('bodyx');
    bodyxxxx.onclick=function(){
      msngr.show();
    }*/
  }
  
  function setWidth(width){
      
      text_place_c.style.width=width+69+"px";
      text_place_c.style.maxWidth=(width+47)+"px";
      /*
      closexx.style.width=width+42+"px";
      closexx.style.maxWidth=(width+22)+"px";
      */
      text_place_f.style.width=width+44+"px";
      text_place_f.style.maxWidth=(width+22)+"px";
      
      text_place.style.width=(width+22)+"px";
      text_place.style.maxWidth=width+"px";
  }
  
  function setCloseOnClick(close){
    if(close){
      text_place_f.onclick=function(){
        msngr.close();
        
      }
      text_place_f.style.cursor='pointer';
    }else{
      text_place_f.onclick=function(){
      text_place_f.style.cursor='default';  
      }
    }
  }
  
  function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
  return [ scrOfX, scrOfY ];
  }
  
  function setText(text){
    text_place.innerHTML=text;
  }
  
  function setDimension(){
    ps=getScrollXY();
    text_place_f.style.top=(ps[1]+20)+"px";
  }
  
  function show(){
    setDimension();
    /*if(flash)flash.style.display='none';*/
    showFlash(center,'none');
    messanger_place.style.display='block';
    
  }
  function showFlash(root,show) {
  if (!root) return;
    for (var i = 0; i < root.childNodes.length; i++) {
        var node = root.childNodes[i];
        if(node.nodeName=="EMBED"){
          node.style.display=show;    
        }else{
        showFlash(node,show);
        }
    }
  }
  function addElementX(el){
    text_place.appendChild(el);
  }
  function close(){
    setText("");
    showFlash(center,'block');
    messanger_place.style.display='none';
  }
}