document.write("<style>");
document.write(".search{margin:200px,0px,0px,0px;padding:0px;background-color:#E1E9EF;width:98px;height:58px;border:1px solid #37546D;}");
document.write(".search .top{width:98px;height:12px;background:url(images/search1.gif) repeat-x;}");
document.write(".search .top .bg{background:url(images/search1.gif) repeat-x;}");
document.write(".search .top .bg .bar{float:left;width:83px; height:15px; cursor:move}");
document.write(".search .top .bg .close{float:left;width:15px;height:12px;background:url(images/search2.gif) no-repeat;}");
document.write(".search .top .bg .close .c1{background:url(images/search2.gif) no-repeat;}");
document.write("<br />");
document.write(".search .guanjianzi{width:92px;}");
document.write(".search .guanjianzi1{width:92px;font-size:12px;}");
document.write(".search .guanjianzi  #input1{border:1px solid #5A7D9C;margin:5px 5px 5px 6px;padding:0px;}");
document.write(".search .guanjianzi1  #input2{margin:5px 5px 5px 6px;padding:0px;");
document.write("	background:url(images/search3.gif) repeat;");
document.write("	width: 86px;");
document.write("	border: 1px solid #5A7D9C;");
document.write("}");
document.write("<br />");
document.write("</style>");
document.write("<div class=\"search\"  id=\"oImg\" style=\"position: absolute; z-index: 100; top: 0; left: 0; width: 98px; height: 58px;\">");
document.write("		<div class=\"top\">");
document.write("				<div class=\"bg\">");
document.write("                     <div class=\"bar\" onMouseDown=\"catchFlyBar()\" onMouseUp=\"releaseFlyBar()\"></div>");
document.write("						<div class=\"close\" onclick=\"javascript:oImg.style.visibility='hidden'\">");
document.write("								<div class=\"c1\">");
document.write("								</div>");
document.write("						</div>");
document.write("				</div>");
document.write("		</div>		");
document.write("		<div class=\"guanjianzi\"><input onchange=\"n = 0;\" size=11 name=string id=\"input1\" onkeydown=\"entersearch();\"/>");
document.write("		</div>");
document.write("		<div class=\"guanjianzi1\"><input id=\"input2\" type=\"button\" onclick=\"return findInPage(document.getElementById('input1').value);\" value=\"在本页搜索\" />");
document.write("		</div>		");
document.write("</div>");

function entersearch()
{
	if(event.keyCode==13)
	{
		findInPage(document.getElementById('input1').value);
	}
}



var n = 0;
function findInPage(str)
{
	var txt;
	var i;
	var found;

	if (str == "")
		return false;

	if (window.navigator.userAgent.indexOf("MSIE")>=1)
	{
		txt = window.document.body.createTextRange();

        for (i = 0; i <= n && (found = txt.findText(str)) != false; i++)
        {
            txt.moveStart("character", 1);

            txt.moveEnd("textedit");
        }

        if (found)
        {
            txt.moveStart("character", -1);

            txt.findText(str);

            txt.select();

            txt.scrollIntoView();

            n++;
        }
        else
        {
            if (n > 0)
            {
                n = 0;

                findInPage(str);
            }
            else
                alert(" 不好意思，在本页没找到。");
        }
	}
	else if (window.navigator.userAgent.indexOf("Firefox")>=1)
	{
		 if (!window.find(str))
            while (window.find(str, false, true))
                n++;
        else
            n++;

        if (n == 0)
            alert("不好意思，在本页没找到。");
	}	

	return false;
}




var floatImg = document.getElementById("oImg"); 
var delay = 15; //控制每次执行间隔的时间，做越大移动得越慢； 
var speed = 1; //控制每次执行移动的距离，值越大移动得越快； 
var flagX = 0; 
var flagY = 0; 



function toPixel(str1) { 
//该函数用于去掉数值后面的px，并将之转化为数字。 
var oldLen = str1.length; 
var newLen = oldLen - 2; 

str2 = str1.slice(0, newLen); 
str3 = parseInt(str2); 

return str3; 
} 

var aWidth = document.body.clientWidth;	
var aiWidth = floatImg.offsetWidth; 	
if (document.documentElement && document.documentElement.scrollTop) 
{ 
	aLeft = document.documentElement.scrollLeft; 
	aTop = document.documentElement.scrollTop; 
} 
else 
{ 
	aLeft = document.body.scrollLeft; 
	aTop = document.body.scrollTop; 
} 

floatImg.style.left = (aLeft+aWidth-aiWidth-8) + "px"; 

window.onresize = function()
{
	aWidth = document.body.clientWidth;	
	floatImg.style.left = (aLeft+aWidth-aiWidth) + "px"; 
}


var eHeight = 0;
function flowImg() 
{ 

var bWidth = document.body.clientWidth;		
var bHeight = document.body.clientHeight; 
var bLeft;
var bTop; 

if (document.documentElement && document.documentElement.scrollTop) 
{ 
	bLeft = document.documentElement.scrollLeft; 
	bTop = document.documentElement.scrollTop; 
} 
else 
{ 
	bLeft = document.body.scrollLeft; 
	bTop = document.body.scrollTop; 
} 



var iWidth = floatImg.offsetWidth; 
var iHeight = floatImg.offsetHeight; 
var iLeft = toPixel(floatImg.style.left); 
var iTop = toPixel(floatImg.style.top); 


//floatImg.style.left = (bLeft+bWidth-iWidth) + "px"; 
floatImg.style.top = (bTop + eHeight+10) + "px"; 



} 

var imgInterval = setInterval("flowImg()", delay); 
//sfloatImg.onmouseover = function() {clearInterval(imgInterval);} 
//floatImg.onmouseout = function() {imgInterval = setInterval("flowImg()", delay);} 


var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;


function catchFlyBar(e)
{
	clearInterval(imgInterval);
	bIsCatchFlyBar = true;
	var x=event.x+document.body.scrollLeft;
	var y=event.y+document.body.scrollTop;
	dragClickX=x-oImg.style.pixelLeft;
	dragClickY=y-oImg.style.pixelTop;	
	event.srcElement.setCapture();
	document.onmousemove = moveFlyBar;
}

function releaseFlyBar(e)
{
	bIsCatchFlyBar = false;
	event.srcElement.releaseCapture();
	document.onmousemove = null;
	imgInterval = setInterval("flowImg()", delay);
}

function moveFlyBar(e)
{
	if(bIsCatchFlyBar)
	{
		oImg.style.left = event.x+document.body.scrollLeft-dragClickX;
		oImg.style.top = event.y+document.body.scrollTop-dragClickY;
		eHeight = event.y;
	}
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function highlight(keyword)
{
	var elements = getElementsByClass('dgdrivers_td_left')
	for (var i = 0; i < elements.length; i++)
	{
		//alert(Elements[i].innerText);
		var pa = new RegExp("("+ keyword +")","g");	
		for (var j = 0; j < elements[i].childNodes.length; j++)
		{
			var node = elements[i].childNodes[j];
			if (node.nodeType != 3)
				node.innerHTML.replace(pa, "<span class=\"searchword\">" + keyword + "</span>");
		}
		//elements[i].innerHTML = elements[i].innerHTML.replace(pa, "<span class=\"searchword\">" + keyword + "</span>");
	}
}





