if( document.standardWrite ) document.write = document.standardWrite;
 
var iframeWidth = 385;
var tools_state = 0;
var _x;
var _y;
document.onmousemove = myMouseMove;
      
function getScroll() {
    if (document.body.scrollTop != undefined) {
	var ieBox = document.compatMode != "CSS1Compat";
	var cont = ieBox ? document.body : document.documentElement;
	return {x : cont.scrollLeft, y : cont.scrollTop};
    } else {
	return {x : window.pageXOffset, y : window.pageYOffset};
    }
}

function insertHintFrame() {
    document.write('<ifr' + 'ame id="' + 'hintFrame' + '" frameborder=0 scrolling=no style="position: absolute; display: none; width: ' + iframeWidth + 'px; height: 400px;" class="form-border hilight-col"></ifr' + 'ame>');
}

function insertKeyword(keyword,infopage) {
    document.write("<a id=keyword onClick='show_desc(0,\"" + infopage + "\");>" + keyword + "</a>");
}

function myMouseMove(e) {
    iscroll = getScroll();
    var isIE = document.all?true:false;
    if (!isIE) {
	_x = e.pageX;
	_y = e.pageY;
    }
    if (isIE) {
	if (iscroll.x) _x = window.event.x + iscroll.x;
	else _x = window.event.x;
      
	if (iscroll.y) _y = window.event.y + iscroll.y;
	else _y = window.event.y;
    }
    return true;
}
      
function show_desc(offset,hinturl) {
    if( hinturl != "" ) {
	if( _x < 700 - iframeWidth ) 
	    document.getElementById('hintFrame').style.left = _x + 5;
	else 
	    document.getElementById('hintFrame').style.left = _x + 5 - iframeWidth;
	
	document.getElementById('hintFrame').style.top = _y + 5;
	document.getElementById('hintFrame').src = hinturl;
	document.getElementById('hintFrame').style.display = "block";	
	update_desc(offset);
    }
}
      
function update_desc(offset) {
    if (document.getElementById('hintFrame').style.display != 'none') {
	document.getElementById('hintFrame').style.left = _x + 5 + offset;
	document.getElementById('hintFrame').style.top = _y + 5;
	setTimeout("update_desc(" + offset + ");",100);
    }
}
      
function ChangeIframeHeight(x) {
    // this is a hack, assumes first iframe is the target...
    //var 'hintFrame' = document.iframes[0];
    //'hintFrame'.style.height = x + 15;
    
    document.getElementById('hintFrame').style.height = x + 15;
}
      
function hide_desc () {
    document.getElementById('hintFrame').style.display = "none";
}

