//Copyright(C) 2010 EasyWay ( Hooshe Bartar Karmania ) Co.
//www.easyway.ir
var IE = document.all?true:false

var easytooltip=function(){

var timerout;
var arrowposition;
var resid;
return {

mousexy:function(e) {

if (document.getElementById(resid).style.visibility != 'visible') return;


var tempX = 0;
var tempY = 0;

  if (IE) { 
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  
    tempX = e.pageX
    tempY = e.pageY
  }  

  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  
  switch (arrowposition) {
  
  case 'bl': {  // bottom left
  
              document.getElementById(resid).style.left= tempX -50;
              document.getElementById(resid).style.top  =tempY - document.getElementById(resid).offsetHeight - 10  ;
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'visible';
             
              document.getElementById('arrowbottompic_tbl').style.textAlign='left' ; 
             // vertical-align: top; text-align: right
           break;
             }
  

    case 'br': {  //bottom right

              document.getElementById(resid).style.left= tempX - document.getElementById(resid).offsetWidth + 50;
              document.getElementById(resid).style.top  =tempY - document.getElementById(resid).offsetHeight -10 ;
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'visible';
             
             
             document.getElementById('arrowbottompic_tbl').style.textAlign='right';  
              
             // vertical-align: top; text-align: right
                   break;
             }
  
  
  
      case 'lt': {   // left top
  
              document.getElementById(resid).style.left= tempX + 10 ;
              document.getElementById(resid).style.top  =tempY  -50  ;
              
              document.getElementById('arrowleftpic').style.visibility= 'visible';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowleftpic_tbl').style.verticalAlign="top" ; 
             // vertical-align: top; text-align: right
              break;
             }
             
             
             
             
        case 'lb': {   // left top
  
              document.getElementById(resid).style.left= tempX + 10;
              document.getElementById(resid).style.top  =tempY - document.getElementById(resid).offsetHeight + 50 ;
              document.getElementById('arrowleftpic').style.visibility= 'visible';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowleftpic_tbl').style.verticalAlign="bottom" ; 
             // vertical-align: top; text-align: right
                break;
             }
             
          

         
           case 'tl': {  // top left
  
             document.getElementById(resid).style.left= tempX - 50;
              document.getElementById(resid).style.top  =tempY + 10  ;
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'visible';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowtoppic_tbl').style.textAlign="left" ; 
             // vertical-align: top; text-align: right
                break;
             }

   
             case 'tr': {  // top right
  
             document.getElementById(resid).style.left= tempX - document.getElementById(resid).offsetWidth + 50;
              document.getElementById(resid).style.top  =tempY + 10 ;
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'hidden';
              document.getElementById('arrowtoppic').style.visibility= 'visible';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowtoppic_tbl').style.textAlign="right" ; 
             // vertical-align: top; text-align: right
                break;
             }
             
             
             
               case 'rt': {   // right top
  
              document.getElementById(resid).style.left= tempX - document.getElementById(resid).offsetWidth - 10;
              document.getElementById(resid).style.top  =tempY  -50  ;
              
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'visible';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowrightpic_tbl').style.verticalAlign="top" ; 
             // vertical-align: top; text-align: right
                break;
             }
             
             
             
             case 'rb': {   // right bottom
  
              document.getElementById(resid).style.left= tempX - document.getElementById(resid).offsetWidth - 10;
              document.getElementById(resid).style.top  =tempY - document.getElementById(resid).offsetHeight + 50 ;
              document.getElementById('arrowleftpic').style.visibility= 'hidden';
              document.getElementById('arrowrightpic').style.visibility= 'visible';
              document.getElementById('arrowtoppic').style.visibility= 'hidden';
              document.getElementById('arrowbottompic').style.visibility= 'hidden';
             
              document.getElementById('arrowrightpic_tbl').style.verticalAlign="bottom" ; 
             // vertical-align: top; text-align: right
                break;
             }
             
             
  
  
  }
  
  
 // document.getElementById(resid).style.left= tempX -50;
  //document.getElementById(resid).style.top  =tempY - document.getElementById(resid).offsetHeight + 30 ;
    

 
},showtooltip:function(alpha,body,maxwidth,typeshow){

clearTimeout(timerout);
arrowposition=typeshow;
if (maxwidth==0) document.getElementById(resid + '_content').style.width='165px'; else document.getElementById(resid ).style.width=maxwidth + 'px';

 document.getElementById(resid + '_content').innerHTML=body;   
      document.getElementById(resid).style.filter='opacity: ' + alpha/100 + '; -ms-filter: alpha(opacity=' + alpha + '); filter: alpha(opacity=' + alpha +')'; 
      document.getElementById(resid).style.opacity=alpha/100;
      document.getElementById(resid).style.visibility= 'visible';
  },closetooltip:function(alpha){
   
  if (alpha<=10 ) {
  
  alpha=0;
   document.getElementById(resid).style.filter='opacity: ' + alpha/100 + '; -ms-filter: alpha(opacity=' + alpha + '); filter: alpha(opacity=' + alpha +')'; 
   document.getElementById(resid).style.opacity=alpha/100;
   document.getElementById(resid).style.visibility= 'hidden';
   document.getElementById(resid + '_content').style.width='165px'
   document.getElementById(resid).style.left= 200;
   document.getElementById(resid).style.top  =200;
   return;
   }
       
  document.getElementById(resid).style.filter='opacity: ' + alpha/100 + '; -ms-filter: alpha(opacity=' + alpha + '); filter: alpha(opacity=' + alpha +')'; 
  document.getElementById(resid).style.opacity=alpha/100;
  
  alpha-=5;
  timerout=  setTimeout('easytooltip.closetooltip(' + alpha +  ');',10); 
  
  },intialize:function(respath,res){
  
  resid=res;
  try{
         h=document.getElementById("easytooltip").id

     } catch (exception) {
     
     
        
var hh="<div align=\'center\' id=\'easytooltip\' style=\'visibility:hidden;position: absolute; left:127px; top:101px; width:410px; height:95px\' ><table border=\'0\' height=\'99\' cellspacing=\'0\' cellpadding=\'0\' style=\'width:100%;\'  ><tr><td height=\'31\' width=\'31\' align=\'right\' valign=\'bottom\' style=\'background-position:46px bottom  ;background-repeat:no-repeat;font-size: 8\' ><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/9.gif\' width=\'13\' height=\'13\'></td><td id=\'arrowtoppic_tbl\' height=\'31\'  background=\'" + respath + "easywebtools/easytooltip/images/8.gif\' style=\'width:100%;background-position:0px bottom  ;background-repeat:no-repeat;font-size: 8; text-align: right\' ><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/arrow_t.gif\' width=\'37\' height=\'31\' id=\'arrowtoppic\'></td><td height=\'31\' width=\'31\' style=\'font-size: 8\' align=\'left\' valign=\'bottom\'><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/7.gif\' width=\'13\' height=\'13\'></td></tr><tr><td  id=\'arrowleftpic_tbl\' height=\'37\' background=\'" + respath + "easywebtools/easytooltip/images/1.gif\' style=\'width:31px;background-repeat:repeat-y;background-position:  right ; font-family:Tahoma; font-size:11; color:#000080; direction:rtl; vertical-align: top;\'><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/arrow_l.gif\' width=\'31\' height=\'37\' id=\'arrowleftpic\'></td><td id=\'easytooltip_content\' height=\'37\' bgcolor=\'#C9EEFF\' style=\'width:100%;background-repeat:repeat-y; font-family:Tahoma; font-size:11; color:#000080; direction:rtl;vertical-align: top; text-align:right\'></td><td id=\'arrowrightpic_tbl\' height=\'37\' width=\'31\' background=\'" + respath + "easywebtools/easytooltip/images/6.gif\' style=\'background-repeat:repeat-y;background-position:left;vertical-align: top;\' ><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/arrow_r.gif\' width=\'31\' height=\'37\' id=\'arrowrightpic\'></td></tr><tr><td height=\'31\' width=\'31\' align=\'right\' valign=\'top\' style=\'background-position: 46px top  ;background-repeat:no-repeat; font-size:8\'><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/2.gif\' width=\'13\' height=\'13\'></td>	<td height=\'31\'  id=\'arrowbottompic_tbl\' valign=\'top\' background=\'" + respath + "easywebtools/easytooltip/images/4.gif\' style=\'width:100%;background-position: 0px top  ;background-repeat:no-repeat; font-size:8;text-align: left\'><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/arrow_d.gif\' width=\'37\' height=\'31\' id=\'arrowbottompic\'></td>			<td height=\'31\' width=\'31\' align=\'left\' valign=\'top\' style=\'font-size: 8\'><img border=\'0\' src=\'" + respath + "easywebtools/easytooltip/images/5.gif\' width=\'13\' height=\'13\'></td></tr>	</table></div>"
 
 tt = document.createElement('div');
         tt.setAttribute('id',"easywaymodulcontent");
         document.body.appendChild(tt);
         document.getElementById("easywaymodulcontent").innerHTML=hh;
    document.onmousemove=easytooltip.mousexy;
     }
  
  }

};
}();

