var tool=null, skype_curid=0, skype_menu=null, skype_frame=null, skype_hintActive=false, skype_actObj=null, skype_overflag=false;
	function skype_checkStyle() {
	  var o = document.getElementById('skype_tb_style');
	  if(o == null)
		alert('DEBUG: we are not here!');
	  else
		alert('DEBUG: we are here! Path:\n' + o.href);
	}
	function skype_tb_init(t) {
	  tool=t;
	}
	function skype_tb_createFlag(params) {
	  var o = document.createElement('DIV');
	  o.setAttribute("id","skype_menu");
	  o.innerHTML="\u0054\u0068\u0065\u0020\u0064\u0069\u0061\u006c\u0069\u006e\u0067\u0020\u0070\u0072\u0065\u0066\u0069\u0078\u0020\u0066\u006f\u0072\u0020\u0074\u0068\u0069\u0073\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u0063\u0068\u0061\u006e\u0067\u0065\u0064";
	  return o;
	}
	function skype_tb_showFlagHint(obj,id) {
	  skype_tb_showHint(obj,id,'',skype_tb_createFlag,true);
	}
	function skype_tb_Drop(obj,id,params,bflex) {
	  if(tool) {
	    var x=0, y=0, z=0;
	    if(obj) {
	      var pos=skype_tb_calcSpanPos(obj,1,bflex); x=pos[0]; y=pos[1], z=pos[2];
	    }
	    tool.ShowDropdownMenu(document,id,x,y,z); 
	  }
	}
	function skype_tb_SwitchDrop(obj,id,params,bflex) {	//-- show/hide the menu depending on the current visibility state
	  try {
	    if(event)
	      event.cancelBubble=true;
	    skype_tb_Drop(obj,id,params,bflex);
	  } catch(e) {
	    window.status = e;
	  }
	}
	function skype_tb_stopEvents() {
	  if(event)
	    event.cancelBubble=true;
	  return false;
	}
	function skype_tb_showHint(obj,id,params,createHintFunc,showAbove) {
	  if(event)
	    event.cancelBubble=true;
	  skype_hintActive=true;
	//  if(skype_menu && skype_menu.style.visibility!="hidden" && skype_curid==id)
	//    return;
	  var brd=obj.getBoundingClientRect();
	  var pcx=brd.left-2, pcy=brd.top;
	  skype_curid=id;
	//-- hide any show currently hint
	  skype_tb_hideHint(true);
	  skype_hintActive=true;  
	//-- create tooltip's div
	  skype_menu = createHintFunc(params);
	  document.body.appendChild(skype_menu);
	  skype_menu.style.visibility="visible"; 
	//-- create underlying frame
	  skype_frame=document.createElement('IFRAME');
	  skype_frame.setAttribute("id","skype_frame");
	  skype_frame.src="about:blank";
	  skype_frame.frameBorder=0;
	  skype_frame.scrolling='no';
	  document.body.appendChild(skype_frame);
	//-- check IE version major number
	  var re = /MSIE (\d+).(\d+)/;
	  navigator.appVersion.search(re);
	  var navMajVer = RegExp.$1;
	//-- calc the position and show it
	  bNew=(navMajVer>=6 && document.compatMode!="BackCompat");
	  var docelem = (bNew) ? document.documentElement : document.body;
	  scrollY=docelem.scrollTop;
	  scrollX=docelem.scrollLeft;
	  var my=pcy+scrollY, mx=pcx+scrollX, mby=docelem.clientHeight+scrollY, mbx=docelem.clientWidth+scrollX;
	  if(my>mby) my=mby;
	  if(my<scrollY) my=scrollY;
	  if(mx>mbx) mx=mbx;
	  if(mx<scrollX) mx=scrollX;
	  skype_menu.style.left=mx;
	//-- show above or under
	  if(showAbove) {
	    skype_menu.style.top=my-obj.clientHeight-4;
	    var mbrd=skype_menu.getBoundingClientRect();
	    if(mbrd.bottom>pcy)
	      skype_menu.style.top=(my-obj.clientHeight-6)-(mbrd.bottom-pcy);
	  } else {
	    skype_menu.style.top=my-2+13; //+obj.clientHeight
	  }
	//-- pose the frame right under the tooltip
	  skype_frame.style.left=skype_menu.style.left;
	  skype_frame.style.top=skype_menu.style.top;
	  skype_frame.style.height=skype_menu.clientHeight+2;
	  skype_frame.style.width=skype_menu.clientWidth+2;
	  skype_frame.style.display="block";
	}
	function skype_tb_hideHintWait() {
	  if(!skype_menu)
	    return;
	  skype_hintActive=false;
	  setTimeout('skype_tb_hideHint(false);',1000);
	}
	function skype_tb_hideHint(force) {
	  if(!force && skype_hintActive)
	    return;
	  skype_hintActive=false;
	  if(skype_menu) {
	    document.body.removeChild(skype_menu);
	    skype_menu=null;
	  }
	  if(skype_frame) {
	    document.body.removeChild(skype_frame);
	    skype_frame=null;
	  }
	  tool.HideDropdownMenu();
	}
	function skype_tb_setBack(obj,color) {
	  if(obj && obj.tagName=='TR')
		obj.lastChild.style.backgroundColor = color;
	}
	function skype_tb_onDropOver(obj) {
	  skype_hintActive=true; 
	  skype_tb_setBack(obj,"#DFDFDF");
	}
	function skype_tb_onDropOut(obj) {
	  skype_tb_hideHintWait();
	  skype_tb_setBack(obj,"");
	}
	function doRunCMD(link,id,obj,lvl) {
	  var x=0, y=0, z=0;
	  if(obj) {
	    var pos=skype_tb_calcDropPos(obj,lvl); x=pos[0]; y=pos[1], z=pos[2];
	  }
	  window.location.href="/skype_tb/"+link+"/"+id+"/"+x+"/"+y+"/"+z;
	}
	function runCMD(link) {
	  skype_tb_hideHint(true);
	  doRunCMD(link,skype_curid,null);
	}
	function doHandleChdial(obj,edyn,id,lvl) {
	  if(event)
	    event.cancelBubble = true;
	//  if(edyn)
		doRunCMD('chdial',id,obj,lvl);
	//  else
	//	skype_tb_showFlagHint(obj,id);
	}
	function skype_tb_calcDropPos(obj,lvl) {
	  return skype_tb_calcObjPos(obj,lvl,'skype_tb_droppart',-1);
	}
	function skype_tb_calcSpanPos(obj,lvl,bflex) {
	  var backidx = (bflex) ? 1 : 0;
	  return skype_tb_calcObjPos(obj,lvl,'softomate_highlig',backidx); //-- depends on injection!
	}
	function skype_tb_calcObjPos(obj,lvl,prefix,idxback) {
	  if(!event)
	    return Array(0,0,0);
	  var objPos=event.srcElement;
	  var brd=objPos.getBoundingClientRect();
	  var cx=event.clientX-brd.left, cy=event.clientY-brd.top;
	  var sx=event.screenX-cx, sy=event.screenY-cy;
	  while(objPos.id.substr(0,17) != prefix) {
	    var brd1=objPos.getBoundingClientRect();
	    objPos=objPos.parentElement;
	    var brd2=objPos.getBoundingClientRect();
	    sx+=brd2.left-brd1.left;
	    sy+=brd2.top-brd1.top;
	  }
	  if(idxback >= 0) {
	    objPos=objPos.children[idxback];
	    var brd1=objPos.getBoundingClientRect();
	    objPos=objPos.parentElement;
	    var brd2=objPos.getBoundingClientRect();
	    sx-=brd2.left-brd1.left;
	  }
	  sy+=13; //-- in pixels, for modern only!
	  return Array(sx,sy,1);
	}
	function doSkypeFlag(obj,id,state,edyn) {
	  var fobj=obj.all['skype_tb_img_f'+id];
	  if(!fobj)
	    return;
	  switch(state) {
	    case 0: //-- inactive
	      fobj.className='skype_tb_imgFlag';	
	      obj.parentElement.all['skype_tb_img_r'+id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_r.modern.gif)';
	      skype_overflag=false;
	      break;
	    case 1: //-- active
	      fobj.className='skype_tb_imgFlagAct';
	      obj.parentElement.all['skype_tb_img_r'+id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_ra.modern.gif)';
	      obj.style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_a.modern.flex.gif)';
	      skype_overflag=true;
	      break;
	    case 2: //-- pushed
	//      if(edyn) {
	        obj.style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_a.modern.flex.gif)';
	        skype_overflag=true;
	//      }
	      break;
	  }
	}
	function skype_tb_getAct() {
	  return skype_actObj;
	}
	function skype_tb_imgOnOff(mobj,state,id,bflex,nof) {
	  skype_actObj = (state!=0) ? mobj : null;
	  if(mobj) {
	    var dobj=mobj.all['skype_tb_droppart_'+id];
		switch(state) {
	      case 0:	//-- inactive
		    if(dobj)
	          dobj.style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_a.modern.flex.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_a.modern.stat.gif)';
	        mobj.all['skype_tb_img_s'+id].style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_s'+nof+'.modern.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_s_stat'+nof+'.modern.gif)';
	        mobj.all['skype_tb_text' +id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_m.modern.gif)';
	        mobj.all['skype_tb_img_r'+id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\inactive_r.modern.gif)';
	        skype_overflag=false;
	        break;
	      case 1:  //-- active
		    if(dobj && (!skype_overflag || !bflex))
	          dobj.style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_a.modern.flex.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_a.modern.stat.gif)';
		    mobj.all['skype_tb_img_s'+id].style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_s'+nof+'.modern.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_s_stat'+nof+'.modern.gif)';
	        mobj.all['skype_tb_text' +id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_m.modern.gif)';
	        if(!skype_overflag)
	          mobj.all['skype_tb_img_r'+id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\active_r.modern.gif)';
	        break;
	      case 2:  //-- pushed
	        if(!skype_overflag) {
		      if(dobj)
	            dobj.style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_a.modern.flex.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_a.modern.stat.gif)';
	          mobj.all['skype_tb_img_s'+id].style.backgroundImage=(bflex)?'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_s'+nof+'.modern.gif)':'url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_s_stat'+nof+'.modern.gif)';
	          mobj.all['skype_tb_text' +id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_m.modern.gif)';
	          mobj.all['skype_tb_img_r'+id].style.backgroundImage='url(C:\WINDOWS\Temp\__SkypeIEToolbar_Cache\0b92529548c4c8ecb04b6738110bc7e0\static\pushed_r.modern.gif)';
	        }
	        break;
	    }
	  }
	  if(state != 1)
	    skype_tb_hideHintWait();
	}
	//-- call buttons manipulations
	function skype_tb_checkVis(obj) {
	  if(!obj || obj.parentElement==obj.document.body)
	    return true;
	  var brd=obj.getBoundingClientRect();
	  var brdPar=obj.parentElement.getBoundingClientRect();
	//alert('brd.top=' + brd.top + '; brdPar.bottom=' + brdPar.bottom + '; brdPar.right=' + brdPar.right + '; brd.right=' + brd.right);
	  var vis = (brd.top<brdPar.bottom) && (brdPar.right-brd.right>=-3);
	  return vis;
	}
	function skype_tb_checkVisFull(obj) {
	  if(!obj || obj.parentElement==obj.document.body)
	    return true;
	  var brd=obj.getBoundingClientRect();
	  var brdPar=obj.parentElement.getBoundingClientRect();
	  var vis = (brd.bottom<=brdPar.bottom);
	  return vis;
	}
	function skype_tb_swapSpansIfNeed(obj,cid) {
	  var tobj=obj.all['skype_tb_text'+cid],
	      robj=obj.all['skype_tb_img_r'+cid];
	  var tbrd=tobj.getBoundingClientRect(),
	      rbrd=robj.getBoundingClientRect();
	  var cst=obj.currentStyle.direction;
	  if(cst=="ltr" && tbrd.left<=rbrd.left)
	    return;
	//-- swap internal spans
	  var cl=obj.childNodes.length;
	  for(var i=0; i<cl/2; ++i) {
	    var cobj=obj.childNodes[i];
	    var swobj=obj.childNodes[cl-1-i];
	    cobj.swapNode(swobj);
	  }
	}
	function skype_tb_makeVisAll() {
	  var allspans=document.body.getElementsByTagName("SPAN");
	  for(var i=0;i<allspans.length;++i) {
	    var s0='',s1='',ss='';
	    var curspan=allspans[i];
	    if(!(curspan.scopeName=="SKYPE" && curspan.id.substr(0,20)=="softomate_highlight_"))
	      continue;
	    var cid=curspan.id.substring(20,curspan.id.length);
	    skype_tb_swapSpansIfNeed(curspan,cid);
	    if(skype_tb_checkVis(curspan))
	      continue;
	    var txtobj=curspan.all['skype_tb_innerText'+cid];
		ss=txtobj.innerText;
	    while(txtobj) {
	      s0=txtobj.innerText;
	      s1=s0.substr(0,s0.length/2) + '...';
	      txtobj.innerText=s1;
	      if(s0==s1 || skype_tb_checkVis(curspan))
	        break;
	    }
	  //-- return text back if still not visible and text is the shortest
		if(s0==s1 && !skype_tb_checkVis(curspan))
	      txtobj.innerText=ss;
	  //-- remove the injection fully if full visibility has not been reached
	    if(!skype_tb_checkVisFull(curspan)) {
	      var txt=curspan.context;
	      curspan.outerHTML=txt;
	    }
	  }
	}