
// adapted from http://javascriptkit.com/javatutors/static3.shtml
function static_position () {

	//define universal reference to "staticbanner"
	var crossobj=document.all? document.all.toc : document.getElementById? document.getElementById("toc") : document.toc;

	//define universal dsoc left point
	var dsocleft=document.all? document.body.scrollLeft : pageXOffset

	//define universal dsoc top point
	var dsoctop=document.all? document.body.scrollTop : pageYOffset

	//define universal browser window width
	var window_width=document.all? document.body.clientWidth : window.innerWidth

	//if the user is using IE 4+ or NS6+
	if (document.all||document.getElementById){
//		crossobj.style.left=parseInt(dsocleft)+ parseInt(window_width)-135;
//		crossobj.style.top=dsoctop+5;

//		alert( parseInt(dsoctop) );
		crossobj.style.marginTop = parseInt(dsoctop);
	}
	//else if the user is using NS 4
	else if (document.layers){
//		crossobj.left= dsocleft+window_width-140;
//		crossobj.top=dsoctop+15;

		crossobj.style.marginTop = parseInt(dsoctop);
	}
}


// from www.scottandrew.com/printable/cbs-events_p.html
function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }
}


var N6 = (document.getElementById && !document.all) ? true : false;
if ( N6 ) {
	// NS6 doesn't seem to support the scroll event, so we'll do it this way
	setInterval("static_position()",200);
} else {
	addEvent( window, 'load', static_position, false );
	addEvent( window, 'scroll', static_position, false );
	addEvent( window, 'resize', static_position, false );
}

