// Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
// 
//
//  Modified by Montitech 
//  for Click Show and Click Hide 
// April 2010

var cX = 0; var cY = 0; var rX = 0; var rY = 0;
var shownow=true;
var canhide=false;

function UpdateCursorPositionDocAll(e){ 
  if (!e) { e = window.event;  }
  if (e) { 
    if (e.pageX || e.pageY) { 
      cX= e.pageX;
      cY = e.pageY;
    } else if (e.clientX || e.clientY) { 
      cX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
      cY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    }
  }
}




if ( typeof window.addEventListener != "undefined" ) {
	document.addEventListener( "mousemove", UpdateCursorPositionDocAll, false );
} else if ( typeof window.attachEvent != "undefined" ) {
	document.attachEvent( "onmousemove", UpdateCursorPositionDocAll);
} else {
	if ( document.onmousemove != null ) {
		var oldOnmousemove = document.UpdateCursorPositionDocAll;
		document.onmousemove = function ( e ) {
			oldOnmousemove( e );
			UpdateCursorPositionDocAll(e);
		};
	} else {
		document.onmousemove = UpdateCursorPositionDocAll;
	}
}




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;
	}
	*/
	d.style.left = (cX-150) + "px";
	d.style.top = (cY+10) + "px";
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
	if(d.length < 1) {return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}

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 ShowcontentNow(d) {
	if ( shownow ) {
		shownow = false;
		ShowContent(d);
		return;
	} else {
		shownow = true;
		HideContent(d);
	}
}



