<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0; var newX = 0; var newY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { 
	document.onmousemove = UpdateCursorPositionDocAll; 
}else{ 
	document.onmousemove = UpdateCursorPosition; 
}
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
	
newX = cX;
newY = cY;

AdjustX(d);
AdjustY(d);

}
function AdjustY(d) {

	var diffY = getHeight() - (newY - rY);
	
	if(diffY < (d.clientHeight+30)){
		newY -= 10;
		AdjustY(d);
	}
	//d.style.left = (newX+10) + "px";
	d.style.top = (newY+10) + "px";
	
}
function AdjustX(d) {
	
	var diffX = getWidth() - (newX - rX);
	
	if(diffX < (d.clientWidth+30)){
		newX -= 400;
		AdjustX(d);
	}
	d.style.left = (newX+10) + "px";
	//d.style.top = (newY+10) + "px";
	
}
function HC(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function SC(d) {
if(d.length < 1) { return; }
newX = 0; newY = 0;
var dd = document.getElementById(d);
dd.style.display = "block";
dd.style.zindex = "1000";
AssignPosition(dd);

}
/*function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}*/
function getWidth() {
  var myWidth = 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;
   //window.alert( 'Width = ' + myWidth );
   //window.alert( 'Height = ' + myHeight );
}
function getHeight() {
  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;
   //window.alert( 'Width = ' + myWidth );
   //window.alert( 'Height = ' + myHeight );
}

function showWidthHeight(id){
	
	if (document.layers){
        alert('width = ' + document.layers[id].document.width + ' height = ' + document.layers[id].document.height);
	}else if (document.all){
        alert('width = ' + document.all[id].clientWidth + ' height = ' +  document.all[id].clientHeight);
	}
}
