// YoYo ToolTip yttPart2 (02-12-2005)
// by Vic Phillips yttPart1  http://www.vicsjavascripts.org.uk
// Global Customising Variables
var yttZIndex=4;          // the base Z-Index of the ToolTips
var yttSpeed=10;          // The speed of extension/retraction                    (minimum = 2 = fastest)
var yttIncrement=20;       // the height increment during the extension/retraction (minimum 1 )
var yttMouseOutDelay=5; // the delay before retracting the ToolTip              (minimum 1 )
//-->
// Functional Code - NO NEED to change
var yttLast,yttTO;
var yttCnt=0;

if (yttSpeed<2){ yttSpeed=2; }
if (yttIncrement<1){ yttIncrement=1; }
if (yttMouseOutDelay<1){ yttMouseOutDelay=1; }

function yttInitToolTip(){
 ytt=yttInitToolTip.arguments;
 for (ytt0=0;ytt0<ytt.length;ytt0++){
  yttmd=document.getElementById(ytt[ytt0][1]);
  yttmt=yttmd; yttma=yttmd;
  yttmapx=0; yttmapy=0;
  yttxos=ytt[ytt0][3]; yttyos=ytt[ytt0][4];
  if (typeof(ytt[ytt0][1])=='object'){
   yttmd=document.getElementById(ytt[ytt0][1][0]);
   yttmt=document.getElementById(ytt[ytt0][1][1]);
   yttma=yttmd;
   yttmapx=parseInt(yttmt.coords.split(',')[0]);
   yttmapy=parseInt(yttmt.coords.split(',')[1]);
  }
  if (typeof(ytt[ytt0][3])=='object'){
   yttma=document.getElementById(ytt[ytt0][3][0]);
   yttmapx=0; yttmapy=0;
   yttxos=ytt[ytt0][3][1];
  }
  yttmt.m=document.getElementById(ytt[ytt0][2]).cloneNode(true);
  document.getElementsByTagName('BODY')[0].appendChild(yttmt.m);
  yttdivs=yttmt.m.getElementsByTagName('DIV');
  if (yttdivs.length){
   if (yttdivs[0].className.indexOf('ytt')==0&&yttdivs[1].className.indexOf('ytt')==0){
    if (ytt[ytt0][5]){ yttOpacity(yttdivs[0],ytt[ytt0][5]); }
     yttmt.m.style.height=(yttdivs[1].offsetHeight)+'px';
     yttmt.m.style.width=(yttdivs[1].offsetWidth)+'px';
   }
  }
  yttmt.m.id='yttid'+(yttCnt++);
  if (ytt[ytt0][6]){
   // Customised Function
  }
  if (!ytt[ytt0][3]){ ytt[ytt0][3]=0; }
  if (!ytt[ytt0][4]){
   if (ytt[ytt0][0]=='H'){ ytt[ytt0][4]=yttmt.offsetWidth; }
   else { ytt[ytt0][4]=yttmt.offsetHeight; }
  }
  yttmt.m.style.zIndex=yttZIndex;
  yttmt.pos=[yttma,(yttmapx+yttxos),(yttmapy+yttyos)];
  yttmt.mobj=new yttAddFunctions(yttmt.m,ytt[ytt0][0]);
  yttAddOver(yttmt);
  yttAddOut(yttmt);
  yttAddOut(yttmt.m);
  yttAddClear(yttmt.m);
 }
}

function yttOver(){
 clearTimeout(yttTO);
 yttLastObj();
 clearTimeout(this.mobj.to);
 if (!this.mobj.down){
  this.mobj.down=true;
  this.m.style.left=(yttPos(this.pos[0])[0]+this.pos[1])+'px';
  this.m.style.top=(yttPos(this.pos[0])[1]+this.pos[2])+'px';
  this.m.style.visibility='visible';
  this.m.style.zIndex=yttZIndex+1;
  this.mobj.auto();
 }
 else {
  this.mobj.down=false;
  this.mobj.auto();
 }
 yttLast=this;
}

function yttLastObj(){
 if (yttLast){
  clearTimeout(yttLast.mobj.to);
  yttLast.m.style.zIndex=yttZIndex;
  yttLast.mobj.down=false;
  yttLast.mobj.auto();
 }
}

function yttOut(){
 yttTO=setTimeout('yttLastObj()',yttMouseOutDelay);
}

function yttClear(){
 clearTimeout(yttTO);
}

function yttAddFunctions(ytt,ytthv){
 this.close=0;
 this.hv=ytthv;
 this.mobj=ytt.style;
 this.ref=ytt.id;
 window[this.ref]=this;
 this.down=false;
 this.to=null;
 this.mobj.overflow='hidden';
 this.auto=yttAuto;
 this.setto=yttTimeOut;
 if (ytthv=='H'){ this.open=ytt.offsetWidth; this.mobj.width='0px'; }
 else { this.open=ytt.offsetHeight; this.mobj.height='0px'; }

}

function yttAuto(){
 this.tog=false;
 if(this.close<this.open&&this.down){
  this.close+=yttIncrement;
  if (this.close>this.open){this.close=this.open; }
  if (this.hv=='H'){ this.mobj.width=(this.close)+'px'; }
  else { this.mobj.height=(this.close)+'px'; }
  this.tog=true;
 }
 if(this.close>0&&!this.down){
  this.close-=yttIncrement;
  if (this.close<0){this.close=0; }
  this.mobj.zIndex=yttZIndex;
  if (this.hv=='H'){ this.mobj.width=(this.close)+'px'; }
  else { this.mobj.height=(this.close)+'px'; }
  if (this.close<=0){ this.mobj.visibility='hidden'; }
  this.tog=true;
 }
 if (this.tog){ this.setto('auto();',yttSpeed); }
}

function yttTimeOut(yttf,yttd){
 this.to=setTimeout('window.'+this.ref+'.'+yttf,yttd);
}


function yttPos(ytt){
 yttl=ytt.offsetLeft;
 yttt=ytt.offsetTop;
 while(ytt.offsetParent!=null){
  yttp=ytt.offsetParent;
  yttl+=yttp.offsetLeft;
  yttt+=yttp.offsetTop;
  ytt=yttp;
 }
 return [yttl,yttt];
}

function yttOpacity(ytt,yttop){
 if (ytt.style.MozOpacity!=null){ ytt.style.MozOpacity=(yttop/100)-.001; }
 else if (ytt.style.opacity!=null){ ytt.style.opacity=(yttop/100)-.001; }
 else if (ytt.style.filter!=null){ ytt.style.filter = 'alpha(opacity='+yttop+')';	}
 else if (obj.style.KHTMLOpacity!=null){ obj.style.KHTMLOpacity=(op/100)-.001; }
}

function yttEventAdd(ytto,yttt,yttf) {
 if ( ytto.addEventListener ){ ytto.addEventListener(yttt, function(e){ ytto[yttf](e);}, false); }
 else if ( ytto.attachEvent ){ ytto.attachEvent('on'+yttt,function(e){ ytto[yttf](e); }); }
 else {
  var yttPrev=ytto["on" + yttt];
  if (yttPrev){ ytto['on'+yttt]=function(e){ yttPrev(e); ytto[yttf](e); }; }
  else { ytto['on'+yttt]=ytto[yttf]; }
 }
}

function yttAddOver(ytt){
 if (ytt.addOver){ return; }
 ytt.addOver=yttOver;
 yttEventAdd(ytt,'mouseover','addOver');
}

function yttAddOut(ytt){
 if (ytt.addOut){ return; }
 ytt.addOut=yttOut;
 yttEventAdd(ytt,'mouseout','addOut');
}

function yttAddClear(ytt){
 if (ytt.addClear){ return; }
 ytt.addClear=yttClear;
 yttEventAdd(ytt,'mouseover','addClear');
}