// JavaScript Document
	if (screen.width > 1600)
	{
		document.write('<link rel="stylesheet" type="text/css" href="../includes/large.css"/>');
	}
	else if (screen.width < 900)
	{
		document.write('<link rel="stylesheet" type="text/css" href="../includes/small.css"/>');
	}
	else
	{
		document.write('<link rel="stylesheet" type="text/css" href="../includes/regular.css"/>');
	}
	
	var version=0;
	if (navigator.appVersion.indexOf("MSIE")!=-1)
	{
		var temp=navigator.appVersion.split("MSIE");
		version=parseFloat(temp[1]);
	}
	if (version > 0 && version < 7) //if not Internet Explorer version will be returned as zero
	{ //	alert("I am using IE  less than version 7");
		document.write('<link rel="stylesheet" type="text/css" href="../includes/ie6.css"/>');
	}

function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
	for (index = 0; index < strLen; index++)  {
		if (index == 0)  {
			tmpChar = tmpStr.substring(0,1).toUpperCase();
			postString = tmpStr.substring(1,strLen);
			tmpStr = tmpChar + postString;
		}
		else {
			tmpChar = tmpStr.substring(index, index+1);
			if (tmpChar == " " && index < (strLen-1))  {
				tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
				preString = tmpStr.substring(0, index+1);
				postString = tmpStr.substring(index+2,strLen);
				tmpStr = preString + tmpChar + postString;
   		   }
        }
    } //end of for
}
frmObj.value = tmpStr;
} //end of function

function checkrequired(which) {
var pass=true;
if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (undefined != tempobj.value)
		{
		  if (tempobj.name.substring(0,8)=="required") {
			if (((tempobj.type=="text"||tempobj.type=="textarea")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
				pass=false;
				break;
            }
		  }
        }
   }
}
  if (!pass) {
    shortFieldName=tempobj.name.substring(8,30).toUpperCase();
    alert("Please make sure the "+shortFieldName+" field was properly completed.");
    return false;
  }
  disableButtons();
  return true;
} //end of function
function IsEmpty(aTextField)
{
	if ((trim(aTextField.value).length == 0) ||
		 (aTextField.value == null))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function isFloat(val)
{
	if (val.match(/^[0-9.]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
} 		
function calcTtl()
{ 
	var which = document.tithe;
	var Accum = 0;
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		//alert("object name is "+tempobj.name);
		if (undefined != tempobj.value)
		{ //alert("tempobjvalue is not undefined");
			if (tempobj.name.substring(0,4)=="calc") 
			{	var value = tempobj.value;
				var dollaramt = value.toString().replace(/\$|\,/g,'');
				//alert("returned from convertToNumber");
				CheckNum = parseFloat(dollaramt);
				if(!isNaN(CheckNum)) 
				{ 
					Accum += parseFloat(dollaramt);
				}
			}
		}
	} 
	which.requiredtotal.value = formatPrice(Accum);
} //end of function
function formatCurrency(formObj) {
num = formObj.value;
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
newfmt = (((sign)?'':'-') + num + '.' + cents);
formObj.value=newfmt;
//return (((sign)?'':'-') + '$' + num + '.' + cents);
}
function formatPrice(value) {
var result= Math.floor(value) + ".";
var cents = 100 * (value-Math.floor(value)) + 0.5;
result += Math.floor(cents / 10);
result += Math.floor(cents % 10);
return result;
}
function disableButtons() {
	document.tithe.Submit.disabled=true;
}
function enableButtons() {
	document.tithe.Submit.disabled=false;
}