// *********************************************************************************
// Replace Text Area
// *********************************************************************************
 function ReplaceTextArea(theString)
{
	var strOut,i

	strOut = ""

	for (i=0; i < theString.length; i++)
	{		
		if (theString.charAt(i) == "\r") {
			strOut += "<br>"
		} else {
			strOut += theString.charAt(i)		
		}
 }
	return strOut
}

// *********************************************************************************
// Strip Characters
// *********************************************************************************
function StripChars(theFilter,theString)
{
	var strOut,i,curChar

	strOut = ""

	for (i=0; i < theString.length; i++) {		
		curChar = theString.charAt(i)
		if (theFilter.indexOf(curChar) < 0)
			strOut += curChar		
	}
	return strOut
}

// *********************************************************************************
// Open PDF Document
// *********************************************************************************
function OpenPDFDocument(theValue) {
	newwindowsplit = theValue.split(".")
	newwindow = StripChars("-_ /:", newwindowsplit[0])
	newHelpWindow = open(theValue,newwindow,"toolbar=yes,location=no,directories=no,copyhistory=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=720,height=540,left=50,top=50")
}

// *********************************************************************************
// Open PDF Document
// *********************************************************************************
function OpenNewSite(theValue) {
	newwindowsplit = theValue.split(".")
	newwindow = StripChars("-_ /:", newwindowsplit[0])
	newHelpWindow = open(theValue,newwindow,"toolbar=yes,location=yes,directories=no,copyhistory=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=720,height=540,left=50,top=50")
}

// *********************************************************************************
// Returns a formated Current Date
// *********************************************************************************

function GetDay(nDay) {
	var Days = new Array("Sunday","Monday","Tuesday","Wednesday",
  	                   "Thursday","Friday","Saturday");
	return Days[nDay]
}

function GetMonth(nMonth) {
	var Months = new Array("January","February","March","April","May","June",
  	                     "July","August","September","October","November","December");
	return Months[nMonth]    
}

function DateString() {
	var Today = new Date();
	var suffix = "th";
	
	switch (Today.getDate()) {
		case 1:
		case 21:
		case 31: 
			suffix = "st"
			break
		case 2:
		case 22:
			suffix = "nd"
			break
		case 3:
		case 23:
			suffix = "rd"
		break
	}

	var strDate = GetDay(Today.getDay()) + " " + GetMonth(Today.getMonth());
	if ((is_nav2) || (is_nav3) || (is_webtv )|| (is_opera3)) {
		strDate +=  " " + Today.getDate() + suffix + ", " + Today.getYear();
	} else {
		strDate +=  " " + Today.getDate() + suffix + ", " + Today.getFullYear();
	}
	
	return strDate
}

