function setHeader(totalHeaders,nextheader) {
setTimeout('showNextSlide(\'headerImage\',\'' + nextheader + '\',\'' + totalHeaders + '\')',6000);
}
function showNextSlide(theDiv,theSlide,slideTotal) {
	theSlide = 1*theSlide + 1;
	if(theSlide > slideTotal) { theSlide = 0;}
	document.getElementById(theDiv).style.backgroundImage = "url(/media/headers/"+ pageHeader[theSlide]+ ")";
	setTimeout('showNextSlide(\'' + theDiv + '\',\'' + theSlide  + '\',\'' + slideTotal + '\')',6000);

}
function liveNavLink(theButton) {
document.getElementById(theButton).style.backgroundImage = "url('./media/template/arrow_down.gif')";
}
function hideMe(thediv) {
document.getElementById(thediv).style.display="none";
}
function noNavLink(theButton) {
document.getElementById(theButton).style.backgroundImage = "url('./media/template/arrow_blank.gif')";
}

function addnew(mybookref,cdeposit) {
document.getElementById('addnew').style.display="block";
document.getElementById('addnewframe').src = './pages/addnew.php?bookref=' + mybookref + '&cdep=' + cdeposit;
}

function gotoDep(mycount,bookref,cdeposit) {
mypeople = document.getElementById('newpeople').innerHTML;
// alert('Trying to move: ' + mypeople);
parent.setpeople(mypeople,mycount,bookref,cdeposit);
}

function slideInDiv(theDiv) {
	document.getElementById(theDiv).style.display = "Block";
	}
function slideOutDiv(theDiv) {
	document.getElementById(theDiv).style.display = "none";
	}

function setpeople(mypeople,mycount,mybookref,cdeposit) {
var totalpeople = parseInt(mycount) + 1;
var persondeposit = parseInt(cdeposit);
var totaldep = totalpeople * persondeposit;
document.getElementById('otherpeople').innerHTML = mypeople;
document.getElementById('addnew').style.display="none";
document.getElementById('addnewframe').src = './pages/addnew.php?bookref=' + mybookref;
document.getElementById('fulldeposit').innerHTML= totaldep;
document.paydeposit.amount_1.value=totaldep;
// amount_1
// alert('going to update: bookref=' + mybookref);
updatePeople('bookref=' + mybookref);
}

function updatePeople(nameValue){
var xmlHttp=null;
try{
xmlHttp=new XMLHttpRequest();
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!");
return false;
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
if (xmlHttp.status==200){
//this will be called after update
doSomethingAfterUpdate(xmlHttp.responseText);
}
}
}
//this will send the data to server to be updated
xmlHttp.open("GET", './includes/getpeople.php?'+ nameValue, true);
xmlHttp.send(null);
}

function doSomethingAfterUpdate(retValFromPHP){
//retValFromPHP can be any thing you want!
// alert(retValFromPHP + ' was returned.');
document.getElementById('otherpeople').innerHTML = retValFromPHP;
}