function echeck(str)
{
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	//alert(str.indexOf(dot));
	//alert(lstr);
	if (str.indexOf(at)==-1)
	{
	   alert("Invalid E-mail ID");
	   return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
	   alert("Invalid E-mail ID");
	   return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==(lstr-1))
	{
		alert("Invalid E-mail ID");
		return false;
	}
	 if (str.indexOf(at,(lat+1))!=-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	 if (str.indexOf(dot,(lat+2))==-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	 if (str.indexOf(" ")!=-1 || str.indexOf("!")!=-1 || str.indexOf("?")!=-1 || str.indexOf("$")!=-1 || str.indexOf("^")!=-1 || str.indexOf("*")!=-1 || str.indexOf("{")!=-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	 return true;
}
function resettrans()
{
	document.frmcareer.reset();	
	GenNewCap();	
}
function onkeyPress(e)
{
    var key = window.event ? e.keyCode : e.which;
    if (key == 13)
    StartClick();
    e.cancelBubble = true;
    e.returnValue = false;
    return false;
}
function check_careers()
{
	var emailID=document.frmcareer.txtemail;
	if(document.frmcareer.txtname.value == "")
    {
	    alert("Please Enter Your Name.");		
	    document.frmcareer.txtname.focus();
	    return false;
    }
	else if (document.frmcareer.txtposition.value == "")
    {
	    alert("Please Enter Your Current Position/Level.");		
	    document.frmcareer.txtposition.focus();
	    return false;
    } 
	else if (document.frmcareer.txtcname.value == "")
    {
	    alert("Please Enter Your Current Company.");		
	    document.frmcareer.txtcname.focus();
	    return false;
    }	
	else if (document.frmcareer.txtlocation.value == "")
    {
	    alert("Please Enter Your Location.");		
	    document.frmcareer.txtlocation.focus();
	    return false;
    }
	else if (document.frmcareer.txtphone.value == "")
    {
	    alert("Please Enter Your Telephone Number.");		
	    document.frmcareer.txtphone.focus();
	    return false;
    }
	else if ((emailID.value==null)||(emailID.value==""))
	{
		alert("Please Enter your Email Address.");		
		emailID.focus();
		return false;
	}
	else if (echeck(emailID.value)==false)
	{
		emailID.focus();
		return false;
	}	
	else if (document.frmcareer.txtfile.value == "")
    {
	    alert("Please Browse Your File.");		
	    document.frmcareer.txtfile.focus();
	    return false;
    }	
	else if(document.getElementById("testtext").value=="")
	{
		alert("Please Enter The Verification Code.");
		document.getElementById("testtext").focus();
		return false;
	}
	else if(document.getElementById("holdCAP").value.toLowerCase()!=document.getElementById("testtext").value.toLowerCase())
	{
		alert("Sorry That Was Not The Correct Verification Code.");		
		document.getElementById("testtext").focus();
		return false;
	}
	else if(frmcareer.txtfile.value!="")
    {	
		
		var fileAndPath = new String(frmcareer.txtfile.value);	
		//find the index of the last "\"
		var lastPathDelimiter = fileAndPath.lastIndexOf("\\");
		//get everything after the last "\"
		var txt_filenameOnly = fileAndPath.substring(lastPathDelimiter+1);
		//get . position
		var lastPathdot = fileAndPath.lastIndexOf(".");
		// get everything after the last "."
		var extOnly = fileAndPath.substring(lastPathdot+1);
		
		if(extOnly =="exe" || extOnly =="bat" || extOnly =="sys" || extOnly =="ini" || extOnly =="ins")
		{
			alert(".exe, .bat, .sys, .ini, .ins Files Are Not Allowed. Please Upload Correct Files.");
			t_form.txtfile.focus();
			return false;
		}		
		else
		{		
			return true;
		}
	}
	else
	{
		return true;
	}
}