function FormValidator(theForm){

var passed = true;
var color = 'FF0000';
var cells = new Array();
for(i=1;i<11;i++){
	cells[i] = document.getElementById('id'+(i));
	cells[i].style.color = '000000';
}
/*alert('kieli:'+theForm.q20[0].value+'\n'+theForm.q20[1].value+'\n'+theForm.q20[2].value+'\n'+theForm.q20[3].value+'\n'+theForm.q20.length+'\netunimi1: '+theForm.q0.value+'\nsukunimi1: '+theForm.q1.value+'\n työnnimi: '+theForm.q8.value+'\n vuosi: '+theForm.q11.value+'\nyksikkö: '+theForm.q12.value+'\nkoulutusohjelma: '+theForm.q13.value+'\nnimike: '+theForm.q15.value+'\nsanat: '+theForm.q16.value+'\ntiedosto: '+theForm.q18.value+'\nlupa: '+theForm.q22[0].value);
*/
  /*1. Tekijä*/
  if ((theForm.q0.value == "") || (theForm.q1.value == ""))
  {
    cells[1].style.color = color;
	passed = false;
  }
  /*Opinnäytetyön suomenkielinen nimi*/
  if (theForm.q8.value == "")
  {
	cells[2].style.color = color;
	passed = false;
  }
  /*Opinnäytetyön valmistumisvuosi*/
  if (theForm.q11.value == "")
  {
	cells[3].style.color = color;
	passed = false;
  }
  /*Yksikkö*/
  if (theForm.q12.value == "")
  {
	cells[4].style.color = color;
	passed = false;
  }
  /*Koulutusohjelma*/
  if (theForm.q13.value == "")
  {
	cells[5].style.color = color;
	passed = false;
  }
  /*Tutkintonimike*/
  if (theForm.q15.value == "")
  {
	cells[6].style.color = color;
	passed = false;
  }
  /*Asiasanat*/
  /*if (theForm.q16[0].value == "")
  {
  	cells[7].style.color = color;
	passed = false;
  }*/
  /*Tiedosto, vain .pdf*/
  if(theForm.q18.value.match('.pdf') != '.pdf'){
	cells[8].style.color = color;
	passed = false;
  }
  /*Tiedosto*/
  if (theForm.q18.value == "")
  {
	cells[8].style.color = color;
	passed = false;
  }
  /*Kieliversio*/
  if ((!theForm.q22[0].checked) && (!theForm.q22[1].checked))
  {
	cells[9].style.color = color;
	passed = false;
  }
  if(theForm.q20[0].checked){
  }else{
	  if(theForm.q20[1].checked){
	  }else{
		  if(theForm.q20[2].checked && (theForm.q20[3].value != '')){
		  }else{
		  cells[10].style.color = color;
		  passed = false;
		  }
	  }
  }
return passed;
}
