//<img src="img_01_s.jpg" onmouseover="nahlad_show('img_01_b.jpg','xxx','zzz','150','150');" onmouseout="nahlad_hide();"  class="photos" border="0">

var ua = navigator.userAgent.toLowerCase();
var div_w=0;
var div_h=0;

if (document.getElementById || document.all)
  document.write('<div id="img_nahlad" style="position:absolute;visibility:hidden;z-index:1;"></div>')

//----- get object by ID
function nahlad_get_object(){
  if (document.getElementById) return document.getElementById("img_nahlad")
}
//-----
function truebody(){
  return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
//-----
function nahlad_hide(){
  document.onmousemove='';
  nahlad_get_object().style.visibility="hidden";
}
//-----
function nahlad_show( thumbimg, imgtitle, imgscription, thw, thh){
  if(ua.indexOf('opera') == -1 && ua.indexOf('safari') == -1){
    divthw = parseInt(thw) + 2;
    var html_str = '<table border=0><tr><td nowrap>';
    html_str += '<div style="background-color: #0000FF; layer-background-color: #000000; border: 5pt none #000000; padding: 0pt; width:'+parseInt(divthw/2)+'px;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px solid #000000; background-image: url(../scms_library/scms_img_load.gif); background-repeat: no-repeat;">';
    //html_str += '<center><img src="rs.php?IMG='+thumbimg+'" border="0" width="'+thw/1+'" height="'+thh/1+'"></center>';
    html_str += '<center><img src="'+thumbimg+'" border="1" width="'+thw+'" height="'+thh+'"></center>';
    if((imgtitle+imgscription).length > 0){
      html_str += '<div style="padding:3px"><b>'+imgtitle+'</b><br><b>'+imgscription+'</b></div>';
    }
    html_str += '</div>';
    html_str += '</td></tr></table>';
    nahlad_get_object().innerHTML = html_str;
    nahlad_get_object().style.visibility="visible";
    div_w = parseInt(thw/1)+25;
    div_h = parseInt(thh/1)+60;
    document.onmousemove=followmouse;
  }
}
//-----
function followmouse(e){
   var docwidth  = document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
   var docheight = document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight);
   var scroll_left  = 0;
   var scroll_top   = 0;
   var pos_x        = 0;
   var pos_y        = 0;
   var offset       = 5;

  if(typeof e != "undefined"){
    //-------------------- frx
    scroll_left = 0;
    scroll_top  = 0;
    pos_x = e.pageX;
    pos_y = e.pageY;
    xcoord = offset+pos_x;
    ycoord = offset+pos_y-div_h;

  }else if (typeof window.event != "undefined"){
    //-------------------- exp
    scroll_left = truebody().scrollLeft;
    scroll_top  = truebody().scrollTop;
    pos_x = event.clientX;
    pos_y = event.clientY;
    xcoord = offset+scroll_left+pos_x;
    ycoord = -offset+scroll_top+pos_y-div_h;
  }


  if(xcoord+div_w > docwidth) xcoord = offset+scroll_left+pos_x-div_w;
  if(ycoord <0              ) ycoord = offset-scroll_top+pos_y;


  //document.title = "[" + pos_x + "]"+"[" + pos_y + "]"+ "[" + xcoord + "]"+"[" + ycoord + "]";
  //document.title = "[" + scrollLeft + "]"+"[" + scrollTop + "]";
  nahlad_get_object().style.top  = ycoord+"px";
  nahlad_get_object().style.left = xcoord+"px";

}



