	// The following code is used to support the small popups that
	// give the full description of an event when the user move the
	// mouse over it.

var NS4		=	(document.layers) ? 1 : 0;
var IE4		=	(document.all) ? 1 : 0;
var GEBI	=	(document.getElementById)?1:0;

function tmshow(name) {
	//x = currentX;
	y = currentY + 20;
	if(NS4) {
		//Position popup correctly
		var docWidth=document.width;   //width of current frame
		var docHeight=document.height;  //height of current frame
		var layerWidth=document.layers[name].clip.width;  //width of popup layer
		var layerHeight=document.layers[name].clip.height; //height of popup layer
		if((currentX+layerWidth)>=docWidth) {
			x=(currentX-layerWidth);
		} else {
			x=currentX;
		}

	/********************
	  if((currentY+layerHeight)>=docHeight)
	  {
		y=(currentY-layerHeight-20);
	  }
	  else {
		y=currentY+20;
	  }
	*********************/
		document.layers[name].xpos = parseInt ( x );
		document.layers[name].left = parseInt ( x );
		document.layers[name].ypos = parseInt ( y );
		document.layers[name].top = parseInt ( y );
		document.layers[name].visibility = "show";
	} else if (IE4) {
		if (document.all[name].style) {
			var docHeight=document.body.offsetHeight;
			var docWidth=document.body.offsetWidth;
			var layerWidth=document.all[name].offsetWidth;
			var layerHeight=document.all[name].offsetHeight;
			if((currentX+layerWidth)>docWidth) {
			  x=(currentX-layerWidth);
			} else {
			  x=currentX;
			}
			if((currentY+layerHeight)>=docHeight) {
			   y=(currentY-layerHeight-40);
			} else {
			  y=currentY+40;
			}

			document.all[name].style.left = parseInt ( x );
			document.all[name].style.top = parseInt ( y );
			document.all[name].style.visibility = "visible";
		}
	} else {
  var docHeight=document.body.offsetHeight;
  var docWidth=document.body.offsetWidth;
  if (document.getElementById(name)) {
	var layerWidth=document.getElementById(name).offsetWidth;
	var layerHeight=document.getElementById(name).offsetHeight;
	if((currentX-layerWidth-document.body.scrollLeft)>0) {
		x=(currentX-layerWidth);
	} else {
		x=currentX;
	}
	if((currentY-layerHeight-document.body.scrollTop)>0) {
		y=(currentY-layerHeight-20);
	} else {
		y=currentY+20;
	}

	document.getElementById(name).style.left = parseInt (x);
	document.getElementById(name).style.top = parseInt (y);
	document.getElementById(name).style.visibility = "visible";
  }
}

}// end function definition


function tmhide(name) {
	if(NS4) {
		document.layers[name].visibility = "hide";
	} else if (IE4) {
		if (document.all[name].style) {
			document.all[name].style.visibility = "hidden";
		} else if (document.getElementById(name)) {
			document.getElementById(name).style.visibility = "hidden";
		}
	} else {
		if (document.getElementById(name)) {
			document.getElementById(name).style.visibility = "hidden";
		}
	}
}

function unhide(name) {
	if(NS4) {
		document.layers[name].visibility = "visible";
	} else if (IE4) {
		document.all[name].style.visibility = "visible";
	} else {
		if (document.getElementById(name)) {
			document.getElementById(name).style.visibility = "visible";
		}
	}
}

function tmhide2(name) {
	if(NS4) {
		document.layers[name].display = "none";
	} else if (IE4) {
		if (document.all[name].style) {
			document.all[name].style.display = "none";
		} else if (document.getElementById(name)) {
			document.getElementById(name).style.display = "none";
		}
	} else {
		if (document.getElementById(name)) {
			document.getElementById(name).style.display = "none";
		}
	}
}

function unhide2(name) {
	if(NS4) {
		document.layers[name].display = "block";
	} else if (IE4) {
		document.all[name].style.display = "block";
	} else {
		if (document.getElementById(name)) {
			document.getElementById(name).style.display = "block";
		}
	}
}

currentX = currentY = 0;

function grabEl(e) {
	if( NS4 ) {
		currentX = e.pageX;
		currentY = e.pageY;
	} else if (IE4) {
		currentX = event.x + document.body.scrollLeft;
		currentY = event.y + document.body.scrollTop;
		//currentX = event.x;
		//currentY = event.y;
	} else {
		currentX = e.pageX;
		currentY = e.pageY;
	}
}

if (GEBI) {
	// document.addEventListener(Event.MOUSEDOWN | Event.MOUSEMOVE);
} else if(NS4) {
	// document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
}

document.onmousemove = grabEl;

/// End the dhtml mouse over functions

function submit_form() {
	document.forms[0].run_query.value = 0;
	document.forms[0].submit();
}

function open_window(url,width,height) {
	window.open(url,"wind",'toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=1,width='+ width +',height='+ height +',scrollbars=yes');
}

// open a popup window with basic params
function open_popup(url,width,height,target, scroll, resize)
{
window.open(url,target,'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable='+resize+',width='+ width +',height='+ height +',scrollbars='+scroll);
}


function open_assc_window() {
	window.open('assc_users.php',"wind",'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=630,height=425,scrollbars=no');
}

function open_ecom_window(url) {
	window.open(url,"ecom",'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width=770,height=500,scrollbars=yes');
}

function open_attachment(url, width, height, option) {
	window.open(url,"attachment",'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=' + option + ',width='+ width +',height='+ height +',scrollbars=' +  option);
}

function openChild(file,window) {
	childWindow = open(file, window,'toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=1,width=800,height=600,scrollbars=yes');
	if (childWindow.opener == null) childWindow.opener = self;
	childWindow.focus();
}

// confirm then redirect to input url
function conf_redir(url,msg) {
	if(confirm(msg)) {
		document.location = url;
		return true;
	}
}

function setfocus(element) {
	element.focus();
	element.select();
}

function pfriendly_links() {
	for(i = 0; i < document.links.length; i++) {
		document.links[i].href="javascript: alert('All links are disabled in printer friendly mode.')";
	}
}

// gets the title from the user
function get_title()
{
	if(IE4)
	{
		title = prompt('Please Enter a title for this document','');
		if(!title)
			title = '';
		printtitle.innerText = title;
		return true;
	}
	if(GEBI)
	{
		title = prompt('Please Enter a title for this document','');
		if(!title)
			title = '';
		document.getElementById("printtitle").innerHTML = title;
		return true;
	}
}

// Rollover effect for href
function flip(name, image) {
	document[name].src = image;
}

// Rollover effect for input buttons
function submit_flip(input, image) {
	input.src = image;
}


function toggleWithIcon(elementToToggle,icon, onSrc, offsrc) {
	Element.toggle(elementToToggle);
	if(Element.visible(elementToToggle)) {
		icon.src=offsrc;
	} else {
		icon.src=onSrc;
	}
	return false;
}




setTimeout("window.focus()", 500);