function displayObj(elementId, showOrHide) {
	el = document.getElementById(elementId);
	if (showOrHide) el.style.display = '';
	else el.style.display = 'none';
}

function enableObj(elementId, doEnable) {
	el = document.getElementById(elementId);
	if (doEnable) el.disabled=false;
	else el.disabled=true;
}

function updateClassName(id, newClassName) { 
	document.getElementById(id).className = newClassName;
}

function Show(PageURL, Width, Height) { 
	if (Width==null)  { Width="600"; }
	if (Height==null) { Height="400"; }
	window.open(PageURL,"","resizable=1,HEIGHT="+Height+",WIDTH="+Width);
}

function popUp(URL,width,height) {
	if (!width) width = 500;  // default window size
	if (!height) height = 350;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left = 390,top = 312');");
}

function trim(str) { // trim white space before and after the string
	return str.replace(/^\s*/, '').replace(/\s*$/, ''); 
} 

function validateEmail(email) {
	var regInvalidEmail = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var regValidEmail = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	return !(regInvalidEmail.test(email) || !regValidEmail.test(email));
}

function validatePhone(phoneNo) { // check to see if phoneNo is a 10 digit phone number
	var regexInteger = /^\d+$/;				
	return !(!regexInteger.test(phoneNo) || phoneNo.length!=10 || phoneNo.substring(0,1)==0 || phoneNo.substring(0,1)==1 );	
}

function getSelectValById(selectId) {
	var select = document.getElementById(selectId);
	var selIndex = select.selectedIndex;
	var value = (selIndex == -1) ? '' : select.options[selIndex].value;
	return(value);
}
    
function getValById(id) {
	return document.getElementById(id).value;
}

function noEnter(evt) {
	evt = (evt) ? evt : event;
	var charCode = (evt.charcode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
	if (charCode==13 || charCode==3) return false;
	else return true;		
}