<!--
function isEmpty(sString)
{   
  return ((sString == null) || (sString.length == 0))
}
function isDigit (nDigit){   
	return ((nDigit >= "0") && (nDigit <= "9"))
}
function isInteger (sInteger)
 
{   var i;
    if (isEmpty(sInteger)) 
       return true;
    for (i = 0; i < sInteger.length; i++)
    {   
        var c = sInteger.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

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++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this;
}

function ValidDate(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){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
	return true
}
function checkSignupForm(){
	with(document.forms)
	{
		err_msg="";
		if(frm.name.value.length<1) err_msg=err_msg+"Name field is empty\n";
		if(frm.phone.value.length<1) err_msg=err_msg+"Phone field is empty\n";
		if((frm.email.value.length<6)||(frm.email.value.indexOf("@")==-1)||(frm.email.value.indexOf(".")==-1))    err_msg=err_msg+"E-Mail address is empty or invalid\n";
	}
	if(err_msg.length>1){
		alert("Errors found while processing the form:\n\n"+err_msg);
		return false;
	}else return true;
}
function checkPostEventForm(){
	with(document.forms)
	{
		err_msg="";
		if(frm.title.value.length<1) 
			err_msg=err_msg+"Title field is empty\n";
		if(frm.begin_date.value.length<1) 
			err_msg=err_msg+"Begin date field is empty\n";
		else
			if (!ValidDate(frm.begin_date.value))
				err_msg=err_msg+"Begin date field is invalid (must be in MM/DD/YYYY format)\n";
		if(frm.end_date.value.length<1)
			err_msg=err_msg+"End date field is empty\n";
		else
			if (!ValidDate(frm.end_date.value))
				err_msg=err_msg+"End date field is invalid (must be in MM/DD/YYYY format)\n";
		if(frm.location.value.length<1) 
			err_msg=err_msg+"Location field is empty\n";
		if(frm.postedby.value.length<1) 
			err_msg=err_msg+"Posted by field is empty\n";
		if((frm.email.value.length<6)||(frm.email.value.indexOf("@")==-1)||(frm.email.value.indexOf(".")==-1))    err_msg=err_msg+"E-Mail address is empty or invalid\n";
		if(frm.description.value.length<1)
			err_msg=err_msg+"Description field is empty\n";
	}
	if(err_msg.length>1){
		alert("Errors found while processing the form:\n\n"+err_msg);
		return false;
	}else return true;
}


function checkPrayerRequest(){
	with(document.forms){
		err_msg="";
		if(frm.name.value.length<1) err_msg=err_msg+"Name is empty\n";
		if((frm.email.value.length<6)||(frm.email.value.indexOf("@")==-1)||(frm.email.value.indexOf(".")==-1))    err_msg=err_msg+"E-Mail address is empty or invalid\n";
		if(frm.request_text.value.length<1) err_msg=err_msg+"Text is empty\n";
	}
	if(err_msg.length>1){
		alert("Errors found while processing the form:\n\n"+err_msg);
		return false;
	}else return true;
}

function select_date(field)
{
	var return_value;
	return_value=showModalDialog("inc/calendar.htm", null, "dialogHeight:180px;dialogWidth:240px;center:yes;dialogHide:yes;help:no;status:no");
	if (return_value)
		document.frm[field].value=return_value;
}
//-->