/*
更新：2008-07-18
作者：老肥牛(Email:fatkenme@163.com，QQ:7017108)
使用范例：
注意：不可以显示跨站的图片，必须是显示本站的图片，有点遗憾
可以定义要预览的缩略图的宽度，看图片的宽度定义，样式定义中的宽度不要比图片宽度大就可以了。
<style>
#dhtmltooltip {
	BORDER-RIGHT: black 1px solid; 
	PADDING-RIGHT: 2px; 
	BORDER-TOP: black 1px solid; 
	PADDING-LEFT: 2px; 
	Z-INDEX: 100; 
	VISIBILITY: hidden; 
	PADDING-BOTTOM: 2px; 
	BORDER-LEFT: black 1px solid; 
	WIDTH: 200px; 
	PADDING-TOP: 2px; 
	BORDER-BOTTOM: black 1px solid;
	POSITION: absolute; 
	BACKGROUND-COLOR: lightyellow
}
</style>	
<div id="dhtmltooltip" name="dhtmltooltip"></div>
<script src="js/kenme_disimg.js" type=text/javascript></script>
<a href="http://www.qq.com" target="_blank" onMouseOut="javascript:hideddrivetip();" onMouseOver="ddrivetip('<img src=\'./1.jpg\' border=0 width=200>','white',200)">进入QQ网站的链接地址</a>
*/
var offsetxpoint=-60; //Customize x offset of tooltip
var offsetypoint=20 ;//Customize y offset of tooltip
var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;
if (ie||ns6){
    var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
}

function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(thetext, thecolor, thewidth){
    if (ns6||ie){
        if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
        if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext;
        enabletip=true;
        return false;
    }
}

function positiontip(e){
  if (enabletip){
    var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
    var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
    var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;

    var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;

    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<tipobj.offsetWidth)
        //move the horizontal position of the menu to the left by it's width
        tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
    else if (curX<leftedge)
        tipobj.style.left="5px";
    else
        //position the horizontal position of the menu where the mouse is positioned
        tipobj.style.left=curX+offsetxpoint+"px";

    //same concept with the vertical position
    if (bottomedge<tipobj.offsetHeight)
        tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
    else
        tipobj.style.top=curY+offsetypoint+"px";
        tipobj.style.visibility="visible";
  }
}

function Marq(kind){ 
	switch(kind) {
	    case 1:
	    mq_notice.stop();
	    break;
	}
	switch(kind) {
	    case 2:
	    mq_notice.start();
	    break;
	} 
}

function hideddrivetip(){
    if (ns6||ie){
        enabletip=false;
        tipobj.style.visibility="hidden";
        tipobj.style.left="-1000px";
        tipobj.style.backgroundColor='';
        tipobj.style.width='';
    }
}
document.onmousemove=positiontip;




