<!--
function parseControlList(textToParse) {
	var split;
	var control;
	var controls = new Array();
		
	split = textToParse.split(",");
	for (var i = 0; i < split.length; i++) {
		control = split[i];
		if (control.length > 0) {
			controls.push(document.getElementById(control));
		}
	}
	return controls;
}

function isEmpty(formElement) {
	if (formElement.type == "text" || formElement.type == "password") {
		return (formElement.value.length == 0);
	} else {
		return false;
	}
}

function trimWhiteSpace(varStr) {
	return varStr.replace(/\s/g,"");
}

function lTrim(varStr) {
	return varStr.replace(/^\s+/,"");
}

function rTrim(varStr) {
	return varStr.replace(/\s+$/,"");
}

function trim(varStr) {
	return varStr.replace(/^\s+|\s+$/g,"");
}

function getSelectValue(list){
	return list.options[list.selectedIndex].value;
}
				
function setSelectValue(list, value){
	var options = list.options;
			
	for (var i=0; i < options.length; i++){
		if (options[i].value == value){
			list.selectedIndex = i;
			return;
		}	
	}
}	

function isLeapYear(year) {
	return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));
}

function checkDate(cboDay, cboMonth) {
	var day = getSelectValue(cboDay);
	var	month = getSelectValue(cboMonth).substring(0, 2);
	var	year = getSelectValue(cboMonth).substring(2, 6);
	var leapYear = isLeapYear(year);
	
	if ((month == 2) && leapYear && (day > 29)) {
		alert("February " + year + " has 29 days.");
		return false;
	} else if ((month == 2) && !leapYear && (day > 28)) {
		alert("February " + year + " has 28 days.");
		return false;
	} else if ((month == 4) && (day > 30)) {
		alert("April " + year + " has 30 days.");
		return false;
	} else if ((month == 6) && (day > 30)) {
		alert("June " + year + " has 30 days.");
		return false;
	} else if ((month == 9) && (day > 30)) {
		alert("September " + year + " has 30 days.");
		return false;				
	} else if ((month == 11) && (day > 30)) {
		alert("November " + year + " has 30 days.");
		return false;
	}
	
	return true;
}

function myDate(date) {
	var monthnames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	return date.getDate() + " " + monthnames[date.getMonth()] + " " + date.getFullYear();
}

function openWindow(page, pagename, width, height, windowfeatures) {
	return openWindow(page, pagename, width, height, windowfeatures, true);
}

function openWindow(page, pagename, width, height, windowfeatures, sendFocus) {

	if (windowfeatures != "") {
		windowfeatures = "," + windowfeatures;
	}
	
	var left = screen.availWidth/2 - width/2;	
	var top = screen.availHeight/2 - height/2;
	
	pagename = pagename.toString().replace(/[\s-&.]/g, "");

	var w  = window.open('', pagename,"LEFT=" + left + ",TOP=" + top + ",HEIGHT=" + height + ",WIDTH=" + width + windowfeatures);
	
	try {
		if (windowfeatures.indexOf('maximized') != -1) {
			w.moveTo(0,0);
			if (document.all) {
				w.resizeTo(screen.availWidth,screen.availHeight);
			} else if (document.layers||document.getElementById) {
				if (w.outerHeight < screen.availHeight||w.outerWidth < screen.availWidth) {
					w.outerHeight = screen.availHeight;
					w.outerWidth = screen.availWidth;
				}					
			}		
		}
	} catch(e) {}
	
	w.location.href = page;
	
	var browser = browserSniff();
	
	if (browser != "NS" && browser != "OPR" && sendFocus) {
		eval("try {w.focus();} catch(e) {}");
	}
	
	return w;
}

function browserSniff() {
	if (document.layers) {
		return "NS";
	}
	if (document.all) {
		var agt = navigator.userAgent.toLowerCase();
		var is_opera = (agt.indexOf("opera") != -1);
		
		if(is_opera) {
			return "OPR";
		} else {
			return "IE";
		}
	}
	if (document.getElementById) {
		return "MOZ";
	}
	return "OTHER";
}

function format (n, d) {
	with (Math) {
		// Separate the sign from the number
		var sign  = (n < 0) ? "-" : "";
		var num  = abs(n);

		num = floor((n * pow(10,d + 1) + 5) / 10) / pow(10,d);
		var whole = floor(num).toString();
		var frac  = round((num - whole) * pow(10,d)).toString();
	}

	// Zero-fill decimal
	for ( ; frac.length < d ; ) frac = "0" + frac;

	// Put it all back together
	return sign + whole + "." + frac;
}

function Session_OnEnd() {
	if (typeof(Page_OnSessionEnd) == "function") {
		Page_OnSessionEnd();
	} else {
		window.location.href = applicationPath + "/Session-Expired.aspx";
	}
}

function resizeDebuggingControl() {
	var divControl = document.getElementById("divDebugging");
	var tblInner = document.getElementById("tblDebuggingInner");
	var aResizeDebuggingControl = document.getElementById("aResizeDebuggingControl");
	var txtShowDebuggingInfo = document.getElementById("txtShowDebuggingInfo");
	
	if (divControl != null) {
		var showDebuggingInfo = txtShowDebuggingInfo.value;
		
		if (showDebuggingInfo == "true") {
			// Shrink
			aResizeDebuggingControl.innerHTML = "Show";
			tblInner.style.display = "none";
			txtShowDebuggingInfo.value = "false";
		} else {
			// Expand
			aResizeDebuggingControl.innerHTML = "Hide";
			tblInner.style.display = "inline";
			txtShowDebuggingInfo.value = "true";
		}
	}
}

function divDebugging_onmouseover() {
	var divDebugging = document.getElementById("divDebugging");
	var ifrDebugging = document.getElementById("ifrDebugging");
	
	divDebugging.style.background = "black";
	
	ifrDebugging.style.display = "block";
	
	ifrDebugging.style.top = divDebugging.style.top;
	ifrDebugging.style.left = ifrDebugging.style.left;
	ifrDebugging.style.width = divDebugging.offsetWidth;
	ifrDebugging.style.height = divDebugging.offsetHeight;
}

function divDebugging_onmouseout() {
	var divDebugging = document.getElementById("divDebugging");
	var ifrDebugging = document.getElementById("ifrDebugging");
	
	divDebugging.style.background = "transparent";
	
	ifrDebugging.style.display = "none";
}

function nz(val, rtn) {
	return cnull(val, rtn);
}

function MT(val, rtn) {
	if (val.length == 0) {
		return rtn;	
	} else {
		return val;	
	}
}

function cnull(val, rtn){
	if (val == null  || val == 'null' || val == 'undefined' || typeof(val) == 'undefined')
		return rtn;	
	else
		return val;		
}

function getTargetElement(e) {
	var textNodeType = 3;
    var element = null;
    
    if (e.target) {
        element = (e.target.nodeType == textNodeType ? e.target.parentNode : e.target);
    } else {
        element = e.srcElement;
    }
    
    return element;
}

function functionName(evt) {
    var e = (evt ? evt : (window.event ? window.event : null));
    
    if (e != null) {
        var element = getTargetElement(e);
        if (element != null) {
            // process event here
        }
    }
}
//-->