<!-- hide
function country_data(country)
{
	this.country = country
}
country = new Array(30)
country[0] = "Australia"
country[1] = "Belgium"
country[2] = "Brazil"
country[3] = "Canada"
country[4] = "Chile"
country[5] = "China"
country[6] = "Croatia"
country[7] = "Cyprus"
country[8] = "Czech Republic"
country[9] = "Denmark"
country[10] = "Finland"

country[11] = "France"
country[12] = "Germany"
country[13] = "India"
country[14] = "Indonesia"
country[15] = "Ireland"
country[16] = "Italy"
country[17] = "Japan"
country[18] = "Latvia"
country[19] = "Malaysia"
country[20] = "Mexico"

country[21] = "Morocco"
country[22] = "Nepal"
country[23] = "New Zealand"
country[24] = "Pakistan"
country[25] = "Philippines"
country[26] = "Portugal"
country[27] = "Romania"
country[28] = "Russia"
country[29] = "Saudi Arabia"
country[30] = "Scotland"

country[31] = "Singapore"
country[32] = "South Africa"
country[33] = "Switzerland"
country[34] = "The Netherlands"
country[35] = "United Arab Emirates"
country[36] = "United Kingdom"
country[37] = "USA"
country[38] = "Venezuela"
country[39] = "Latvia"
country[40] = "Iran"

country[41] = "Northrn Ireland"




function stackdata(stackname)
{
	this.stackname = stackname
}
stacktag = new Array(5)

stacktag[1] = new stackdata('Moon Struck')
stacktag[2] = new stackdata('Light Bearers')
stacktag[3] = new stackdata('Miracles')
stacktag[4] = new stackdata('Healing Love')
stacktag[5] = new stackdata('Life Line')
stacktag[6] = new stackdata('Glory')
stacktag[7] = new stackdata('Love Heals')
stacktag[8] = new stackdata('Jesus')
stacktag[9] = new stackdata('Bill\'s')
stacktag[10] = new stackdata('Bright Light')
stacktag[11] = new stackdata('Love\'s Light')
stacktag[12] = new stackdata('Light Holders')
stacktag[13] = new stackdata('Sun\'s Light')
stacktag[14] = new stackdata('Smiles')
stacktag[15] = new stackdata('Starlight')
stacktag[16] = new stackdata('Grace')
stacktag[17] = new stackdata('Goodness')
stacktag[18] = new stackdata('Jesus Heals')
stacktag[19] = new stackdata('Love Rules')
stacktag[20] = new stackdata('Wonder II')
stacktag[21] = new stackdata('Moon Struck II')
stacktag[22] = new stackdata('Light Bearers II')
stacktag[23] = new stackdata('Miracles II')
stacktag[24] = new stackdata('Healing Love II')
stacktag[25] = new stackdata('Life Line II')
stacktag[26] = new stackdata('Glory II')
stacktag[27] = new stackdata('Love Heals II')
stacktag[28] = new stackdata('Jesus II')
stacktag[29] = new stackdata('Bill\'s II')

stacktag[30] = new stackdata('Alp Glory')
stacktag[31] = new stackdata('High Mountain')
stacktag[32] = new stackdata('Life\'s Web')
stacktag[33] = new stackdata('Flying High')
stacktag[34] = new stackdata('Beauty Frozen')
stacktag[35] = new stackdata('Hot Fire')
stacktag[36] = new stackdata('Love\'s Touch')
stacktag[37] = new stackdata('God\'s Way')
stacktag[38] = new stackdata('Stack of Life')
stacktag[39] = new stackdata('Shining Light')


// Sort routines
function compare(a,b) // sort by name
{
	if(a.name > b.name){return 1}
	if(b.name > a.name){return -1}
	return 0
}
function comparedate(a,b) // sort by date
{
	if(a.date2 > b.date2){return 1}
	if(b.date2 > a.date2){return -1}
	return 0
}
function comparerequest(a,b) // sort by request
{
	if(a.request > b.request){return 1}
	if(b.request > a.request){return -1}
	return 0
}
function compare_country(a,b)//Sort by Country
{
	if(a.country.toUpperCase()> b.country.toUpperCase()){return 1}
	if(b.country.toUpperCase()> a.country.toUpperCase()){return -1}
	return 0
}
//Count the Countries
var counter = 0



// Case routines
function set_area(i)// Adjust output to accommodate missing data
{
	if(prayer[i].city==''){ts=''}else{ts=', '}
	if(prayer[i].region==''){rs=''}else{rs=', '}
	if(prayer[i].country==''){rs=''}
	if(prayer[i].region=='' && prayer[i].country==''){ts=''}
	theArea = title_case(prayer[i].city) + ts + test_region(prayer[i].region) + rs + prayer[i].country.toUpperCase()
	return theArea
}
	function test_region(area)
	{
		if(area.length<=3){area=area.toUpperCase()}
		else{area=title_case(area)}
		return area
	}
	function title_case(item)
	{
		item = item.toLowerCase()
		var new_case = ''		
		var splitter = item.split(" ")
		var word_count = splitter.length
		for(var i=0; i<word_count; i++)
		{
			if(splitter.length==1){new_case += splitter[i].charAt(0).toUpperCase()+splitter[i].substring(1,item.length);break}			
			if(i==splitter.length-1){new_case += splitter[i].charAt(0).toUpperCase()+splitter[i].substring(1,item.length);break}			
			new_case += splitter[i].charAt(0).toUpperCase()+splitter[i].substring(1,item.length)+" "
		}
		return new_case
	}
// This function joins two lists of countries, removes duplicate entries 
// and counts the remaining countries.	
	var list = unescape(country.join(","))
	function play()
	{
		var count = 0
		list = unescape(country.join(",")) //Convert the existing array of countries taken from the 1st year of requests.
		list = list + "," + create_countries()//Creates a new list of countries based upon this year's requests and then Combines the two country lists
		list = list.split(",") //Creates an array of the new country list
		list = list.sort() //Sorts the new country array.
	
		for(i=1;i<list.length;i++)//Check for duplicates and drops them
		{
			if(list[i]==list[i-1]){continue} // Eliminates duplicate entries.
			count++	
		}
		return count
	}	
	
	function create_countries()
	{
		prayer.sort(compare_country)
		countries = new Array
		for(i=0;i<prayer.length;i++)
		{
			countries[i] = test_region(prayer[i].country)
		}
		newlist = unescape(countries.join(","))
		return newlist
	}
	
	var howmany=0
	function DH_count()
	{
		for(var i=0;i<prayer.length;i++)
		{
			if(prayer[i].request==0){continue}
			howmany++
		}
		howmany = howmany + 479// constant from first 500 requests for help.
	return howmany
	}		
	// end hide -->
