// *********************************************************************************
// 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=720,left=50,top=50")
}

// *********************************************************************************
// Open Multiple PDF Documents
// *********************************************************************************
	function OpenPDFDocument_Multiple (thestring) {
		newstring = thestring.split(",")
		wleft=50
		wtop=50
		for ( var i = 0; i < newstring.length; i++ ){
			newwindow = StripChars("-_ /:", newstring[i])
			newHelpWindow = open(newstring[i] + ".pdf",newwindow,"toolbar=yes,location=no,directories=no,copyhistory=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=720,height=720,left="+wleft+",top="+wtop)
			wleft = wleft + 25
			wtop = wtop + 25
		}
	}

// *********************************************************************************
// Open New Site
// *********************************************************************************
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")
}

// *********************************************************************************
// Validate Email Address
// *********************************************************************************

function ValidateEMail(field) {
	var theString = StripChars(" /\[]=+'?<>{}|:;~`!#$%^&*(),",field)

  if ((theString.indexOf("@",0) < 0) || (theString.indexOf(".",0) < 0))
  {
		return false
  }
  return true
}

		function MakePretty(theValue) {
			var newValue = theValue
			while (newValue.indexOf("''") > 0) {
				newValue = theValue.replace("''","'")
			}
			
			while (newValue.indexOf("&quot;") > 0) {
				newValue = newValue.replace("&quot;","\"")
			}
			
		  return newValue
		}		
// *********************************************************************************
// 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
}

// *********************************************************************************
// Returns a formated Current Date
// *********************************************************************************

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("&") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
				aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}

function hidestatus() {
	window.status=""
	return true
}

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 setimage(theimage) {
	document.getElementById('image_'+theimage).src = window['img_'+theimage+'_over'].src
}
		
function resetimage(theimage) {
	document.getElementById('image_'+theimage).src = window['img_'+theimage].src
}

