// 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.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.user_name.value == "")
{
alert("Please Enter  Name");
document.frmdonation.user_name.focus();
document.frmdonation.user_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=="YYYY-MM-DD")
{
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.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  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;
	
}

if (document.frmdonation.address.value == "")
{
alert("Please Enter Address");
document.frmdonation.address.focus();
document.frmdonation.address.select();
return false;
}
if (document.frmdonation.city.value == "")
{
alert("Please Enter City");
document.frmdonation.city.focus();
document.frmdonation.city.select();
return false;
}

if (document.frmdonation.state.value == "")
{
alert("Please Enter State");
document.frmdonation.state.focus();
document.frmdonation.state.select();
return false;
}
if (!document.getElementById('card').checked){
	alert("Please Select card Debit/Credit");
	document.frmdonation.card.focus();
	document.frmdonation.card.select();
	return false;
	
}
if (document.frmdonation.cardtype.checked == false ){
	alert("Please Select correct Card Type");
	document.frmdonation.cardtype.focus();
	document.frmdonation.cardtype.select();
	return false;
	
}
document.frmdonation.submit();
/*document.frmdonation.method="post";
	document.frmdonation.action="subscribe.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';
	}


}
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->







