function CheckPage1()
{
flag =true
cusFName = document.getElementById('cus_fname')
f_name = document.getElementById('fName')
f1=f2=f3=f4=f5=f6=f7=f8=f9=f10=f11=f12=f13=f14=f15=f16=f17=f18=f19=f20=f21=f22=f23=f24=f25=true
if(cusFName.value == "")
	{
	 f_name.style.color = 'red'
	 f1 = false
	}
else
    f_name.style.color = '#006600'

cusLName = document.getElementById('cus_lname')
l_name = document.getElementById('lName')
if(cusLName.value == "")
	{
		l_name.style.color = 'red'
		f2 = false
	}
else
    l_name.style.color = '#006600'
	
//Check email
 var emailPattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
 email = document.getElementById("cus_email")
 
 cEmail = document.getElementById('customer_email')
 if(email.value != "")
 {
	if(!emailPattern.test(email.value))
	    {
		 cEmail.style.color = 'red'
		 f3 = false	
		}
	else
	    cEmail.style.color = '#006600'
 } // end if(myId.value != "")
 
 //date of birth
 optionY = document.getElementById('yeardob');
 optionM = document.getElementById('monthdob');
 optionD = document.getElementById('datedob')
 dob_row = document.getElementById('Date_of_birth');
 if(optionY.options[optionY.selectedIndex].value=='Year' || optionM.options[optionM.selectedIndex].value==0 || optionD.options[optionD.selectedIndex].value==0)
  {
	  dob_row.style.color='red'
      f4 = false
  }
  else
     dob_row.style.color = '#006600'
	 
//social security number
  ssnRow = document.getElementById('SSNRow')
  s1 = document.getElementById('ssn1');
  s2 = document.getElementById('ssn2');
  s3 = document.getElementById('ssn3');
  if(s1.value=="" || s2.value=="" || s3.value=="")
  {
	ssnRow.style.color = 'red'
	f5=false
  }
  else
    ssnRow.style.color = '#006600'

//Home Phone
 h_area = document.getElementById('homearea')
 h_num1 = document.getElementById('homenum1')
 h_num2 = document.getElementById('homenum2')
 homePhoneRow = document.getElementById('HomePhoneRow')
 
 if(h_area.value=="" || h_num1.value=="" || h_num2.value=="")
  {
	homePhoneRow.style.color = 'red'
	f6=false
  }
  else
    homePhoneRow.style.color = '#006600' 

//Maritial Status
  maritialRow = document.getElementById('MaritialRow')
  maritialOption = document.getElementById('maritial')
  if(maritialOption.options[maritialOption.selectedIndex].value=='Please Choose')
  {
	f7=false;
	maritialRow.style.color ='red'
  }
  else
    maritialRow.style.color = '#006600' 

//U.S resident status	
    USCitizenRow = document.getElementById('USStatus')
	usCitizenOption = document.getElementById('uscitizen')
	
 if(usCitizenOption.options[usCitizenOption.selectedIndex].value=='Please Choose')
  {
	f8=false;
	USCitizenRow.style.color ='red'
  }
  else
    USCitizenRow.style.color = '#006600' 

//Year in School
    f9 = CheckBlank('SchoolRow','yschool')
//Ethnicity
   f10 = CheckDropList('EthnicRow','ethnic','Please Choose')
//Race
   f11 = CheckDropList('RaceRow','race','Please Choose')
//Sex
   f12 = CheckDropList('SexRow','sex','Please Choose')
//NumDepend
   f13 = CheckBlank('NumDependRow','numdepend')
//Present address
   f14 = CheckBlank('AddressRow','paddress')
   f15 = CheckBlank('CityRow','pcity')
   f16 = CheckDropList('StateRow','pstate','State')
   f17 = CheckBlank('ZipRow','pzip')
   f18 = CheckDropList('OwnRentRow','ownorrent','Please Choose')
   f19 = CheckBlank('NoYearRow','pnoyear')
   
   OwnRentList = document.getElementById('ownorrent')
   if(OwnRentList.options[OwnRentList.selectedIndex].value=='Rent')
   {
	f20 = CheckBlank('MonthlyIncomeRow','rent_payment')   
	   
   }  // end if
   
   if(!f1 || !f2 || !f3 || !f4 || !f5 || !f6 || !f6 || !f7 || !f8 || !f9 || !f10 || !f11 || !f12 || !f13 || !f14||!f15 || !f16 || !f17 || !f18 || !f19 || !f20)
    {
		ErrorR = document.getElementById('ErrorRow')
        if(ErrorR.firstChild)
           ErrorR.removeChild(ErrorR.firstChild)
        txt = document.createTextNode("Please fix the follwing error(s)");
        ErrorR.appendChild(txt) 
		return false
	}
   else
       return true

}

function CheckBlank(checkedRow, checkedTxt)
{
  myRow = document.getElementById(checkedRow)
  myTxt = document.getElementById(checkedTxt)
  myFlag =true
  if(myTxt.value=="")
  {
	myRow.style.color = 'red'  
	myFlag = false
  }
  else
    myRow.style.color = '#006600' 
	
  return myFlag	
}

function CheckDropList(ListRow,ListId,option)
{
  myFlag = true
  myRow = document.getElementById(ListRow)
  myList = document.getElementById(ListId)
  if(myList.options[myList.selectedIndex].value==option)
  {
   myRow.style.color = 'red'
   myFlag = false
  }
  else
      myRow.style.color = '#006600'
   return myFlag  
}