/* 
Post 'Em Notes Header by flooble.com
This script is Copyright (c) 2003 Animus Pactum Consulting.
For more information, visit:
   http://www.flooble.com/scripts/postems.php
START of Post 'Em Notes Header code */

/* note: this style code ought to go into the page using this script
<style>
	.note { border: 1px solid #6688CC; font: 9px caption; font-weight: bold; background: #CCEEFF; text-decoration:none; color: #000077;}
	A.note { text-decoration: none; }
	.notebody { display:block; border: 1px solid #666666; color: #000000; background-color:lightyellow; position:absolute; z-index: +10; padding: 2px; left: 100px; font-size: 12px;}
	.notetitle { font-weight: bold; background: #F3F37C; color: #000000; border-bottom: 1px dashed #666666; padding: 1px; width: 100%; margin: 0px;  font-size: 13px;}
	.notehidden { display: none; }
	.notevisible { display: block; position:absolute; z-index: +10; left:0px;}
</style>

*/

var ie = (document.all) ? true : false;
var lastNote = '';


function getObj(id) {
	if (document.all) { ie = true; }
	if (ie) {
		return document.all[id];
	} else {
		return document.getElementById(id);
	}
}

//var DHTML = ( document.getElementById || document.all || document.layers);

//(document.layers) ? window.captureEvents(Event.MOUSEMOVE):0;
//(document.layers) ? window.onMouseMove = Mouse : document.onmousemove = Mouse;

function pointstr( id, x, y )
{
	var str;
	str = id+"("+x+","+y+") ";
	return str;
}

/*  currently used for debugging which repositions a layer with mouse movement...
*/
function Mouse(evnt) {
	Ymouse=(document.layers)?evnt.pageY:event.y;
	Xmouse=(document.layers)?evnt.pageX:event.x;
	
	var thebody = getObj( 'designNotes' );
	thebody.style.left = Xmouse+document.documentElement.scrollLeft + document.body.scrollLeft + 10;
	thebody.style.top = Ymouse+document.documentElement.scrollTop + document.body.scrollTop;
}

function findPosX(obj)
{
	var curleft = 0;
	

	if (obj.offsetParent)
	{
		
		while (obj.offsetParent)
		{
        	
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{			
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function showNote( name, target, offsety ) {
	if (name == lastNote) {
		hideNote(name);
		return;
	}
	
	if (lastNote != '') { hideNote(lastNote); }

	var thebody = getObj( name );
	//title.className = 'notehidden';
	
    var tposx = findPosX( target );
	var tposy = findPosY( target );
    //xpos = (!ie) ?  tposx : tposx + document.documentElement.scrollLeft + document.body.scrollLeft;
	//ypos = (!ie) ? tposy : tposy + document.documentElement.scrollTop + document.body.scrollTop;

   	thebody.style.left = tposx;
    thebody.style.top = tposy + offsety;
	thebody.className = 'noteshown';
	lastNote = name;
	return false;
}

function hideNote(name) {

	var thebody = getObj(name);

	thebody.className = 'notehidden';
	lastNote = '';
}
