 
var offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var myHeight=110;
var myWidth=400;

if (document.getElementById || document.all){
	document.write('<div id="MouseOverLayer" class="MouseOverLayer">');
	document.write('</div>');
}

function gettrailobj(){
    if (document.getElementById)
        return document.getElementById("MouseOverLayer").style;
    else if (document.all)
        return document.all.MouseOverLayer.style;
}

function gettrailobjnostyle(){
    if (document.getElementById)
        return document.getElementById("MouseOverLayer");
    else if (document.all)
        return document.all.MouseOverLayer;
}

function truebody(){
    return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function hideMouseLayer(){
    var myTemp;
	gettrailobj().visibility="hidden";
	document.onmousemove="";
	myTemp=(myWidth + 100);
	gettrailobj().left='-' + myTemp + 'px';

}

function followmouse(e){

	var xcoord=offsetfrommouse[0];
	var ycoord=offsetfrommouse[1];

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
    var myTemp;
    
	myTemp=(myWidth-20);
 
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < myTemp){
			xcoord = e.pageX - xcoord - myWidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (myHeight)){
			ycoord += e.pageY - Math.max(0,(myHeight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < myTemp){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - myWidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX;
		}
		if (docheight - event.clientY < (myHeight)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(myHeight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);
	if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj().left=xcoord+"px";
	gettrailobj().top=ycoord+"px";

}

function GetWidth() {
    var myWidth = 0;
    myWidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
    return myWidth;
} 

function GetHeight() {
    var  myHeight = 0;
    myHeight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);
    return myHeight;
}  


//Base function - Basic simple input/display
function showMouseLayerBase(sValue){
    var newHTML;
	document.onmousemove=followmouse;
    newHTML = '<div style="padding: 5px; background-color: #FFFFCC; border: 1px solid #888;">';
    newHTML += sValue;
    newHTML += '</div>'; 
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().visibility="visible";
	gettrailobj().width=myWidth + "px";
}





function GetScreenWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;    
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;    
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;   
  }
  
  return myWidth;
  
} 
function GetScreenHeight() {
  var  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
} 

function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;        
  } else if( document.body && (document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && (document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}
    
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	//Load AP username
	setUsername();
	loadUsername();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
} 

function selectLeftMenu(sLeftMenuID)
{
	var leftnav = document.getElementById(sLeftMenuID);
	if (leftnav!=null)
	leftnav.className = "selected";
}

function selectBarMenu(sBarMenuID)
{
	var barnav = document.getElementById(sBarMenuID);
	if (barnav!=null)
	barnav.className = "selected";
}

function selectTopMenu(sTopMenuID)
{
	var topnav = document.getElementById(sTopMenuID);
	if (topnav!=null)
	topnav.className = "selected";
}