// JavaScript Document

function admin_validation(){
var txtUsername=document.Login.txtUsername.value;
	 if(txtUsername == "")
			 {
			 alert("User name  is empty");
			 document.Login.txtUsername.focus();
			 return false;
			 }
var txtPassword=document.Login.txtPassword.value;
	 if(txtPassword == ""){
			 alert("Password  is empty");
			 document.Login.txtPassword.focus();
			 return false;
	}
}

function confirmMsg(msg){
	if(!confirm(msg)){
		return false;

	} else {
		return true;

	}
}

//Validation for Events
function addevent_validate(){
	if(document.frm_addevent.heading.value == ""){
		alert("Please enter the Heading");
		document.frm_addevent.heading.focus();
		return false;
	}
	if(document.frm_addevent.eventdate.value == ""){
		alert("Please select the date from Date Picker");
		document.frm_addevent.eventdate.focus();
		return false;
	}
}

function myprofile(){
	if(document.frm_myprofile.txt_contactperson.value == "")
	{
		 alert("Enter the contact person");
		 document.frm_myprofile.txt_contactperson.focus();
		 return false;
	}
	if (!validateEmail(document.frm_myprofile.txt_email.value,1,1)) 
	{
		 document.frm_myprofile.txt_email.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_address.value == "")
	{
		 alert("Enter the address");
		 document.frm_myprofile.txt_address.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_country.value == "")
	{
		 alert("Enter the country");
		 document.frm_myprofile.txt_country.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_phone.value == "")
	{
		 alert("Enter the phone");
		 document.frm_myprofile.txt_phone.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_website.value == "")
	{
		 alert("Enter the website");
		 document.frm_myprofile.txt_website.focus();
		 return false;
	}
	/*re = /^(file|http):\/\/\S+\.(com|net|org|info|biz|ws|us|tv|cc|in|cd|nw)$/i
		 if (!(re.test(document.frm_myprofile.txt_website.value))) {
		 alert ("Invalid URL.");
		 document.frm_myprofile.txt_website.focus();
		 return false;
		 }*/
	if(document.frm_myprofile.txt_numrows.value == "")
	{
		 alert("Enter the number of rows displayed in Admin Panel");
		 document.frm_myprofile.txt_numrows.focus();
		 return false;
	}
	if(isNaN(document.frm_myprofile.txt_numrows.value))
	{
		 alert("Number of rows displayed in Admin Panel should be numeric");
		 document.frm_myprofile.txt_numrows.value="";
		 document.frm_myprofile.txt_numrows.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_numrows.indexOf("-",0) > -1){
		alert("Enter the valid number of rows displayed per page");
		document.frm_myprofile.txt_numrows.focus();
		return false;
	}
	if(document.frm_myprofile.txt_frontrows.value == "" || document.frm_myprofile.txt_frontrows.value == 0)
	{
		 alert("Enter the number of rows displayed in front panel");
		 document.frm_myprofile.txt_frontrows.focus();
		 return false;
	}
	if(isNaN(document.frm_myprofile.txt_frontrows.value))
	{
		 alert("Number of rows displayed in Front Panel should be numeric");
		 document.frm_myprofile.txt_frontrows.value = "";
		 document.frm_myprofile.txt_frontrows.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_admintitle.value == "")
	{
		 alert("Enter the admin page title");
		 document.frm_myprofile.txt_admintitle.focus();
		 return false;
	}
	if(document.frm_myprofile.txt_hometitle.value == "")
	{
		 alert("Enter the home page title");
		 document.frm_myprofile.txt_hometitle.focus();
		 return false;
	}
	if(document.frm_myprofile.Datedisp.value == "select")
	{
		 alert("Choose the date format");
		 document.frm_myprofile.Datedisp.focus();
		 return false;
	}
}

//Function Church Search Location
function ChurchSearch(){
	cityname = document.frm_churchlist.cityname.value;
	Location = document.frm_churchlist.Location.value;
	txt_state = document.frm_churchlist.txt_state.value;
		
	if( (cityname == "" && Location == "" && txt_state == "") || (cityname != "" && Location != "" && txt_state == "")  || (cityname == "" && Location != "" && txt_state != "")  || (cityname != "" && Location == "" && txt_state != "") ){
			alert("Please choose any one of the search criteria");
			document.frm_churchlist.cityname.focus();
			return false;
	}
}


//Function to get the color
function ChangeColor(s,dest)
  {
  	var newcolor=showModalDialog("../../include/select_color.html","","resizable: no; help: no; status: no; scroll: no;");
	if(newcolor != null)
	document.getElementById(s).value="#"+newcolor;
	document.getElementById(dest).style.background="#"+newcolor;
  }
  
  //Function for Department
function changecat_events(){
	var catname=document.frm_viewevents.catid.value;
		if (catname=="All"){
				window.location.href="index.php?task=viewevent";
		}
		else{
				window.location.href="index.php?task=viewevent&chrId="+document.frm_viewevents.catid.value+"";
		}
	}
	


//Bible Study validation
function biblestudy_validtae(){
	if(document.frm_bible.txt_heading.value == "")
	{
		 alert("Enter the heading");
		 document.frm_bible.txt_heading.focus();
		 return false;
	}
	if(document.frm_bible.txt_bibleverse.value == "")
	{
		 alert("Enter the bible verse");
		 document.frm_bible.txt_bibleverse.focus();
		 return false;
	}
	if(document.frm_bible.eventdate.value == "")
	{
		 alert("Choose the date in date picker");
		 document.frm_bible.eventdate.focus();
		 return false;
	}if(document.frm_bible.txt_by.value == "")
	{
		 alert("Enter the By name");
		 document.frm_bible.txt_by.focus();
		 return false;
	}
	if(document.frm_bible.txt_short.value == "")
	{
		 alert("Enter the shoret description");
		 document.frm_bible.txt_short.focus();
		 return false;
	}
}

function loginprof_validate(){
	if(document.frm_loginprof.txt_username.value == "")
	{
		alert("Enter the username");
		document.frm_loginprof.txt_username.focus();
		return false;
	}
	if(document.frm_loginprof.txt_password.value == "")
	{
		alert("Enter the password");
		document.frm_loginprof.txt_password.focus();
		return false;
	}
}

function addchurchinfo_validate(){
	if(document.frm_church.txt_churchname.value == "")
	{
		alert("Enter the churchname");
		document.frm_church.txt_churchname.focus();
		return false;
	}
	if(document.frm_church.txt_denom.value == "")
	{
		alert("Choose the denomination");
		document.frm_church.txt_denom.focus();
		return false;
	}

	if(document.frm_church.txt_address.value == "")
	{
		alert("Enter the address");
		document.frm_church.txt_address.focus();
		return false;
	}
	if(document.frm_church.txt_city.value == "")
	{
		alert("Enter the city");
		document.frm_church.txt_city.focus();
		return false;
	}
		if(document.frm_church.State.value == "")
		{
			alert("Choose the state");
			document.frm_church.State.focus();
			return false;
		}
	if(document.frm_church.txt_zip.value == "")
	{
		alert("Enter the zipcode");
		document.frm_church.txt_zip.focus();
		return false;
	}
	if(document.frm_church.txt_phone.value == "")
	{
		alert("Enter the phone number");
		document.frm_church.txt_phone.focus();
		return false;
	}
	phone = document.frm_church.txt_phone;
		if (checkInternationalPhone(phone.value)==false){
			alert("Please Enter a Valid Phone Number")
			phone.value=""
			phone.focus()
			return false
			}
			
	if(document.frm_church.rdoMapDisplay[0].checked == false  && document.frm_church.rdoMapDisplay[1].checked == false){
		alert("Please select the option \"Toggle in Google Map\"");
		return false
	}
	
	if(document.frm_church.txt_churchsize.value == "Select")
	{
		alert("Choose the church size");
		document.frm_church.txt_churchsize.focus();
		return false;
	}
	if(document.frm_church.txt_worshipstyle.value == "Select")
	{
		alert("Choose the worship style");
		document.frm_church.txt_worshipstyle.focus();
		return false;
	}
	if(document.frm_church.txt_attire.value == "Select")
	{
		alert("Choose the common church attire");
		document.frm_church.txt_attire.focus();
		return false;
	}
	if(document.frm_church.txt_yrname.value == "")
	{
		alert("Enter the Administrator Name");
		document.frm_church.txt_yrname.focus();
		return false;
	}
	if (!validateEmail(document.frm_church.txt_yremail.value,1,1)) 
	{
		document.frm_church.txt_yremail.focus();
		return false;
	}
	if((document.frm_church.txt_username.value == "") || (document.frm_church.txt_username.value.length < 6 ))
	{
		alert("Enter the user name with the minimum of 6 characters");
		document.frm_church.txt_username.focus();
		return false;
	}
	if((document.frm_church.txt_password.value == "") || (document.frm_church.txt_password.value.length < 6))
	{
		alert("Enter the password with the minimum of 6 characters");
		document.frm_church.txt_password.focus();
		return false;
	}
}

//Photo album validate
function album_validate(){
	if(document.frm_photo.txt_church.value == "")
	{
		alert("Choose the church name");
		document.frm_photo.txt_church.focus();
		return false;
	}
	if(document.frm_photo.txt_albumname.value == "")
	{
		alert("Enter the album name");
		document.frm_photo.txt_albumname.focus();
		return false;
	}
	if(document.frm_photo.eventdate.value == "")
	{
		alert("Choose the date in date picker");
		document.frm_photo.eventdate.focus();
		return false;
	}
	if(document.frm_photo.txt_numphoto.value == "" || document.frm_photo.txt_numphoto.value == 0)
	{
		alert("Enter the number of photos");
		document.frm_photo.txt_numphoto.focus();
		return false;
	}
	if(isNaN(document.frm_photo.txt_numphoto.value ))
	{
		alert("Enter the number of photos");
		document.frm_photo.txt_numphoto.focus();
		return false;
	}
}

//sermon validation
function sermon_validate(){
		if(document.frm_sermon.txt_subject.value == "")
	{
		alert("Enter the lecture subject");
		document.frm_sermon.txt_subject.focus();
		return false;
	}
	if(document.frm_sermon.txt_lectby.value == "")
	{
		alert("Enter the lecture by name");
		document.frm_sermon.txt_lectby.focus();
		return false;
	}
	if(document.frm_sermon.bibleid.value == "")
	{
		alert("Please Choose the Book of Bible");
		document.frm_sermon.bibleid.focus();
		return false;
	}
	if(document.frm_sermon.eventdate.value == "")
	{
		alert("Choose the date in date picker");
		document.frm_sermon.eventdate.focus();
		return false;
	}
}

//Change Church name
function changechurch_view()
	{
	var catname=document.frm_sermon.churchname.value;
	//var dof="sermon";
		if (catname=="All")
			{
				window.location.href="index.php?task=viewsermon";
			}
		else
			{
				window.location.href="index.php?chrId="+document.frm_sermon.churchname.value+"&task=viewsermon";
			}
}

//Change Church name
function changechurch_viewphotoalbum()
	{
	var catname=document.frm_sermon.churchname.value;
	//var dof="sermon";
		if (catname=="All")
			{
				window.location.href="index.php?task=viewphotoalbum";
			}
		else
			{
				window.location.href="index.php?chrId="+document.frm_sermon.churchname.value+"&task=viewphotoalbum";
			}
}
	
//Change Church name
function changechurch_viewmember()
	{
	var catname=document.frm_member.church.value;
	//var dof="sermon";
		if (catname=="All")
			{
				window.location.href="index.php?task=viewmember";
			}
		else
			{
				window.location.href="index.php?chrId="+document.frm_member.church.value+"&task=viewmember";
			}
}

//Change Church name
function changechurch_viewalbum()
	{
	var catname=document.frm_album.churchname.value;
	//var dof="sermon";
		if (catname=="All")
			{
				window.location.href="index.php?task=viewalbum";
			}
		else
			{
				window.location.href="index.php?chrId="+document.frm_album.churchname.value+"&task=viewalbum";
			}
}

function membersValidation(){
	if(document.frm_member.txt_first.value == "")
	{
		alert("Enter the first name");
		document.frm_member.txt_first.focus();
		return false;
	}
	if(document.frm_member.txt_last.value == "")
	{
		alert("Enter the last name");
		document.frm_member.txt_last.focus();
		return false;
	}
	if(document.frm_member.txt_addr1.value == "")
	{
		alert("Enter the addres line1");
		document.frm_member.txt_addr1.focus();
		return false;
	}
	if(document.frm_member.txt_city.value == "")
	{
		alert("Enter the city");
		document.frm_member.txt_city.focus();
		return false;
	}
		if(document.frm_member.State.value == "")
		{
			alert("Choose the state");
			document.frm_member.State.focus();
			return false;
		}
	if (!validateEmail(document.frm_member.txt_email.value,1,1)) 
	{
		 document.frm_member.txt_email.focus();
		 return false;
	}
	if((document.frm_member.txt_username.value == "") || (document.frm_member.txt_username.value.length < 6))
	{
		alert("Enter the user name with the minimum of 6 characters");
		document.frm_member.txt_username.focus();
		return false;
	}
	if((document.frm_member.txt_password.value == "") || (document.frm_member.txt_password.value.length < 6))
	{
		alert("Enter the password with the minimum of 6 characters");
		document.frm_member.txt_password.focus();
		return false;
	}
}

function member_validate(){
	if(document.frm_member.txt_church.value == "")
	{
		alert("Choose the church name");
		document.frm_member.txt_church.focus();
		return false;
	}
	if(document.frm_member.txt_first.value == "")
	{
		alert("Enter the first name");
		document.frm_member.txt_first.focus();
		return false;
	}
	if(document.frm_member.txt_last.value == "")
	{
		alert("Enter the last name");
		document.frm_member.txt_last.focus();
		return false;
	}
	if(document.frm_member.txt_addr1.value == "")
	{
		alert("Enter the addres line1");
		document.frm_member.txt_addr1.focus();
		return false;
	}
	if(document.frm_member.txt_city.value == "")
	{
		alert("Enter the city");
		document.frm_member.txt_city.focus();
		return false;
	}
		if(document.frm_member.State.value == "")
		{
			alert("Choose the state");
			document.frm_member.State.focus();
			return false;
		}
	if (!validateEmail(document.frm_member.txt_email.value,1,1)) 
	{
		 document.frm_member.txt_email.focus();
		 return false;
	}
	if((document.frm_member.txt_username.value == "") || (document.frm_member.txt_username.value.length < 6))
	{
		alert("Enter the user name with the minimum of 6 characters");
		document.frm_member.txt_username.focus();
		return false;
	}
	if((document.frm_member.txt_password.value == "") || (document.frm_member.txt_password.value.length < 6))
	{
		alert("Enter the password with the minimum of 6 characters");
		document.frm_member.txt_password.focus();
		return false;
	}
}

//Prayer Warrior Validate
function warrior_validate(){
	if(document.frm_warrior.txt_first.value == "")
	{
		alert("Enter the first name");
		document.frm_warrior.txt_first.focus();
		return false;
	}
	if(document.frm_warrior.txt_last.value == "")
	{
		alert("Enter the last name");
		document.frm_warrior.txt_last.focus();
		return false;
	}
	if(!validateEmail(document.frm_warrior.txt_email.value,1,1))
	{
		document.frm_warrior.txt_email.focus();
		return false;
	}
	if(document.frm_warrior.txt_prayhome.value == "")
	{
		alert("Enter the prayer home name");
		document.frm_warrior.txt_prayhome.focus();
		return false;
	}
	if(document.frm_warrior.txt_prayaddr.value == "")
	{
		alert("Enter the prayer address");
		document.frm_warrior.txt_prayaddr.focus();
		return false;
	}
	if(document.frm_warrior.txt_praycity.value == "")
	{
		alert("Enter the prayer city");
		document.frm_warrior.txt_praycity.focus();
		return false;
	}
	
	
	if(document.frm_warrior.State2.value == "")
	{
		alert("Choose the state");
		document.frm_warrior.State2.focus();
		return false;
	}
	
	if(document.frm_warrior.txt_prayzip.value == "")
	{
		alert("Enter the zipcode");
		document.frm_warrior.txt_prayzip.focus();
		return false;
	}
	if((document.frm_warrior.txt_username.value == "") || (document.frm_warrior.txt_username.value.length < 6))
	{
		alert("Enter the username with the minimum of 6 characters");
		document.frm_warrior.txt_username.focus();
		return false;
	}
	if((document.frm_warrior.txt_password.value == "") || (document.frm_warrior.txt_password.value.length < 6))
	{
		alert("Enter the password with the minimum of 6 characters");
		document.frm_warrior.txt_password.focus();
		return false;
	}
}

//Prayer Request validate
function prayerrequest_validate(){
	if(document.frm_prayerrequest.txt_subject.value == "")
	{
		alert("Enter the subject");
		document.frm_prayerrequest.txt_subject.focus();
		return false;
	}
	rdo_request="";
	var i=0;
	rdo_requestlength=document.frm_prayerrequest.rdo_request.length;
	if(rdo_requestlength > 1){
		for(Index = 0;Index < rdo_requestlength;Index++){
			if(document.frm_prayerrequest.rdo_request[Index].checked==false){
				i=i+1;
			}
			else{
				rdo_request = document.frm_prayerrequest.rdo_request[Index].value;
			}
		}
	}
	if(i==rdo_requestlength){
		alert("Please select you are Anonymous are not");
		return false;
	}
	if(document.frm_prayerrequest.rdo_request[1].checked==true){
		if(document.frm_prayerrequest.email.value==""){
			alert("Please Enter your Email Id");
			document.frm_prayerrequest.email.focus();
			return false;
		}
		if (!validateEmail(document.frm_prayerrequest.email.value,1,1)) 
		{
			 document.frm_prayerrequest.email.focus();
			 return false;
		}
		if(document.frm_prayerrequest.callinfo.value==""){
			alert("Please enter your Phone Number");
			document.frm_prayerrequest.callinfo.focus();
			return false;
		}
		phone = document.frm_prayerrequest.callinfo;
		if(checkInternationalPhone(phone.value)==false){
			alert("Please Enter a Valid Phone Number")
			phone.value=""
			phone.focus()
			return false
		}
	}
}

function denom_validate(){
	if(document.frm_denom.txt_denom.value == "")
	{
		alert("Enter the denomination.");
		document.frm_denom.txt_denom.focus();
		return false;
	}
}

function ministry_validate(){
	if(document.frm_ministry.txt_ministry.value == "")
	{
		alert("Enter the ministry.");
		document.frm_ministry.txt_ministry.focus();
		return false;
	}
}

function poplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

function showState(passcountry){
		if (document.getElementById(passcountry).value == "US"){
			postate = document.getElementById("poststate");
			if(postate){
				postate.style.display="block";
				postate.style.visibility="visible";
			}
			pootherstate = document.getElementById("postotherstate");
			if(pootherstate){
				pootherstate.style.display="none";
				pootherstate.style.visibility="hidden";
			}
		}
		else{
			pootherstate = document.getElementById("postotherstate");
			if(pootherstate){
				pootherstate.style.display="block";
				pootherstate.style.visibility="visible";
			}
			postate = document.getElementById("poststate");
			if(postate){
				postate.style.display="none";
				postate.style.visibility="hidden";
			}
		}
	}

function showState1(passcountry1){
		if (document.getElementById(passcountry1).value == "US"){
			postate = document.getElementById("poststate1");
			if(postate){
				postate.style.display="block";
				postate.style.visibility="visible";
			}
			pootherstate = document.getElementById("postotherstate1");
			if(pootherstate){
				pootherstate.style.display="none";
				pootherstate.style.visibility="hidden";
			}
		}
		else{
			pootherstate = document.getElementById("postotherstate1");
			if(pootherstate){
				pootherstate.style.display="block";
				pootherstate.style.visibility="visible";
			}
			postate = document.getElementById("poststate1");
			if(postate){
				postate.style.display="none";
				postate.style.visibility="hidden";
			}
		}
	}
	

//Email Validation Script
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}

 //Function phone validation Script
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

//script validation for date 
function date_valid(dateissue,dateissue2){
	var stdate=dateissue.split("/");
	var enddate=dateissue2.split("/");
	var prostdate = new Date();
	prostdate.setFullYear(stdate[2]);
	prostdate.setMonth(stdate[0]-1);
	prostdate.setDate(stdate[1]);
	
	var proenddate = new Date();
	proenddate.setFullYear(enddate[2]);
	proenddate.setMonth(enddate[0]-1);
	proenddate.setDate(enddate[1]);
	
	var startingdate = prostdate.getTime();
	var endingdate = proenddate.getTime();

	if(startingdate > endingdate)
	{
		return false;
	}
	return true;
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
} 
function showinfo(){
		if (document.frm_prayerrequest.rdo_request[1].checked){
		ap1=document.getElementById("showattrib");
		    if(ap1){
			ap1.style.display="block";
			ap1.style.visibility="visible";
				}				
		}
		else
		{
			ap1=document.getElementById("showattrib");
			if(ap1){
			ap1.style.display="none";
			ap1.style.visibility="hidden";
				}
		}
}

//Validation for Pray Layout
function praylayout_validate(){
	if(document.frmpagelayout.txtPagebgColor.value==""){
		alert("Choose the Color from the Color Pallet for Page Background Color");
		document.frmpagelayout.txtPagebgColor.focus();
		return false;
	}
	if(document.frmpagelayout.txtLeftbgColor.value==""){
		alert("Choose the Color from the Color Pallet for Left Side Background Color");
		document.frmpagelayout.txtLeftbgColor.focus();
		return false;
	}
	if(document.frmpagelayout.txtInnerbgColor.value==""){
		alert("Choose the Color from the Color Pallet for Inner Page Background Color");
		document.frmpagelayout.txtInnerbgColor.focus();
		return false;
	}
}
		
//Validation for Change Password
function pwd_validation(){
	if((document.changepwd.txt_username.value == "") || (document.changepwd.txt_username.value.length < 6))
	{
		alert("Enter the UserName with the minimum of 6 characters");
		document.changepwd.txt_username.focus();
		return false;
	}
	if((document.changepwd.txt_password.value =="") || (document.changepwd.txt_password.value.length < 6)){
		alert("Enter the Password with the minimum of 6 characters");
		document.changepwd.txt_password.focus();
		return false;
	}
}

