// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.

var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {

  if (IE) { // grab the x-y pos.s if browser is IE

    tempX = event.clientX
    tempY = event.clientY

  } else {  // grab the x-y pos.s if browser is NS

    tempX = e.pageX
    tempY = e.pageY

  }

  // catch possible negative values in NS4

  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}

  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY

  return true

}



function clientSize() {

	var myWidth = 0, myHeight = 0;
	var arr;

	if (typeof( window.innerWidth ) == 'number' ) {

		//Non-IE
		myWidth = window.innerWidth-20;
		myHeight = window.innerHeight;

	} else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;

	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;

	}
	arr = new Array(myWidth, myHeight);
	return arr;

}

var active = false;

function showmore(cid)
{

	if (document.getElementById('scats'+cid).style.visibility == 'hidden') {

		if (active != false) document.getElementById('scats'+active).style.visibility='hidden';

		var size = clientSize();

		if (IE)
		{

			tempY+=document.getElementsByTagName("html")[0].scrollTop;
			tempX+=document.getElementsByTagName("html")[0].scrollLeft;

		}

		//tempY+=5;

		size[1]+=document.getElementsByTagName("html")[0].scrollTop-30;
		size[0]+=document.getElementsByTagName("html")[0].scrollLeft-20;

		if (tempY+document.getElementById('scats'+cid).offsetHeight > size[1])
		{

			tempY = size[1]-document.getElementById('scats'+cid).offsetHeight-10;

		}

		if (tempX+document.getElementById('scats'+cid).offsetWidth > size[0])
		{

			tempX = size[0]-document.getElementById('scats'+cid).offsetWidth-0;

		}

		tempX -= document.getElementById('scats'+cid).offsetWidth;

		tempY += 3;
		tempX += 20;

		document.getElementById('scats'+cid).style.visibility='visible';
		document.getElementById('scats'+cid).style.top=tempY + 'px';
		document.getElementById('scats'+cid).style.left=tempX + 'px';

		active = cid;
		//document.getElementById('flashDiv').style.visibility='hidden';

	} else {

		killmore(false, true);

	}

	return true;

}

function killmore(e, ignoreElm)
{

	if (ignoreElm == true) {

		//document.getElementById('flashDiv').style.visibility='visible';
		document.getElementById('scats'+active).style.visibility='hidden';

	} else {

		if (IE) elmClassName = e.srcElement.className;
		else elmClassName = e.target.className;

		if (elmClassName != "dontHide" && active) {
			//document.getElementById('flashDiv').style.visibility='visible';
			document.getElementById('scats'+active).style.visibility='hidden';
		}

	}

	return true;

}