// JavaScript Document
function clear()
{
	document.frm1.reset();  
}
function txtcheck()
{
		var Name=document.getElementById('Title')
			if(Name.value == ""||Name.value == null)
				{
					alert("Please select title.");
					Name.focus();
					return false
				}
		var Name=document.getElementById('Name')
			if(Name.value == ""||Name.value == null)
				{
					alert("Please enter your first name.");
					Name.focus();
					return false
				}
		var Mobile=document.getElementById('Phone')
			if(Mobile.value == ""||Mobile.value == null)
				{
					alert("Please enter the mobile number.");
					Mobile.focus();
					return false
				}
		var emailID=document.getElementById('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
					}
		var Telephone=document.getElementById('attachment')
			if(Telephone.value == ""||Telephone.value == null)
				{
					alert("Please attach your resume.");
					Telephone.focus();
					return false
				}
		return true
	}

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")
		   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){
		    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){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


function checkForInvalid(obj) 
	{
		obj.value = obj.value.replace(/[^0-9\-]|(-{2,})/gi, (RegExp.$1.indexOf("-") > -1) ? "-" : "");
	}

