pages= new Array();

pages["search"] = "html";
pages[ "whatyoucando"] = "html";
pages[ "donation"] = "php";
pages[ "fundraising"] = "html";
pages[ "volunteer"] = "html";
pages[ "gifts"] = "php";
pages[ "church"] = "html";
pages[ "schools"] = "html";
pages[ "advocacy"] = "html";
pages[ "aboutus"] = "html";
pages[ "whatwedo"] = "php";
pages[ "goals06"] = "html";
pages[ "team"] = "html";
pages[ "downloads"] = "html";
pages[ "annualreport"] = "html";
pages[ "whatwedo"] = "php";
pages[ "food"] = "php";
pages[ "income"] = "php";
pages[ "water"] = "php";
pages[ "wherewework"] = "php";
pages[ "howwework"] = "php";
pages[ "zambia"] = "php";
pages[ "malawi"] = "php";
pages[ "ghanatogo"] = "php";
pages[ "freddy"] = "html";
pages[ "news"] = "php";
pages[ "archive"] = "php";
pages[ "newsletter"] = "php";
pages[ "enews"] = "php";
pages[ "contact"] = "php";
pages[ "links"] = "html";
pages["basket"]="php";

var statements = new Array();
var INCOME = 0;
var FOOD = 1;
var WATER = 2;
statements[INCOME] = new Array(3);
statements[FOOD] = new Array(3);
statements[WATER] = new Array(3);

statements[INCOME][0] = "47.4% of people living in sub-Saharan Africa live on less than $1 (70p) per day (Source: World Development Indicators 2003";
statements[INCOME][1] = "Only 55% of children in Zambia are enrolled in school.  Lack of funds in the home is one of the main reasons for this. (Source: UNDP 2002)";
statements[INCOME][2] = "Half of sub-Saharan Africa's 600 million people live on about 65 cents a day - less than what a Westerner might spend on a cup of coffee. Source: Davan Maharaj - LA Times 2004)";
statements[FOOD][0] = "33% of people in sub-Saharan Africa are undernourished (source: World Development Indicators 2000,2003)";
statements[FOOD][1] ="Over 50% of the world's poor depend directly on agriculture for their livelihoods (Source: Hanmer and Naschold (2000))";
statements[FOOD][2] ="25% of children under the age of five in Ghana are under-weight for their age (Source: UNDP 2002)";
statements[WATER][0] = "At only 57%, the percentage of people with access to improved drinking water in sub-Saharan Africa is the lowest in the world. (Source: UNICEF 2002)";
statements[WATER][1] ="43% of Malawi's population do not have access to a safe water source. (Source: UNDP 2000)";
statements[WATER][2] ="66% of Togo's population do not have access to improved sanitation. (Source: UNDP 2000) ";



var d=document; 
var frame=20; // how many frames to fade over
var redhex=255;
var greenhex=102; // Initial color value.
var faderrate=100;
var faderamountred=9;
var faderamountgreen=4;

var framestate=43; // how many frames to fade over
var statehex=255;
var greenstatehex=255;
var staterate = 200;
var stateamount=6;
var greenstateamount=4;
var statenow = 0;


function colorfade()
{
	if (frame>0)
	{
		redhex-=faderamountred;
		greenhex+=faderamountgreen;
		d.getElementById("fader").style.color="rgb("+redhex+","+greenhex+",0)";
	
		frame--;
		setTimeout("colorfade()",faderrate);
	}
	else
	{
		faderamountred = -faderamountred;
		faderamountgreen = -faderamountgreen;
		setTimeout("colorfade();",faderrate);
		frame = 20;
	}
}
function statefade(type)
{

	if (framestate>0)
	{
		greenstatehex-=greenstateamount;
		statehex-=stateamount;

		d.getElementById("state").style.color="rgb("+greenstatehex+","+greenstatehex+","+statehex+")";
		
		framestate--;
		setTimeout("statefade("+type+")",staterate);
	}
	else
	{
		statenow++;
		if (statenow == 3)
			statenow=0;
		framestate =43;
		greenstatehex = 255;
		statehex = 255;

		d.getElementById("state").style.color="rgb(255,255,255)";
		d.getElementById("state").innerHTML=statements[type][statenow];

		setTimeout("statefade("+type+");",staterate*4);
	}
}



function jump()
{
var page;
if (d.quick.search.value == "bridges")
	page = "http://www.shropshirebridges.org.uk";
else
{
	page = d.quick.search.value+"."+pages[d.quick.search.value];
}

window.location =  page;

}
function jumpsearch()
{
var page;
if (d.quick.search.value == "bridges")
	page = "http://www.shropshirebridges.org.uk";
else
{
	page = "http://www.harvesthelp.org/"+d.quick.search.value+"."+pages[d.quick.search.value];
}

window.location =  page;

}

function disp_news(item)
{
var page = "newsitem.php?id="+item;
window.open(page,"news", "height=500,width=700,toolbar=no,menubar=no,scrollbars=yes,top=20,left=20,resizable=yes");
return true;
}
function change_win(page)
{
self.opener.location=page;
self.close();
return true;
}
function download(type)
{
var page = "capturedown.php?materials=" + type;
	window.open( page,"download","width=500,height=500,scrollbars=yes");
	return true;
}
function strapline()
{
	setTimeout("colorfade();",faderrate);
}
function ChangeData(index,value,type)
{
		document.location = "basket.php?changetype="+type+"&item=" + index+"&value="+ value;
}

function openWind(file)
{
window.open(file,"popup", "height=310,width=550,toolbar=no,menubar=no,scrollbars=yes");
return true;
}
function CheckBoxes()
{
	if ((document.popup.messon.checked) || (document.popup.delon.checked))
		document.popup.action="delivery_new.php";
	else
		document.popup.action = "basket.php?added=1";
	document.popup.submit();
}
function validate_email(email) 
{ 

	ans = true;
	if(-1 == email.indexOf("@")) 
		ans = false;
	else if (-1 != email.indexOf(",")) 
		ans = false;
	else if (-1 != email.indexOf(";")) 
		ans = false;
	else if (-1 != email.indexOf("#"))
		ans = false;
	else if (-1 != email.indexOf("!")) 
		ans = false;
	else if (-1 != email.indexOf(" ")) 
		ans = false;
	else if (email.length == (email.indexOf("@")+1) ) 
		ans = false;
	return ans; 
} 
function validate_address(addr) 
{ 

	ans = true;
	if(-1 != addr.indexOf("'")) 
		ans = false;
	else if (-1 != addr.indexOf('"')) 
		ans = false;
	return ans; 
} 
