required = new Array("LastName", "FirstName", "Gender", "DateofBirth", "PermanentAddress", "Phone", "email", "Citizenship", "CountryofBirth", "School", "City", "Country", "From_Date", "To_Date", "EnglishLang", "RusLang", "Country_to_recieve_VISA", "City_to_recieve_VISA"); 
required_show = new Array("Last Name", "First Name", "Gender", "Date of Birth", "Permanent address", "Phone", "E-mail", "Citizenship", "Country of Birth", "Secondary school", "City where you've been graduated from school", "Country where you've been graduated from school", "Duration of study at secondary school: From date", "Duration of study at secondary school: to date", "English language proficiency", "Russian language proficiency", "Country where you'dlike to receive visa", "City where you'd like to receive visa"); 

required2 = new Array("LangYes", "CSelHide", "TextOtherYes", "TextOtherSourceYes"); 
required_show2 = new Array("Language of Instruction", "Program (Course, Major) name", "Why TPU", "Admission information source"); 


function checkform () {

var i, j;

for(j=0; j<required.length; j++) {
    for (i=0; i<document.formm.length; i++) {
        if (document.formm.elements[i].name == required[j] && document.formm.elements[i].value == "" ) {
            alert('Please, fill in the "' + required_show[j] + '" area');
            document.formm.elements[i].focus();
            return false;
        }
    }
}

for(j=0; j<required2.length; j++) {
    for (i=0; i<document.formm.length; i++) {
        if (document.formm.elements[i].name == required2[j] && document.formm.elements[i].value == "" ) {
            alert('Please, fill in the "' + required_show2[j] + '" area');
            return false;
        }
    }
}

if (document.formm.email.value.indexOf('@', 0) == -1 || document.formm.email.value.indexOf('.', 0) == -1)
                                  {alert('Sorry, enter your e-mail'); document.formm.email.focus(); return false;}

return true;
}


