function validate_form()
{
var msg="";
var name=document.reg.name.value;
var email=document.reg.email.value;
var password=document.reg.pwd.value;
//var dob=document.reg.dob.value;
var gender=document.reg.gender.value;
var country=document.reg.country.value;
var city=document.reg.city.value;
var condition=document.reg.condition;
//var mobile=document.reg.mobile.value;
var captcha=document.reg.captcha.value;
var email1=checkemail(email,"Email Id seems to be incorrect");
if(name=="")
{
msg+="please enter the name\n"
}
if(email=="")
{
msg+="please enter the email\n"
}
/*if(email=="")
{
msg+="Enter Email Id \n";
}*/
else{
if(email1!="")
{
msg+=email1;
}
}
if(password=="")
{
msg+="please enter the password\n"
}
/*if(dob=="")
{
msg+="please specify the date of birth\n"
}*/
if(gender=="")
{
msg+="please specify the gender\n"
}
if(country=="")
{
msg+="please specify the country\n"
}
/*if(mobile=="")
{
msg+="please enter the mobile number\n"
}*/

if(city=="")
{
msg+="please specify the city\n"
}
if(condition.checked==false)
{
msg+="please accept the terms and conditions\n"
}
if(captcha=="")
{
msg+="please enter the three black symbols\n"
}
if(msg!="")
{
 alert(msg);
 return false;
}
return true;
}

function IsEmailValid(formObj)
{
var emailStr=formObj
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word+ ")*$")
var domainPat=new RegExp("^" + atom + "(\\." +atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null)
{
return "Email address seems incorrect (check@ and .'s).\n"
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid
if (user.match(userPat)==null)
{
// user is not valid
return "The username doesn't seem to be valid.\n"

}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null)
{
// this is an IP address
for (var i=1;i<=4;i++)
{
if (IPArray[i]>255)
{
return "Destination IP address appears to be invalid!\n"

}
}

}
var domainArray=domain.match(domainPat)
if (domainArray==null)
{
return "The domain name doesn't appear to be valid.\n"

}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3)
{
// the address must end in a two letter or three letter word.
return "The address must end in a three-letter domain, or two letter country.\n"

}
// Make sure there's a host name preceding the domain.
if (len<2)
{
var errStr="This address is missing a hostname!\n"
return errStr
}
// If we've gotten this far, everything looks great!
return "";
}

function checkemail(x,y)
{
if(x==0)
return y;
else
return IsEmailValid(x);
}


function open1(imgname,width,height)
{
mywin = window.open(imgname,"Kodai","position=absolute, left=150,top=20, width="+width+",height="+height+",resizable=no,scrollbars=no");
}



function validate()
{
var emailid=document.login.username.value;
var password=document.login.pass.value;
var email2=checkemail(emailid,"Email Id seems to be incorrect");
var msg="";
if(emailid=="")
{
msg+="please enter the emailid\n";
}
else{
if(email2!="")
{
msg+=email2;
}
}
if(password=="")
{
msg+="please enter the password\n"
}
if(msg!="")
{
alert(msg);
return false;
}
return true;
}











