function browserDetect() {	
	var version = navigator.appVersion.charAt(0);
	var platform = navigator.platform;
	var agent = navigator.userAgent;
	var aParts;
	var nickname = "";
	
	this.isMac = false;
	this.isWin = false;
	this.isIE = false;
	this.isNetscape = false;
	this.version = version;
	this.minVersion = 0;
	this.name = navigator.appName;
	this.isSupported = false;
	this.OS = "";
	this.width = 0;
	this.height = 0;

	if (platform == "MacPPC") {
		this.isMac = true;
		this.nickname = "Mac";
	}
	if (platform == "Win32")	{
		this.isWin = true;
		this.nickname = "Win";
	}

	switch (this.name)	{
		case "Netscape" :
			this.isNetscape = true;
			this.handCursor = "pointer";
			this.minVersion = 5;
			this.nickname += "NS";
			this.width = window.innerWidth-16;
			this.height = window.innerHeight;
			if (eval(version) >= this.minVersion)
				this.isSupported = true;
			break;
		case "Microsoft Internet Explorer" : 
			this.isIE = true;
			this.handCursor = "hand";
			this.nickname += "IE";
				this.minVersion = 4;
			if (eval(version) >= this.minVersion)
				this.isSupported = true;
			this.width = document.body.offsetWidth-20;
			this.height = document.body.offsetHeight;
			break;
	}
	aParts = agent.substr(agent.indexOf("(")+1,agent.indexOf(")")-agent.indexOf("(")-1).split(";");
	for (var i=0; i<aParts.length; i++) {
		if (aParts[i] == " Windows NT 5.1")
			this.OS = "Windows XP";
	} 
} //*** browserDetect

function setStyles(browserObj,tagString) {
	var tagArray;
	if (tagString != "")
		tagArray = tagString.split(",");
	else
		tagArray = new Array("DIV","SPAN","TABLE","TD","TR","SELECT","INPUT");
	if (browserObj.OS == "Windows XP")	{
		for (var i = 0; i < tagArray.length; i++) {
			setStyleByClass(tagArray[i],"BodyText","fontSize","9pt");
			setStyleByClass(tagArray[i],"BoldBodyText","fontSize","9pt");
			setStyleByClass(tagArray[i],"Title","fontSize","14pt");
			setStyleByClass(tagArray[i],"BigBold","fontSize","12pt");
			setStyleByClass(tagArray[i],"BoldEmphasis","fontSize","12pt");
		}
	}
}

function replace(originalString,searchText,replaceText) { 
	var strLength = originalString.length; 
	var txtLength = searchText.length; 
	if ((strLength == 0) || (txtLength == 0)) { 
		return originalString; 
	} 
	var i = originalString.indexOf(searchText); 
	if ((!i) && (searchText != originalString.substring(0,txtLength))) { 
		return originalString;
	} 
	if (i == -1) { 
		return originalString; 
	} 
	var newstr = originalString.substring(0,i) + replaceText; 
	if (i+txtLength < strLength) {
		newstr += replace(originalString.substring(i+txtLength,strLength),searchText,replaceText);
	} 
	return newstr;
} //*** function replace

function resizeThis(id, posLeft, posTop, widthOffset, heightOffset, brw) {
	var thisElement = document.getElementById(id);
	thisElement.style.position = "absolute";
	thisElement.style.left = posLeft;
	thisElement.style.top = posTop;

	if (widthOffset > 0)
		thisElement.style.width = brw.width - widthOffset;
	if (heightOffset > 0)
		thisElement.style.height = brw.height - heightOffset;
	thisElement.style.visibility = "visible";
}

function moveGIF(gifID, topPos, startPoint, endPoint) {
	var thisGIF = document.getElementById(gifID);
	var leftPos = startPoint;
	thisGIF.style.visibility = "visible";
	if (leftPos <= endPoint) {
		leftPos += 30;
		thisGIF.style.left = leftPos;
		thisGIF.style.top = topPos;
		setTimeout("moveGIF('" + gifID + "'," + topPos + "," + leftPos + "," + endPoint + ")",25);
	} else {
		return;
	}
}

function moveIMG(imgID, startTop, endTop, startLeft, endLeft, increment) {
	var thisIMG = document.getElementById(imgID);
	var topPos = startTop;
	var leftPos = startLeft;
	var moveMore = false;
	thisIMG.style.visibility = "visible";
	if (topPos <= endTop) {
		topPos += increment;
		moveMore = true;
	}
	if (leftPos <= endLeft) {
		leftPos += increment;
		moveMore = true;
	}
	if (moveMore) {
		thisIMG.style.top = topPos;
		thisIMG.style.left = leftPos;
		setTimeout("moveIMG('" + imgID + "'," + topPos + "," + endTop + "," + leftPos + "," + endLeft + "," + increment + ")",25);
	} else {
		return;
	}
}


function getCtrlValue(CTRL)
{
	if (CTRL == "")
		return;
	var thisCtrl = document.getElementById(CTRL);
	if (thisCtrl == null)
		thisCtrl = document.Query[CTRL];
	var CtlType = thisCtrl.type;
	var CtlVal = "";
	switch (CtlType)
	{		
		case "select-one" :
		case "select-multiple" :
			CtlVal = Trim(thisCtrl[thisCtrl.selectedIndex].value);
			break;
		default :
			CtlVal = Trim(thisCtrl.value);
			break;
	}
	return CtlVal;
}

function getInnerText(docObject) {
	return docObject.childNodes[0].nodeValue;
}

function setInnerText(docObject, text) {
	docObject.childNodes[0].nodeValue = text;
}

function Left(str, n) {
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n) {
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function startclock(timeElement,dateElement) {
	var thetime=new Date();
	var nhours=thetime.getHours();
	var nmins=thetime.getMinutes();
	var nsecn=thetime.getSeconds();
	var nday=thetime.getDay();
	var nmonth=thetime.getMonth();
	var ntoday=thetime.getDate();
	var nyear=thetime.getYear();
	var AorP=" ";
	var timeEl = document.getElementById(timeElement);
	var dateEl;
	var timePart;
	var datePart;
	
		
	if (nhours>=12)
	    AorP="PM";
	else
	    AorP="AM";
	
	if (nhours>=13)
	    nhours-=12;
	
	if (nhours==0)
	   nhours=12;
	
	if (nsecn<10)
	 nsecn="0"+nsecn;
	
	if (nmins<10)
	 nmins="0"+nmins;
	
	if (nday==0)
	  nday="Sunday";
	if (nday==1)
	  nday="Monday";
	if (nday==2)
	  nday="Tuesday";
	if (nday==3)
	  nday="Wednesday";
	if (nday==4)
	  nday="Thursday";
	if (nday==5)
	  nday="Friday";
	if (nday==6)
	  nday="Saturday";
	
	nmonth+=1;
	
	if (nyear<=99)
	  nyear= "19"+nyear;
	
	if ((nyear>99) && (nyear<2000))
	 nyear+=1900;
	
	timePart = nhours + ":" + nmins + ":" + nsecn +" " + AorP;
	datePart = nday + " " + nmonth + "/" + ntoday + "/" + nyear;
	
	if (isUndefined(dateElement)) {
		timeEl.innerHTML = timePart + " " + datePart;
	} else {
		dateEl = document.getElementById(dateElement);
		timeEl.innerHTML = timePart;
		dateEl.innerHTML = datePart;
	}
			
	setTimeout('startclock("' + timeElement + '","' + dateElement + '")',1000);
} 
function isUndefined(inTest) {
	var test = new String(inTest);
	return (test.toString() == "undefined");
}


