function IsNumeric(num)
   {
   var numbers = "0123456789.";
   var strChar;
   var flag = true;
   for (i = 0; i < num.length && flag == true; i++)
      {
      strChar = num.charAt(i);
      if (numbers.indexOf(strChar) == -1)
         {
         flag = false;
         }
      }
   return flag;
   }

function married_checker()
{
// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.witco.married.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.witco.married[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please select Marital Status.")
document.witco.married.focus();
return (false);
}
return (true);
}

function male_checker()
{
// set var radio_choice to false
var male_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.witco.male.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.witco.male[counter].checked)
male_choice = true; 
}
if (!male_choice)
{
// If there were no selections made display an alert box 
alert("Please select male or female")
document.witco.male.focus();
return (false);
}
return (true);
}


function interview_checker()
{
// set var radio_choice to false
var interview_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.witco.interview.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.witco.interview[counter].checked)
interview_choice = true; 
}

if (!interview_choice)
{
// If there were no selections made display an alert box 
alert("Please select have you attended the interview earlier or not")
document.witco.interview.focus();
return (false);
}
return (true);
}

function emp_checker()
{
// set var radio_choice to false
var emp_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.witco.p_employee.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.witco.p_employee[counter].checked)
emp_choice = true; 
}

if (!emp_choice)
{
// If there were no selections made display an alert box 
alert("Please select the privous witco employer or not")
document.witco.p_employee.focus();
return (false);
}
return (true);
}


function reference_checker()
{
// set var radio_choice to false
var ref_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.witco.reference.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.witco.reference[counter].checked)
ref_choice = true; 
}

if (!ref_choice)
{
// If there were no selections made display an alert box 
alert("Please select the witco employee reference")
document.witco.reference.focus();
return (false);
}
return (true);
}

function radio_checker()
{
if (document.witco.p_employee[0].checked && document.witco.branch_period.value == "")
{
	alert("Please enter the Branch & Period of Experience in WITCO");
	document.witco.p_employee.focus();
}
}

function refer_checker()
{
	if (document.witco.reference[0].checked && document.witco.referencetext.value == "")
	{
		alert("Please enter the Reference Name & Branch");
		document.witco.reference.focus();
	}
	
}



function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   emailID.focus()
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   emailID.focus()
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
			emailID.focus()
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
			emailID.focus()
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
			emailID.focus()
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
			emailID.focus()
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
			emailID.focus()
		    return false
		 }

 		 return true					
	}

function emailvalidation(){
	var emailID=document.witco.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

