function mr_echeck(str) {var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;var ldot=str.indexOf(dot);if (str.indexOf(at)==-1){return false;}if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false;}if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false;}if (str.indexOf(at,(lat+1))!=-1){return false;}if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false;}if (str.indexOf(dot,(lat+2))==-1){return false;}if (str.indexOf(" ")!=-1){return false;}return true;}
function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for (var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ') c=c.substring(1);if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length);}return "";}function checkForm908(myform){var fail=false;if (typeof _mri != 'undefined'){document.getElementById('contact_id908').value = readCookie('contact_id');document.getElementById('afft_908').value = readCookie('afft_');document.getElementById('ref_908').value = readCookie('ref_');document.getElementById('own_908').value = readCookie('own_');document.getElementById('sess_908').value = readCookie('sess_');}if (myform.firstname.value.length == '0'){myform.firstname.style.border = '1px solid red';fail = true;} else { myform.firstname.style.border = '1px solid gray';}if (!mr_echeck(myform.email.value)){myform.email.style.border = '1px solid red';fail=true;}else { myform.email.style.border = '1px solid gray';}if (fail){alert('Please fill out all the fields in red');return false;}return true;}

