function getHTTPObject() {
	var xhr = false;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				xhr = false;
			}
		}
	}
	return xhr;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function addResizeEvent(func) {
	var oldonresize = window.onresize;
	if (typeof window.onresize != 'function') {
		window.onresize = func;
	} else {
		window.onresize = function() {
			if (oldonresize) {
				oldonresize();
			}
			func();
		}
	}
}

function addFocusEvent	(func) {
	var oldonfocus = window.onfocus;
	if (typeof window.onfocus != 'function') {
		window.onfocus = func;
	} else {
		window.onfocus = function() {
			if (oldonfocus) {
				oldonfocus();
			}
			func();
		}
	}
}

function HTMLStack() {
	var a = [100];
	var i = 0;
	this.pushHTML = function(html) {
		i = i+1;
		a[i] = html;
	};
	this.popHTML = function() {
		rtnHTML = a[i];
		i = i-1;
		return rtnHTML;
	};
	this.peekHTML = function() {
		return a[i];
	};
}

function jsClickedCheckBoxLabel(formvar) {
	if (formvar.disabled == false) { 
		if (formvar.checked == true) { 
			formvar.checked = false ;
		} else { 
			formvar.checked = true ;
		}
		formvar.focus() ;
		if (formvar.onclick) {
			formvar.onclick() ;
		}
	}
}
function jsOpenHelpWindow(u, w) {

	intHeight = screen.height * .70;
	intWidth = screen.width * .60;
	intTop = 50;
	intLeft = 50;

	p = "height=" + intHeight + ",width=" + intWidth + ",left=" + intLeft + ",top=" + intTop + ",location=no,scrollbars=yes,menubar=no,toolbar=no,titlebar=yes,resizable=yes";
	
	NewWindow = this.open(u,w,p);	
	NewWindow.focus();
}
function jsOpenFormWindow(u) {

	intHeight = screen.height * .70;
	intWidth = screen.width * .60;
	intTop = 50;
	intLeft = 50;

	p = "height=" + intHeight + ",width=" + intWidth + ",left=" + intLeft + ",top=" + intTop + ",location=no,scrollbars=yes,menubar=no,toolbar=no,titlebar=yes,resizable=yes";
	
	NewWindow = this.open(u,'',p);	
	NewWindow.focus();
}
function jsOpenFeedbackWindow(u) {

	intHeight = 350;
	intWidth = 540;
	intTop = (screen.height - intHeight) / 2;
	intLeft = (screen.width - intWidth) / 2;

	p = "height=" + intHeight + ",width=" + intWidth + ",left=" + intLeft + ",top=" + intTop + ",location=no,scrollbars=no,menubar=no,toolbar=no,titlebar=yes,resizable=no";
	
	NewWindow = this.open(u,'',p);	
	NewWindow.focus();
}
function jsAskForOptions(strTitle, strPromptText, strOptionsTextList, strOptionsURLList, blnRefreshParent, intHeight, intWidth) {

	if (showModalDialog) {

		if (intHeight == 0) {intHeight = 180};
		if (intWidth == 0) {intWidth = 300};

		var sRtn

		sRtn = showModalDialog(pv_RootFQURL + "form_ask_and_execute.asp?title=" + escape(strTitle) + "&prompt=" + escape(strPromptText) + "&optionslist=" + escape(strOptionsTextList) + "&optionsurllist=" + escape(strOptionsURLList) + "&refresh=" + escape(blnRefreshParent),"","center=yes;dialogWidth=" + intWidth + "pt;dialogHeight=" + intHeight + "pt");

		if (sRtn != undefined) {
			if (sRtn != '') {
				var strReply = new String;
				var objHTTP = new ActiveXObject("microsoft.XMLHTTP");
				objHTTP.open('GET', sRtn, false);
				objHTTP.send();
				delete objHTTP;	
				if (blnRefreshParent == 1) {
					document.location.reload(); 
				}
			}
		}

		return ;		

	} else {

		alert("Internet Explorer 4.0 or later is required.");

	}

}
function jsGetDisplayedDate() {
thedate = new Date();
year = thedate.getYear();
month = thedate.getMonth();
day = thedate.getDay();
hr = thedate.getHours();
min = thedate.getMinutes();
sec = thedate.getSeconds();
dom = thedate.getDate();

t = "";

if (day==0) {
 t = t + "Sunday,";}
if (day==1) {
 t = t + "Monday,";}
if (day==2) {
 t = t + "Tuesday,";}
if (day==3) {
 t = t + "Wednesday,";}
if (day==4) {
 t = t + "Thursday,";}
if (day==5) {
 t = t + "Friday,";}
if (day==6) {
 t = t + "Saturday,";}

t = t + " ";

if (month==0) {
 t = t + "January";}
if (month==1) {
 t = t + "February";}
if (month==2) {
 t = t + "March";}
if (month==3) {
 t = t + "April";}
if (month==4) {
 t = t + "May";}
if (month==5) {
 t = t + "June";}
if (month==6) {
 t = t + "July";}
if (month==7) {
 t = t + "August";}
if (month==8) {
 t = t + "September";}
if (month==9) {
 t = t + "October";}
if (month==10) {
 t = t + "November";}
if (month==11) {
 t = t + "December";}

t = t + " ";
t = t + dom;
t = t + " ";
t = t + year;

return(t);
}
function PopupCalendarDHTML(elTarget) {
 if (showModalDialog) {
   var sRtn;
   sRtn = showModalDialog("calendar.asp?date=" + elTarget.value,"","center=yes;dialogWidth=160pt;dialogHeight=165pt");
   if (sRtn!="")
     elTarget.value = sRtn;
 } else
   alert("Internet Explorer 4.0 or later is required.")
}
// String Functions
function JS_ltrim(str)
{
  re=/^ +/;
  var newstr=str.replace(re, "");
  return(newstr);
}
function JS_rtrim(str)
{
  re=/ +$/;
  var newstr=str.replace(re, "");
  return(newstr);
}
function JS_trim(str)
{
  var newstr=js_ltrim(str);
  return(js_rtrim(newstr));
}
function JS_IsNumeric(sText)
{
   var ValidChars = "0123456789.-";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}



/*
 * Date Format 1.2.2
 * (c) 2007-2008 Steven Levithan <stevenlevithan.com>
 * MIT license
 * Includes enhancements by Scott Trenda <scott.trenda.net> and Kris Kowal <cixar.com/~kris.kowal/>
 *
 * Into at http://blog.stevenlevithan.com/archives/date-time-format
 *
 * Accepts a date, a mask, or a date and a mask.
 * Returns a formatted version of the given date.
 * The date defaults to the current date/time.
 * The mask defaults to dateFormat.masks.default.
 */

var dateFormat = function () {

	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
		timezoneClip = /[^-+\dA-Z]/g,
		pad = function (val, len) {
			val = String(val);
			len = len || 2;
			while (val.length < len) val = "0" + val;
			return val;
		};

	// Regexes and supporting functions are cached through closure
	return function (date, mask, utc) {
		var dF = dateFormat;

		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
		if (arguments.length == 1 && (typeof date == "string" || date instanceof String) && !/\d/.test(date)) {
			mask = date;
			date = undefined;
		}

		// Passing date through Date applies Date.parse, if necessary
		date = date ? new Date(date) : new Date();
		if (isNaN(date)) throw new SyntaxError("invalid date");

		mask = String(dF.masks[mask] || mask || dF.masks["default"]);

		// Allow setting the utc argument via the mask
		if (mask.slice(0, 4) == "UTC:") {
			mask = mask.slice(4);
			utc = true;
		}

		var	_ = utc ? "getUTC" : "get",
			d = date[_ + "Date"](),
			D = date[_ + "Day"](),
			m = date[_ + "Month"](),
			y = date[_ + "FullYear"](),
			H = date[_ + "Hours"](),
			M = date[_ + "Minutes"](),
			s = date[_ + "Seconds"](),
			L = date[_ + "Milliseconds"](),
			o = utc ? 0 : date.getTimezoneOffset(),
			flags = {
				d:    d,
				dd:   pad(d),
				ddd:  dF.i18n.dayNames[D],
				dddd: dF.i18n.dayNames[D + 7],
				m:    m + 1,
				mm:   pad(m + 1),
				mmm:  dF.i18n.monthNames[m],
				mmmm: dF.i18n.monthNames[m + 12],
				yy:   String(y).slice(2),
				yyyy: y,
				h:    H % 12 || 12,
				hh:   pad(H % 12 || 12),
				H:    H,
				HH:   pad(H),
				M:    M,
				MM:   pad(M),
				s:    s,
				ss:   pad(s),
				l:    pad(L, 3),
				L:    pad(L > 99 ? Math.round(L / 10) : L),
				t:    H < 12 ? "a"  : "p",
				tt:   H < 12 ? "am" : "pm",
				T:    H < 12 ? "A"  : "P",
				TT:   H < 12 ? "AM" : "PM",
				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
			};

		return mask.replace(token, function ($0) {
			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
		});
	};
}();

// Some common format strings
dateFormat.masks = {
	"default":      "ddd mmm dd yyyy HH:MM:ss",
	shortDate:      "m/d/yy",
	mediumDate:     "mmm d, yyyy",
	longDate:       "mmmm d, yyyy",
	fullDate:       "dddd, mmmm d, yyyy",
	shortTime:      "h:MM TT",
	mediumTime:     "h:MM:ss TT",
	longTime:       "h:MM:ss TT Z",
	isoDate:        "yyyy-mm-dd",
	isoTime:        "HH:MM:ss",
	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
	dayNames: [
		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
	],
	monthNames: [
		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
	return dateFormat(this, mask, utc);
};

// Timestamp, elapsed time functions

function timestamp_class(this_current_time, this_start_time, this_end_time, this_time_difference) { 
	this.this_current_time = this_current_time;
	this.this_start_time = this_start_time;
	this.this_end_time = this_end_time;
	this.this_time_difference = this_time_difference;
	this.GetCurrentTime = GetCurrentTime;
}

//Get current time from date timestamp

function GetCurrentTime() {
	var my_current_timestamp;
	my_current_timestamp = new Date();		//stamp current date & time
	return my_current_timestamp.getTime();
}

//Stamp current time as stop time, compute elapsed time difference and display in textbox
//function EndTiming() {
//	this.this_end_time = GetCurrentTime();		//stamp current time
//	this.this_time_difference = (this.this_end_time - this.this_start_time) / 1000;	//compute elapsed time
//	document.TimeDisplayForm.TimeDisplayBox.value = this.this_time_difference;	//set elapsed time in display box
//}

//-------------------------------------------------------------------
// isNull(value)
//   Returns true if value is null
//-------------------------------------------------------------------
function isNull(val){return(val==null);}

// Page Scope Variables

var igHS = new HTMLStack(); /* HTML Stack */

