function validate()
{

var er=0;
var fc='';
document.getElementById('submit').value='Checking data';
document.getElementById('submit').disabled=true;
apply=document.getElementById('apply');

fna=document.getElementById('f_name1');
fn=document.getElementById('f_name');
lna=document.getElementById('l_name1');
ln=document.getElementById('l_name');
ema=document.getElementById('email1');
em=document.getElementById('email');
pha=document.getElementById('phone1');
ph=document.getElementById('phone');
aga=document.getElementById('age1');
ag=document.getElementById('age');
hea=document.getElementById('height1');
he=document.getElementById('height');
wea=document.getElementById('weight1');
we=document.getElementById('weight');
cocklea=document.getElementById('cock_length1');
cockle=document.getElementById('cock_length');
desworka=document.getElementById('des_work1');
daysa=document.getElementById('days1');
timesa=document.getElementById('times1');
citya=document.getElementById('city1');
city=document.getElementById('city');
piera=document.getElementById('piercings1');
waista=document.getElementById('waist1');
waist=document.getElementById('waist');
inseama=document.getElementById('inseam1');
inseam=document.getElementById('inseam');
shoea=document.getElementById('shoe1');
shoe=document.getElementById('shoe');
forea=document.getElementById('foreskin1');
sex=document.getElementById('sexually1');
pers=document.getElementById('personality1');


fn.style.border='solid 1px #123456';
fna.style.color='#000000';
ln.style.border='solid 1px #123456';
lna.style.color='#000000';
em.style.border='solid 1px #123456';
ema.style.color='#000000';
ph.style.border='solid 1px #123456';
pha.style.color='#000000';
ag.style.border='solid 1px #123456';
aga.style.color='#000000';
he.style.border='solid 1px #123456';
hea.style.color='#000000';
we.style.border='solid 1px #123456';
wea.style.color='#000000';
cockle.style.border='solid 1px #123456';
cocklea.style.color='#000000';
desworka.style.color='#000000';
daysa.style.color='#000000';
timesa.style.color='#000000';
city.style.border='solid 1px #123456';
citya.style.color='#000000';
piera.style.color='#000000';
waist.style.border='solid 1px #123456';
waista.style.color='#000000';
inseam.style.border='solid 1px #123456';
inseama.style.color='#000000';
shoe.style.border='solid 1px #123456';
shoea.style.color='#000000';
forea.style.color='#000000';
sex.style.color='#000000';
pers.style.color='#000000';



if(fn.value=='')
    {
    fn.style.border='solid 1px #ff0000';
    fna.style.color='#ff0000';
    er=1;
    fc=fn;
    }

if(ln.value=='')
    {
    ln.style.border='solid 1px #ff0000';
    lna.style.color='#ff0000';
    er=1;
    if(!fc) fc=ln;
    }

if(em.value=='')
    {
    em.style.border='solid 1px #ff0000';
    ema.style.color='#ff0000';
    er=1;
    if(!fc) fc=em;
    }

if(ph.value=='')
    {
    ph.style.border='solid 1px #ff0000';
    pha.style.color='#ff0000';
    er=1;
    if(!fc) fc=ph;
    }
    
if(ag.value=='')
    {
    ag.style.border='solid 1px #ff0000';
    aga.style.color='#ff0000';
    er=1;
    if(!fc) fc=ag;
    }

if(he.value=='')
    {
    he.style.border='solid 1px #ff0000';
    hea.style.color='#ff0000';
    er=1;
    if(!fc) fc=he;
    }

if(we.value=='')
    {
    we.style.border='solid 1px #ff0000';
    wea.style.color='#ff0000';
    er=1;
    if(!fc) fc=we;
    }

if(cockle.value=='')
    {
    cockle.style.border='solid 1px #ff0000';
    cocklea.style.color='#ff0000';
    er=1;
    if(!fc) fc=cockle;
    }

var ok=0;
//alert(apply.des_work[1].value);

for(i=0;i<apply.des_work.length;i++) if(apply.des_work[i].checked) ok=1;
if(!ok)
    {
    desworka.style.color='#ff0000';
    er=1;
    }

var ok=0;
//alert(apply.des_work[1].value);

for(i=0;i<apply.days.length;i++) if(apply.days[i].checked) ok=1;
if(!ok)
    {
    daysa.style.color='#ff0000';
    er=1;
    }

var ok=0;
//alert(apply.des_work[1].value);
for(i=0;i<apply.times.length;i++) if(apply.times[i].checked) ok=1;
if(!ok)
    {
    timesa.style.color='#ff0000';
    er=1;
    }

if(city.value=='')
    {
    city.style.border='solid 1px #ff0000';
    citya.style.color='#ff0000';
    er=1;
    if(!fc) fc=city;
    }


var ok=0;
//alert(apply.des_work[1].value);
for(i=0;i<apply.piercings.length;i++) if(apply.piercings[i].checked) ok=1;
if(!ok)
    {
    piera.style.color='#ff0000';
    er=1;
    }
    
if(waist.value=='')
    {
    waist.style.border='solid 1px #ff0000';
    waista.style.color='#ff0000';
    er=1;
    if(!fc) fc=waist;
    }

if(inseam.value=='')
    {
    inseam.style.border='solid 1px #ff0000';
    inseama.style.color='#ff0000';
    er=1;
    if(!fc) fc=inseam;
    }

if(shoe.value=='')
    {
    shoe.style.border='solid 1px #ff0000';
    shoea.style.color='#ff0000';
    er=1;
    if(!fc) fc=shoe;
    }

var ok=0;
//alert(apply.des_work[1].value);
for(i=0;i<apply.foreskin.length;i++) if(apply.foreskin[i].checked) ok=1;
if(!ok)
    {
    forea.style.color='#ff0000';
    er=1;
    }
    
var ok=0;
//alert(apply.des_work[1].value);
for(i=0;i<apply.sexually.length;i++) if(apply.sexually[i].checked) ok=1;
if(!ok)
    {
    sex.style.color='#ff0000';
    er=1;
    }
    
var ok=0;
//alert(apply.des_work[1].value);
for(i=0;i<apply.personality.length;i++) if(apply.personality[i].checked) ok=1;
if(!ok)
    {
    pers.style.color='#ff0000';
    er=1;
    }

document.getElementById('submit').value='Submit';
document.getElementById('submit').disabled=false;

if(er) { alert('Please check the fields marked in red.'); 
    if(fc) { fc.select(); fc.focus(); }
    return false;
	}

}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
