// Validate form
function fnValidateConsultation(f){
	if ((f.email.value.length < 1) && (f.phone.value.length < 1)){
		alert('Please enter a valid e-mail or phone number to continue.');
		f.email.focus();
		return false;
	}
	if (f.email.value.length > 1) {
		if (!IsValidEmail(f.email.value)) {
			alert('Please enter a valid email address to continue.');
			f.email.focus();
			return false;
		}
	}	
	if (f.phone.value.length > 1) {
		if (f.phone.value.length < 10 || !isNumeric(f.phone.value)) {
			alert('Please enter a valid phone number to continue. Otherwise leave blank.');
			f.phone.focus();
			return false;
		}
	}
	/*
	if ((f.phone.value<10 || !isNumeric(f.phone.value)) && !IsValidEmail(f.email.value)){
		alert('Please enter a valid e-mail or phone number to continue.');
		f.email.focus();
		return false;
	}*/
	return true;
}
function isNumeric(val) {
	var ValidChars = "0123456789.-() ";
	for (i=0; i<val.length; i++) if (ValidChars.indexOf(val.charAt(i)) == -1) return false;
	return true;
}
function IsValidEmail(val) {
	var iLen = val.length;
	if 	((iLen < 6) || (val.indexOf('@') < 1) || ((val.charAt(iLen - 3) != '.') && (val.charAt(iLen - 4) != '.') && (val.charAt(iLen - 5) != '.')) ) return false;
	return true;
}

function getRadioOrCheckboxValue(f,strName){
	var colEl = f.elements;
	var arValue = [];
	for (var i=0; i<colEl.length; i++){
		el = colEl[i];
		if (el.name && (el.name == strName) && el.checked) arValue[arValue.length]=el.value;
	}
	return arValue.join(',');
}

// drop down menu
function dropdown(obj,stat) {
	idx=fDOM(obj);
	idx.style.visibility=(stat) ? "visible" : "hidden";
}
function fDOM(obj) {
	if (document.getElementById) return (document.getElementById(obj));
	else return (0);
}

