
function getElement(psID)
{ 
   if(document.all) 
   { 
      return document.all[psID]; 
   } 
   else 
   { 
      return document.getElementById(psID); 
   } 
} 

	function UpdateChecks(iType, iValue)
	{
		if (iType=='all')
		{
			AllIsChecked(iValue);
		}
		else
		{
			BoxesUnCheck(iValue);
		}
	}

	function AllIsChecked(iValue)
	{
		var elem=eval("document.Search."+iValue)
		var x=eval("document.Search."+iValue+"0")

		var i=0;
		var iTotal=x.value;
			
		while (i <= iTotal)
		{
			var elem=eval("document.Search."+iValue+i)
				elem.checked=false;
			i=i+1;
		}

		var elem=eval("document.Search."+iValue+"1")
			elem.checked=true;
	}

	function BoxesUnCheck(iValue)
	{
		var elem=eval("document.Search."+iValue+"1")
			elem.checked=false;
	}
	
	function SetOverflowArea(padding)
	{
				var availHeight;
				var browser = navigator.appName;
				//if the browser is safari or firefox, the padding should be less
				if(browser == 'Netscape');
				{
					padding = padding - 15;
				}
				availHeight=screen.availHeight;
				availHeight = availHeight - padding;
				document.getElementById("overflowArea").style.height = availHeight + 'px';
	}
	
	var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none"
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display=""
}

/* Javascript tooltip*/
					var offsetxpoint=-60 //Customize x offset of tooltip
					var offsetypoint=20 //Customize y offset of tooltip
					var ie=document.all
					var ns6=document.getElementById && !document.all
					var enabletip=false
					if (ie||ns6)
					var tipobj=document.all? document.all['dhtmltooltip'] : document.getElementById? document.getElementById('dhtmltooltip') : ''

					function ietruebody()
					{
						return (document.compatMode && document.compatMode!='BackCompat')? document.documentElement : document.body
					}

					function ddrivetip(thetext, thecolor, thewidth)
					{
						if (ns6||ie)
						{
							if (typeof thewidth!='undefined') 
								tipobj.style.width=thewidth+'px'
							if (typeof thecolor!='undefined' && thecolor!='') 
								tipobj.style.backgroundColor=thecolor
							tipobj.innerHTML=thetext
							enabletip=true
							return false
						}
					}

					function positiontip(e)
					{
						if (enabletip)
						{
							var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
							var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
							
							//Find out how close the mouse is to the corner of the window
							var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
							var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

							var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

							//if the horizontal distance isn't enough to accomodate the width of the context menu
							if (rightedge<tipobj.offsetWidth)
							//move the horizontal position of the menu to the left by it's width
								tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+'px' : window.pageXOffset+e.clientX-tipobj.offsetWidth+'px'
							else if (curX<leftedge)
								tipobj.style.left='5px'
							else
								//position the horizontal position of the menu where the mouse is positioned
								tipobj.style.left=curX+offsetxpoint+'px'

							//same concept with the vertical position
							if (bottomedge<tipobj.offsetHeight)
								tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+'px' : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+'px'
							else
								tipobj.style.top=curY+offsetypoint+'px'
							tipobj.style.visibility='visible'
						}
					}

					function hideddrivetip()
					{
						if (ns6||ie)
						{
							enabletip=false
							tipobj.style.visibility='hidden'
							tipobj.style.left='-1000px'
							tipobj.style.backgroundColor=''
							tipobj.style.width=''
						}
					}

					document.onmousemove=positiontip
