


function ShowImage(img) {
	window.open('/includes/ShowImg.asp?img='+img,'Img','width=1,height=1,scrollbars=1,top=30,left=30');
}


function ValidateReg(frm){

	if (trim(frm.Email.value,"") == "") {
		alert("Please enter your e-mail address.");
		frm.Email.focus();
		return false;
	}
		                
	if (!validateEmail(frm.Email.value))  {
		alert("Invalid e-mail address.");
		frm.Email.select();
		frm.Email.focus();
		return false;
	}


	if (trim(frm.FName.value,"") == "") {
		alert("Please enter your first name.");
		frm.FName.focus();
		return false;
	}

	if (trim(frm.LName.value,"") == "") {
		alert("Please enter your last name.");
		frm.LName.focus();
		return false;
	}

	if (frm.SpeID.selectedIndex < 1) {
		if (trim(frm.OtherSpe.value,"") == "") {		
			alert("Please select your specialty.");
			frm.SpeID.focus();
			return false;
		}
	}

	if (frm.ProfID[frm.ProfID.selectedIndex].value == '0') {
		if (trim(frm.OtherProf.value,"") == "") {
			alert("Please select your Profession.");
			frm.ProfID.focus();
			return false;
		}
	}
	
	
	return true;
}

function validateEmail(email) {
    if( /^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,4})$/.test(email) ) {
        return (true); // Valid
    } else {
        return(false); // Invalid
    }
}

function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}



