

function ValidateEmail(objemail){
	var emailID=document.getElementById(objemail);

	if ((emailID.value==null)||(emailID.value.trim()=="")){
		alert("Please enter your email address");
		//document.getElementById("error_email").style.backgroundColor="red";
		emailID.focus();			
		return false;
	}
	else if (echeck(emailID.value)==false){

		alert("Please enter valid email address");
		emailID.focus();
			   		//document.getElementById("error_email").style.backgroundColor="red";
		return false;
	}else
	{//document.getElementById("error_email").innerHTML="";
	//document.getElementById("error_email").style.backgroundColor="";
	//	hidetip();
	return true
	}
	
 }

function echeck(str) {
	//var emailID=document.contactForm.txtemail;
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   return false;
		}

		else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}

		else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}

		 else if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		 }

		 else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		 }

		 else if (str.indexOf(dot,(lat+2))==-1){
			return false;
		 }
		
		 else if (str.indexOf(" ")!=-1){
		    return false;
		 }
	else
		{
 		 return true	;				
		}
	}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function openwindow()
{

var ud=document.getElementById("loginUsername1").value.trim();
	if(ud!=""  && ValidateEmail('loginUsername1')==true)
	{
		//var hr=window.showModalDialog('../Forgotpwd.aspx?txtEmail='+document.getElementById("loginUsername").value.trim()+'&dt='+Date().getTime(),'','dialogWidth:900px; dialogHeight:800px; center:yes');
		//if(hr==undefined){location.href='jobseeker/jobseeker-forgotpassword.html';}
		return true;
		//if(hr!=null)
		//{
		//	document.getElementById("err_mesg").innerText=hr;
		//}


	}else
	{

		if(ud=="")
		{
			alert("Please enter your valid email id");
			document.getElementById("loginUsername1").focus();
			return false;
		}
		if(ud!="")
		{
		return ValidateEmail('loginUsername1');
		}

		
	}


}
