// JavaScript Document



//mouse position tracking - Start

var cX = 0; var cY = 0; var rX = 0; var rY = 0;

/* if IE */
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
/* if not IE */
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}


if(document.all) 
/* if IE */
	{ document.onmousemove = UpdateCursorPositionDocAll; }
else 
/* if not IE */
	{ document.onmousemove = UpdateCursorPosition; }



function closeDescWindow(d){
	
		document.getElementById(d).style.display = "none"; 
		document.getElementById('backgroundBlock').style.display = "none"; 
}


function AssignPosition(d, objWidth, objHeight) {
	


var displayWidth, widthUsed, displayHeight, heightUsed, moveObjTo_X, moveObjTo_Y;


displayWidth = screen.availWidth - 150;
//displayHeight = screen.availHeight;
displayHeight = screen.availHeight;

//alert("objWidth = " + objWidth);
/*
var heightStr = "displayHeight = " + displayHeight + "\n" +
				"height = " + screen.height + "\n" +
				"outerHeight = " + window.outerHeight;
alert(heightStr);

*///alert("xcorrds = " + cX);

widthUsed = objWidth+displayWidth;
//alert("widthUsed = " + widthUsed);
heightUsed = objHeight+displayHeight;
//alert("heightUsed = " + heightUsed);

rightPointOfObj = objWidth + cX;
//alert("rightPointOfObj = " + rightPointOfObj);

//bottomOfObj = objHeight + cY;
bottomOfObj = objHeight + displayHeight;
//alert("bottomOfObj = " + bottomOfObj)


//alert("cX = " + cX +"rightPointOfObj = " + rightPointOfObj + "displayWidth = " + displayWidth);

//alert("objWidth = " + objWidth + " displayWidth = " + displayWidth + " widthUsed = " + widthUsed);
//alert("objWidth = " + objWidth + " displayWidth = " + displayWidth + " cX = " + cX + " rightPointOfObj = " + rightPointOfObj);


// this if positions the x axis
/*if (rightPointOfObj >= displayWidth){
		//alert("out of screen");
		
		moveObjTo_X = (rightPointOfObj - objWidth) - 150;
		
	//alert("objWidth = " + objWidth + " displayWidth = " + displayWidth + " cX = " + cX + " rightPointOfObj = " + rightPointOfObj + " moveObjTo = " + moveObjTo);
		
		cX = moveObjTo_X;
	}
*//*
var testingStr; objHeight
testingStr = "cX = " + cX + "\n" +
			 "cY = " + cY + "\n" +
			 "bottomOfObj = " + bottomOfObj + "\n" +
			 "rightPointOfObj = " + rightPointOfObj + "\n" +
			 "displayHeight = " + displayHeight + "\n" +
			 "displayWidth = " + displayWidth + "\n" +
			 "objWidth = " + objWidth + "\n" +
			 "objHeight = " + objHeight + "\n" +
			 " = ";
alert(testingStr);

*/


	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
/*
var offsetStr = " rX = " + rX + "\n" +
				" pageXOffset = " + pageXOffset + "\n" +
				"\n\n" +
				" rY = " + rY + "\n" +
				" pageYOffset = " + pageYOffset;
alert(offsetStr);

*/
	}else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
		//alert("document.documentElement && document.documentElement.scrollTop");
	}else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
		//alert("document.body");
	}
		
	if(document.all) {
		cX += rX; 
		cY += rY;
		//alert("document.all");
		rX = 0;
		rY = 0;
	}
	
// this if positions the y axis
/*	if (bottomOfObj >= displayHeight){
		//alert("out of screen HEIGHT");
		
		//position based on the page being scrolled or not
		var yPoint = 0;
		var BottomYPoint = 150;
		if(rY > 0){
			BottomYPoint = BottomYPoint - rY;
		}
		alert("yPoint = " + yPoint);
		alert("BottomYPoint = " + BottomYPoint);
		
		moveObjTo_Y = (bottomOfObj - objHeight) - BottomYPoint;
		//alert("moveObjTo_Y = " + moveObjTo_Y);
		
		cY = moveObjTo_Y;
	//alert("cY = " + cY + " in bottomOfObj >= displayHeight" );
	
	}

*/

//floating layer final placement
	d.style.left = (cX+0) + "px";
	d.style.top = (cY+0) + "px";
/*	
var finalPlacementStr;
finalPlacementStr = "cX + " + cX + "\n" +
					"cY = " + cY + "\n" +
					"rX = " + rX + "\n" +
					"rY = " + rY;
					
alert(finalPlacementStr);

*///alert("rY = " + rY);
//alert("cY = " + cY);
//alert((cY+10) + "px");

}

//mouse position tracking - End




function ReverseContentDisplay(d) {

//alert(dd);

	if(d.length < 1) { return; }
	
 	
	
	if(document.getElementById(d).style.display == "none") { 
		document.getElementById(d).style.display = "block"; 
		//document.getElementById('backgroundBlock').style.display = "block"; 
		
		
		//counter2++;
		//alert("document.getElementById(d).style.display 'if'  = " +document.getElementById(d).style.display );
	}
	else { 
		document.getElementById(d).style.display = "none"; 
		
		//alert("document.getElementById(d).style.display 'else'  = " +document.getElementById(d).style.display );
	}


	var dd = document.getElementById(d);
	var objWidth = document.getElementById(d).offsetWidth;
	var objHeight = document.getElementById(d).offsetHeight;
	
	AssignPosition(dd, objWidth, objHeight);



}

