
egen.CrLf = String.fromCharCode(13) + String.fromCharCode(10);
egen.ud = 'undefined';

egen.buttonwithfocus = null;

function action_onblur(thiscontrol) {
	if (thiscontrol.tagName == "INPUT") {
		if ((thiscontrol.type == "submit")
		|| (thiscontrol.type == "button")) {
			egen.buttonwithfocus = null;
		}
	}
	window.status = '';
}

function action_onfocus(thiscontrol) {
	if (thiscontrol.tagName == "INPUT") {
		if (thiscontrol.type == "text") {
			thiscontrol.select();
		}
		if ((thiscontrol.type == "submit")
		|| (thiscontrol.type == "button")) {
			egen.buttonwithfocus = thiscontrol;
		}
	}
	if (thiscontrol.tagName == "TEXTAREA") {
		thiscontrol.select();
	}
}

egen.flipdate = function (datevalue) {
	datevalue.replace(/\s+$/g, "");
	if (/(\d+)[-\/](\d+)[-\/](\d+)/.test(datevalue)) {
		datevalue = datevalue.replace(/(\d+)[-\/](\d+)[-\/](\d+)/, "$2\/$1\/$3");
	}
	return datevalue;
}
//
//	Commonly used javascript routines
//
// used to toggle a element when the desc span 
// is clicked on HTML control
function DescClick(srcElement) {
	if (srcElement.checked == false && srcElement.type == "radio") 
		srcElement.checked = true;
	 else if (srcElement.checked == true && srcElement.type == "radio") 
	 // we just ignore this, but trap it
	;
	 else {
		srcElement.checked = !srcElement.checked;
	}
}


