
function validate()
{
if (document.getElementById("txtname").value=="")
	{
      alert("Please enter your name");
      document.getElementById("txtname").focus();
      return false;
	} 

if (document.getElementById("txtfrom").value=="")
	{
      alert("Please enter your email id");
      document.getElementById("txtfrom").focus();
      return false;
	} 

if (!mailValidation(document.getElementById("txtfrom")))
	{
		return false;
	}

if (document.getElementById("txtRecipient").value=="")
	{
      alert("Please enter Recipient email id");
      document.getElementById("txtRecipient").focus();
      return false;
	} 

var sURL = "/industry-article/sendmail1.asp?" 
var sQry = "txtname=" + document.getElementById("txtname").value + "&txtfrom=" + document.getElementById("txtfrom").value + "&txtRecipient=" + document.getElementById("txtRecipient").value + "&articleid=" + escape(document.getElementById("articleid").value) + "&articlestatus=" + escape(document.getElementById("articlestatus").value)
sURL = sURL + sQry + "&sid=" + Math.random();

makeRequest1(sURL,'contentDialogue')

}


function mailValidation(mail)
{
 var txt;
 txt = mail;

if(txt.value=="")
{
	alert("Please enter a value for the Email field.");
	txt.focus();
	return false;
} 
  if(txt.value.search(/[^A-Za-z0-9@._-]/) >= 0 )
{
	alert("Special character '" + txt.value.charAt(txt.value.search(/[^A-Za-z0-9@._-]/)) +"'  not allowed");
	txt.focus();
	return false;
}

if ((txt.value.length) == (txt.value.lastIndexOf('.')+1))
{
	alert("Enter a proper email address");
	txt.focus();
	return false;
}

if(txt.value.indexOf("@")<1)
{
	alert("Please enter  '@' sign");
	txt.focus();
	return false;
 }

if( txt.value.indexOf('@',0)==0 || txt.value.indexOf('.',0)<1)
{
	alert("Enter a proper email address");
	txt.focus();
	return false;
}

if (txt.value.indexOf('@.')!= -1)
{
	alert("Enter a proper email address");
	txt.focus();
	return false;
}
var cnt = 0;
	instr = txt.value.toString();
	for(var i=0; i<instr.length; i++){
		var char1 = instr.charAt(i)
		if (char1 == "@"){
			cnt = cnt+1;
		}
	}
	if (cnt > 1)
	{
	 alert("Enter Valid mail");
	 return false;
	}
	return true;	
}
function Handle(e)
{
	if ( e.keyCode == 27 )
	{
		self.close();
	}
}

