function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


				
				
				
				var childText = new Array(
										  "In <b>Angola</b>, where the under-five mortality rate is the second highest in the world, the Ministry of Health has identified an essential package of child and maternal health care services to be delivered through three main channels: the fixed network of public health services, outreach and mobile services, and community-based activities. <br><br/><a href=\"profiles/1_angola.php\">Making children the &#8220;absolute priority&#8221; in Angola &gt;&gt;</a>",
										  "In <b>Benin</b>, the president announced in early 2007 the abolition of all user fees for health services provided to pregnant women and to children under age five. National health and financial specialists worked with UNICEF, the World Bank, the United Nations Population Fund and the World Health Organization to refashion the state budget to reflect this new reality. Both domestic and foreign assistance funds were shifted to cover shortfalls the change engendered. As a result, the poverty reduction strategy for Benin, particularly as it relates to maternal and neonatal health and child survival, is much more child friendly – and more likely to help the country reach the MDGs. <br><br/><a href=\"profiles/2_benin.php\">Improving and harmonizing national health plans  &gt;&gt;</a>",
										  
										  "<b>Eritrea</b> is one of the few countries in sub-Saharan Africa currently on track to meet Millennium Development Goal 4. Its under-five mortality rate fell by roughly 50 per cent between 1990 and 2006. Eritrea is polio free, maternal and neonatal tetanus have been eliminated, and there have been no measles deaths in the past two years. There has also been a sharp reduction in malaria morbidity and mortality. <br><br/><a href=\"profiles/3_eritrea.php\">Eritrea finds ways to reach the goal  &gt;&gt;</a>",
										  
										  "In 2007, <b>Ghana</b> launched a High Impact Rapid Delivery strategy for health care that has generated impressive results. All pregnant women have been reached by basic intervention actions, vitamin A supplementation reaches all children aged 6 to 59 months, and polio vaccination coverage is universal. No measles deaths have been recorded since 2004, and more than half of Ghana’s children and pregnant women now sleep under insecticide-treated mosquito nets. <br><br/><a href=\"profiles/4_ghana.php\">Expanding immunization services and saving children&#8217;s lives &gt;&gt;</a> ",
										  "In <b>Kenya</b>, more than 10 million insecticide-treated mosquito nets have been distributed since 2003 through integrated child and maternal health services that include immunization and antenatal care. This increased distribution resulted in 67 per cent of children younger than five sleeping under an insecticide-treated net. <br><br/><a href=\"profiles/5_kenya.php\">A campaign against malaria  &gt;&gt;</a>",
										  "Although child mortality in <b>Malawi</b> remains high by global standards, the country has made significant progress in reducing child deaths. From 1990 to 2006, the under-five mortality rate fell by 46 per cent, from 221 to 120 per 1,000 live births. This follows sharp improvements in immunization coverage, micronutrient supplementation, exclusive breastfeeding for children up to six months of age, safe drinking water, the use of insecticide-treated mosquito nets, and the expansion of high impact health interventions. <br><br/><a href=\"profiles/6_malawi.php\">One country and its progress in child survival  &gt;&gt;</a>",
										  "In <b>Niger</b>, 56 per cent of the population lives more than five kilometers from a health facility. To increase child survival by bringing health care closer to underserved rural communities, in 2000 the Government began implementing a strategy to use funds from a debt reduction programme to finance the construction of 2,000 community health posts. Trained community health workers offer a minimum package of curative and preventive interventions at these posts and promote disease prevention. The Government’s recent decision to make health care available free to children under five is another promising move. <br><br/><a href=\"profiles/7_niger.php\">Community care boosts child survival in Niger &gt;&gt;</a>",
										  "In <b>Sierra Leone</b>, United Nations agencies, including UNICEF, have developed a joint programme to support a government plan to address the devastatingly high under-five and maternal mortality rates – the highest in the world. The programme covers emergency obstetric care, immunization, and prevention and management of undernutrition. The overall aim is to reduce the 2005 rates of maternal, under-five and infant mortality by 30 per cent by 2010.  <br><br/><a href=\"profiles/8_sierraleone.php\">A unified plan gives hope of reducing maternal and child deaths from the world’s highest rates &gt;&gt;</a>"
	
);
var videoLink = new Array(
	"profiles/1_angola.php",
	"profiles/2_benin.php",
	"profiles/3_eritrea.php",
	"profiles/4_ghana.php",
	"profiles/5_kenya.php",
	"profiles/6_malawi.php",
	"profiles/7_niger.php",
	"profiles/8_sierraleone.php"
	);

var profileNames = new Array(
	"<strong>Angola</strong>",
	"<strong>Benin</strong>",
	"<strong>Eritrea</strong>",
	"<strong>Ghana</strong>",
	"<strong>Kenya</strong>",
	"<strong>Malawi</strong>",
	"<strong>Niger</strong>",
	"<strong>Sierra Leone</strong>"
);

function homePageFlip(num) {
	document.getElementById('profilename').innerHTML = profileNames[num - 1];
	document.getElementById('feature').src = "images/profile" + num + ".jpg";
	document.getElementById('child_text').innerHTML = childText[num - 1];
	document.getElementById('featureimglink').href = videoLink[num - 1];
	document.getElementById('viewvideolink').href = videoLink[num - 1];
	document.getElementById('profile' + num).className = "on";
}

function change(num) {
	document.getElementById('profilename').innerHTML = profileNames[num - 1];
	document.getElementById('feature').src = "images/profile" + num + ".jpg";
	document.getElementById('child_text').innerHTML = childText[num - 1];
	document.getElementById('featureimglink').href = videoLink[num - 1];
	document.getElementById('viewvideolink').href = videoLink[num - 1];
	clearHighlights();
	document.getElementById('profile' + num).className = "on";
}

function clearHighlights() {
	for (i=1; i<=8; i++) {
		document.getElementById('profile' + i).className = "";
	}
}

function showName(num) {
	document.getElementById('profilename').innerHTML = profileNames[num - 1];
}

function revertName() {
	document.getElementById('profilename').innerHTML = profileNameOrig;
}

function switchPage() {
	var val = document.chapters.chapter_select.options[document.chapters.chapter_select.selectedIndex].value;
	if (val != "") {
		location.href = val;
	}
}

var newWin = null;
function popUp(strURL, strType, strWidth, strHeight) {  
 if (newWin != null && !newWin.closed)    
  newWin.close();  
 var strOptions="";  
 
 if (strType=="fixednooptions")    
  strOptions="height="+strHeight+",width="+strWidth; 
	 newWin = window.open(strURL, 'newWin', strOptions);  
 newWin.focus();
}

// ---------------------------------------------------------------------
//                  function.apply (if unsupported)
// ---------------------------------------------------------------------
if (!Function.prototype.apply) {
  Function.prototype.apply = function(oScope, args) {
    var sarg = [];
    var rtrn, call;
    if (!oScope) oScope = window;
    if (!args) args = [];
    for (var i = 0; i < args.length; i++) {
      sarg[i] = "args["+i+"]";
    };
    call = "oScope.__applyTemp__(" + sarg.join(",") + ");";
    oScope.__applyTemp__ = this;
    rtrn = eval(call);
    oScope.__applyTemp__ = null;
 return rtrn;
  };
};

// ---------------------------------------------------------------------
//                             addClass()
//                 appends the specified class to the object
// ---------------------------------------------------------------------
function addClass(theClass) {
  if (this.className != '') {
    this.className += ' ' + theClass;
  } else {
    this.className = theClass;
  }
}
Object.prototype.addClass = addClass;

// ---------------------------------------------------------------------
//                               inArray()
//                           [Port from PHP]
//               Hunts for a value in the specified array
// ---------------------------------------------------------------------
function inArray(needle) {
  for (var i=0; i < this.length; i++) {
    if (this[i] === needle) {
      return i;
    }
  }
  return false;
}
Array.prototype.inArray = inArray;

/*------------------------------------------------------------------------------
Function:       footnoteLinks()
------------------------------------------------------------------------------*/
function footnoteLinks(containerID,targetID) {

   if (!document.getElementById || 
      !document.getElementsByTagName ||
      !document.createElement) return false;
  if (!document.getElementById(containerID)|| !document.getElementById(targetID)) return false;

document.getElementById('tagline').firstChild.src = "../soac08/images/header_tagline_print_eng.gif";
document.getElementById('logo').firstChild.src = "../soac08/images/header_logo_print_eng.gif";

var container = document.getElementById(containerID);
var target    = document.getElementById(targetID);
var h2        = document.createElement('h2');
addClass.apply(h2,['printOnly']);
var h2_txt    = document.createTextNode('Links');
h2.appendChild(h2_txt);
var coll = container.getElementsByTagName('A');
var ol   = document.createElement('ol');
addClass.apply(ol,['printOnly']);
var myArr = [];
var thisLink;
var num = 1;
for (var i=0; i<coll.length; i++) {
    var thisClass = coll[i].className;
    if ( (coll[i].getAttribute('href') ||
          coll[i].getAttribute('cite'))  && coll[i].getAttribute('href').indexOf("mailto") == -1 &&
          (thisClass == '' ||
           thisClass.indexOf('ignore') == -1) || thisClass == ('mailto')) { 
      thisLink = coll[i].getAttribute('href') ? coll[i].href : coll[i].cite;
   coll[i].innerHTML = coll[i].innerHTML + "&nbsp;";
      var note = document.createElement('sup');
      addClass.apply(note,['printOnly']);
      var note_txt;
      var j = inArray.apply(myArr,[thisLink]);
      if ( j || j===0 ) {
        note_txt = document.createTextNode(j+1);
      } else {
        var li     = document.createElement('li');
        var li_txt = document.createTextNode(thisLink);
        li.appendChild(li_txt);
        ol.appendChild(li);
        myArr.push(thisLink);
        note_txt = document.createTextNode(num);
        num++;
      }
      note.appendChild(note_txt);
      if (coll[i].tagName.toLowerCase() == 'blockquote') {
        var lastChild = lastChildContainingText.apply(coll[i]);
        lastChild.appendChild(note);
      } else {
        coll[i].parentNode.insertBefore(note, coll[i].nextSibling);
      }
    }
  }
  target.appendChild(h2);
  target.appendChild(ol);
  addClass.apply(document.getElementsByTagName('html')[0],['noted']);
  return true;
}
