// New script added for Email validation
function chkdata(strpass)
{

//alert(strpass);
	
//alert(document.getElementById(str).word.value);
if(document.getElementById(strpass).word.value=="")
{

alert("Please enter a valid email id");
document.getElementById(strpass).word.focus();
return false;
}

else if(chkemail('word')==false)
{
alert("Please enter a valid email id");
document.getElementById(strpass).word.focus();
return false;
}

else
{
//document.getElementById(strpass).submit();

//alert(document.getElementById(strpass).word.value);

window.open ("http://www.islamweb.net/nlreg/newsl_reg.php?lang=E&word="+document.getElementById(strpass).word.value, "mywindow","width=520,height=230");
}

}

function chkemail(strpass)
{
var at="@"
var dot="."
var str=document.getElementById(strpass).value;
//alert(str);
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)

//alert(lat)

if(lat==-1 || ldot==0 || ldot==lstr) return false

if(dot==-1 || lat==0 || lat==lstr) return false

		// To check more than one @
if(str.indexOf(at,(lat+1))!=-1) return false

//alert(str.substring(lat+1,lat+2)) //Here cheking if '.' exist just before .@ and just after @.
if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false

//alert(str.indexOf(dot,(lat+2))); //To check existance of atleast one '.' after '@' 
if(str.indexOf(dot,(lat+2))==-1) return false

if(str.indexOf(" ")!=-1) return false

dotl=str.substring(ldot+1,ldot+3);
dlen=dotl.length
if(dlen<2) return false

if(str.substring(lstr-1,lstr)==dot) return false

}
// New script added for Email validation







             //For News Letter Eamil
function clearvalue(strpass)
{
	
if(document.getElementById(strpass).word.value=="Your Email Address")
{
	//alert(document.getElementById(word).value)
document.getElementById(strpass).word.value="";
}
}

function addvalue(strpass)
{
if(document.getElementById(strpass).word.value=="")
document.getElementById(strpass).word.value="Your Email Address";
}




function chkdata_1()
{

strpass="email"
	
//alert(document.getElementById("hidcode").value);

if(document.getElementById("name").value=="")
{
alert("Enter the name");
document.getElementById("name").focus();
return false;
}

else if(document.getElementById(strpass).value=="")
{

alert("Please enter a valid email id");
document.getElementById(strpass).focus();
return false;
}
else if(chkemail(strpass)==false)
{
alert("Please enter a valid email id");
document.getElementById(strpass).focus();
return false;
}
else if(document.getElementById("to").value=="-1")
{
alert("Choose Message Reason");
document.getElementById("to").focus();
return false;
}
else if(document.getElementById("note").value=="")
{
alert("Enter the message");
document.getElementById("note").focus();
return false;
}
else
document.frmContact.submit();

/*else if(document.getElementById("hidcode").value!=document.getElementById("hidden_vercode").value)
{
alert("Verification Code doesn\'t match");
document.getElementById("hidden_vercode").focus();
return false;
}*/



}
