// JavaScript Document
function validatelogin(){
	if (document.frm.user_name.value == ""){
alert("Please Enter User Name");
document.frm.user_name.focus();
document.frm.user_name.select();
return false;
}

if (document.frm.usr_password.value == ""){
alert("Please Enter Password");
document.frm.usr_password.focus();
document.frm.usr_password.select();
return false;
}
    document.frm.method="post";
	document.frm.action="loginprocess.php"
	document.frm.submit();

}

function validatefeedback(){
if (document.frm.user_name.value == ""){
alert("Please Enter Name");
document.frm.user_name.focus();
document.frm.user_name.select();
return false;
}

if (document.frm.phone_num.value == ""){
alert("Please Enter Phone Number");
document.frm.phone_num.focus();
document.frm.phone_num.select();
return false;
}

if (isNaN(document.frm.phone_num.value))
{
	alert("please Enter Only Numeric Values");
	document.frm.phone_num.focus();
	document.frm.phone_num.select();
	return false;
}

if(document.frm.usr_email.value=="")
	{
   		alert("Please enter your Email ID");
		//SetErrorImage("Email", true);
		document.frm.usr_email.select();
		document.frm.usr_email.focus();
		return false;
	}

	else
	{
	  var evalue=document.frm.usr_email.value;
      var emailPat = /^(\".*\"|\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	  
	  var matchArray = evalue.match(emailPat);

		if(!emailPat.test(evalue))
		{
			alert("Your email address is invalid.  Please try again !!");
			//SetErrorImage("Email", true);
			document.frm.usr_email.select();
			document.frm.usr_email.focus();
  			return false;
		}
	}
	
if (document.frm.testimonial.value == ""){
alert("Please Enter Comments");
document.frm.testimonial.focus();
document.frm.testimonial.select();
return false;
}

    document.frm.method="post";
	document.frm.action="feedback_process.php"
	document.frm.submit();

}


function validateNewsLetterFrm(){
	if(document.newsletterFrm.emailaddr2newsletter.value=="" || document.newsletterFrm.emailaddr2newsletter.value=="Type your E-mail Address")
	{
   		alert("Please enter your Email ID");
		//SetErrorImage("Email", true);
		document.newsletterFrm.emailaddr2newsletter.select();
		document.newsletterFrm.emailaddr2newsletter.focus();
		return false;
	}

	else
	{
	  var evalue=document.newsletterFrm.emailaddr2newsletter.value;
      var emailPat = /^(\".*\"|\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	  
	  var matchArray = evalue.match(emailPat);

		if(!emailPat.test(evalue))
		{
			alert("Your email address is invalid.  Please try again !!");
			//SetErrorImage("Email", true);
			document.newsletterFrm.emailaddr2newsletter.select();
			document.newsletterFrm.emailaddr2newsletter.focus();
  			return false;
		}
	}
	
	document.newsletterFrm.method="post";
	document.newsletterFrm.action="newsletter_process.php"
	document.newsletterFrm.submit();
	
}


function hide(elmid, txt){
var emailvalue = document.getElementById(elmid).value;
if (emailvalue == txt)
{
	document.getElementById(elmid).value = "";
	document.getElementById(elmid).focus();
	return false;
}
}

function show(elmid, txt){
var emailvalue = document.getElementById(elmid).value;
if (emailvalue == "")
{
	document.getElementById(elmid).value = txt;
	return false;
}
}

function validate_donation(){
if (document.frmdonation.first_name.value == "")
{
alert("Please Enter First Name");
document.frmdonation.first_name.focus();
document.frmdonation.first_name.select();
return false;
}

if (document.frmdonation.last_name.value == "")
{
alert("Please Enter Last Name");
document.frmdonation.last_name.focus();
document.frmdonation.last_name.select();
return false;
}

if (document.frmdonation.dob.value == "" || document.frmdonation.dob.value=="MM/DD/YY")
{
alert("Please Enter Date of Birth");
document.frmdonation.dob.focus();
document.frmdonation.dob.select();
return false;
}
/*
if (document.frmdonation.rasi.value == "")
{
alert("Please Enter Rasi");
document.frmdonation.rasi.focus();
document.frmdonation.rasi.select();
return false;
}
*/
if (document.frmdonation.tob.value == "")
{
alert("Please Enter Time Of Birth");
document.frmdonation.tob.focus();
document.frmdonation.tob.select();
return false;
}
/*
if (document.frmdonation.star.value == "")
{
alert("Please Enter Star");
document.frmdonation.star.focus();
document.frmdonation.star.select();
return false;
}
*/
if (document.frmdonation.address.value == "")
{
alert("Please Enter Address");
document.frmdonation.address.focus();
document.frmdonation.address.select();
return false;
}


if(document.frmdonation.email.value=="")
	{
   		alert("Please enter your Email ID");
		//SetErrorImage("Email", true);
		document.frmdonation.email.select();
		document.frmdonation.email.focus();
		return false;
	}

	else
	{
	  var evalue=document.frmdonation.email.value;
      var emailPat = /^(\".*\"|\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	  
	  var matchArray = evalue.match(emailPat);

		if(!emailPat.test(evalue))
		{
			alert("Your email address is invalid.  Please try again !!");
			//SetErrorImage("Email", true);
			document.frmdonation.email.select();
			document.frmdonation.email.focus();
  			return false;
		}
	}
	
	
if (document.frmdonation.phone.value == "")
{
alert("Please Enter Land Line Phone Number");
document.frmdonation.phone.focus();
document.frmdonation.phone.select();
return false;
}	
	
	

if (isNaN(document.frmdonation.phone.value))
{
	alert("please Enter Only Numeric Values");
	document.frmdonation.phone.focus();
	document.frmdonation.phone.select();
	return false;
}
else if (document.frmdonation.phone.value.length < 10 ){
	alert("please Enter correct 10 digit Phone Number");
	document.frmdonation.phone.focus();
	document.frmdonation.phone.select();
	return false;
	
}

if (document.frmdonation.mobile.value == "")
{
alert("Please Enter Mobile Phone Number");
document.frmdonation.mobile.focus();
document.frmdonation.mobile.select();
return false;
}	

if (isNaN(document.frmdonation.mobile.value))
{
	alert("please Enter Only Numeric Values");
	document.frmdonation.mobile.focus();
	document.frmdonation.mobile.select();
	return false;
}
else if (document.frmdonation.mobile.value.length < 10 ){
	alert("please Enter correct 10 digit Phone Number");
	document.frmdonation.mobile.focus();
	document.frmdonation.mobile.select();
	return false;
	
}
alert(document.getElementById('card').value)
if (!document.getElementById('card').checked){
	alert("Please Select card Debit/Credit");
	document.frmdonation.card.focus();
	document.frmdonation.card.select();
	return false;
	
}
alert(document.frmdonation.cardtype.checked);
if (document.frmdonation.cardtype.checked == false ){
	alert("Please Select correct Card Type");
	document.frmdonation.cardtype.focus();
	document.frmdonation.cardtype.select();
	return false;
	
}
document.frmdonation.method="post";
	document.frmdonation.action="donation_process.php"
	document.frmdonation.submit();
return false;	
}

function changedata(tab){
	if (tab == "article")
	{
	tr1=document.getElementsByName("article"); 
	tr1[0].src="images/tab-Articles-over.jpg";   
	tr2=document.getElementsByName("news"); 
	tr2[0].src="images/tab_News.jpg"; 
	tr3=document.getElementsByName("prayerbook"); 
	tr3[0].src="images/tab_Prayerbook.gif"; 
  
    document.getElementById('articletab').style.display='block';
    document.getElementById('newstab').style.display='none';
    document.getElementById('prayerbooktab').style.display = 'none';
	}
	else if (tab == "news"){

	tr1=document.getElementsByName("article"); 
	tr1[0].src="images/tab_Articles.jpg";  
	tr2=document.getElementsByName("news"); 
 	tr2[0].src="images/tab-News-over.jpg"; 
 	tr3=document.getElementsByName("prayerbook"); 
 	tr3[0].src="images/tab_Prayerbook.gif"; 
 
    document.getElementById('articletab').style.display='none';
    document.getElementById('newstab').style.display='block';
    document.getElementById('prayerbooktab').style.display = 'none';
	 
	}
	else if (tab == "prayerbook"){
	tr1=document.getElementsByName("article"); 
	tr1[0].src="images/tab_Articles.jpg";   
	tr2=document.getElementsByName("news"); 
 	tr2[0].src="images/tab_News.jpg"; 
 	tr3=document.getElementsByName("prayerbook"); 
 	tr3[0].src="images/tab-Prayerbook-over.jpg"; 
  
    document.getElementById('articletab').style.display='none';
    document.getElementById('newstab').style.display='none';
    document.getElementById('prayerbooktab').style.display = 'block';
	}


}








