﻿// JScript File
//dofocus = 1;
var ASPID = 'ctl00_ContentPlaceHolder1_';
var CommReqField = new RequiredField();

CommReqField.Add(ASPID + 'tbxFirstname', 'text', 'Enter your first name to continue.');
CommReqField.Add(ASPID + 'tbxSurname', 'text', 'Enter your last name to continue.');
CommReqField.Add(ASPID + 'tbxEmailAdd', 'text', 'Enter your email address to continue.');
CommReqField.RegEx(ASPID + 'tbxEmailAdd', /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, '', 'Invalid email address');
//CommReqField.Add(ASPID + 'tbxAlt_EmailAdd', 'text', 'Enter your Alternate E-Mail address to continue.');
//CommReqField.RegEx(ASPID + 'tbxAlt_EmailAdd', /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, '', 'Invalid email address');
CommReqField.Add(ASPID + 'tbxPhoneNo', 'text', 'Enter your phone number to continue.');

function CheckCommon() {
    try {
        var Msg = CommReqField.Check();
        if (Msg[0]) {
            //document.getElementById('yourSelectBoxId').options[document.getElementById('yourSelectBoxId').selectedIndex].value
            var Cmb_Ass = document.getElementById(ASPID + 'whoassisted');
            if (Cmb_Ass.options[Cmb_Ass.selectedIndex].value == "-1") {
                alert('Select who assisted you');
                return false;
            }
            return true;
        }
        else {
            alert(Msg[1])
            return false;
        }
    }
    catch (e) {
        alert(e);
    }
}
