ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
var step = 1;
mozila = (!document.all && document.getElementById)? true:false;
var newwin = null;
var timerID;
function openWindow(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	newwin = window.open(url, windowname,'scrollbars=yes,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	if(newwin != null)
	    newwin.focus();
}

function openWindowNoScroll(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	newwin = window.open(url, windowname,'scrollbars=no,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	if(newwin != null)
	    newwin.focus();
}

function openWindowNoClose(width, height, url, windowname){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == 'Netscape' 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
		) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();	
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	x = (screenW - width)/2; y = (screenH - height)/2;
	var newwin2 = window.open(url, windowname,'scrollbars=yes,toolbar=no,width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',directories=no,status=yes,resizable=yes,menubar=no,location=no');
	newwin2.focus();
}
function flush()
{
	if (newwin != null && newwin.open) newwin.close();
}
var step = 1;


function changeImages(imgName, imgSource) {
	document.getElementById(imgName).src = eval(imgSource + '.src')
}

function showToolTip(whichTip, TipText, e, addLeft, addTop) {
    
	if(TipText == '')
		return false;
	
	//Size div based on tip text length and Position to cursor
	TipText = ' ' + TipText + ' ';
	
	//Set length as 6 pixels per lowercase character, 9 per uppercase
	var UppercaseRegExp = /[A-Z]/g;
	var NumMatches = TipText.match(UppercaseRegExp);
	if (NumMatches != null) {
		var NumUpperChars = NumMatches.length; 
	} else {
		var NumUpperChars = 0 
	}	
	
	var NumLowerChars = TipText.length - NumUpperChars;	
	var txtlth = (NumLowerChars * 6) + (NumUpperChars * 9);	
	
	var ns6=document.getElementById && !document.all
	var leftPos = (ns6)?e.pageX : e.clientX;
	var topPos = (ns6)?e.pageY : e.clientY;
	
	leftPos = leftPos + addLeft;
	topPos = topPos + addTop;
    
	dropmenuobj = document.getElementById(whichTip)

	//TipText = '<table cellpadding=0 cellspacing=0 border=0 style=border-collapse: collapse;border-width:1;><tr><td align=left style=border-width:0;><img src=images/arrow2.gif></td></tr><tr><td style=background-Color:#ffdab9;BORDER-RIGHT:gray 1px solid;PADDING-RIGHT:5px;BORDER-TOP:gray 1px solid;PADDING-LEFT:5px;VISIBILITY:hidden;PADDING-BOTTOM:5px;BORDER-LEFT:gray 1px solid;PADDING-TOP:5px;BORDER-BOTTOM:gray 1px solid;>' + TipText + '</td></tr></table>'
	//TipText = '<div style=position:relative;><img src=images/arrow2.gif></div><div background-Color:#ffdab9;padding:5px;border: gray 1px solid>' + TipText + '</div>'
	dropmenuobj.innerHTML = TipText;
	//dropmenuobj.style.width = txtlth;
	dropmenuobj.style.left = leftPos + 'px';
	dropmenuobj.style.top = topPos + 'px';
	
	if (timerID) {
		//clearTimeout(timerID);
	}
	
	//Show tip
	flip(whichTip,true);
	
	//Set code to automatically hide tip after a few seconds
	hideTipCode = 'flip(\'' + whichTip + '\',false ' + ')';	
	//timerID = window.setTimeout(hideTipCode,2500);
	
}

function flip(block, showhide) {
	//document.all(block).style.visibility = (showhide  ==  true) ? "visible" : "hidden"
	document.getElementById(block).style.visibility = (showhide  ==  true) ? "visible" : "hidden";
	
}
function trimSpaces(WhichField) {
	
	var BeginningWhiteSpaceRegExp = /^\s+/;
    var EndingWhiteSpaceRegExp = /\s+$/;
	var TestVal;
	
	//Determine if WhichField is an object(text box or dropdown) or plain text
	if (typeof(WhichField) == 'object') {
		TestVal = WhichField.value;
	} else {
		TestVal = WhichField;
	}

	//Replace any whitespace at beginning and end of string with nothing	
	TestVal = TestVal.replace(BeginningWhiteSpaceRegExp,'');
	TestVal = TestVal.replace(EndingWhiteSpaceRegExp,'');
	
	return(TestVal);
}




function Nothing()
{
    
}
