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(
	"By teaming up with other girls in her community to help raise hygiene awareness and fight diseases, 17-year-old Doly has also been able to empower girls her age and challenge traditional practices like early marriage and dowry demands.<br /><br /><a href=\"profiles/1_doly.php\">Find out more about Doly &gt;&gt;<br /><br /><a href=\"profiles/empowerment_household.php\">Learn more about empowering women in the household &gt;&gt;</a><br /><br />",
	"After her son died due to AIDS at the age of three, Alaíde started a non-governmental organization offering support and assistance to families and children living with HIV/AIDS. Viva Rachid has been a catalyst for change and a role model for other NGOs across Brazil.<br /><br /><a href=\"profiles/2_alaide.php\">Find out more about Alaíde &gt;&gt;<br /><br /><a href=\"profiles/empowerment_politics.php\">Learn more about how women’s groups can be powerful catalysts for change in favour of women and children &gt;&gt;</a><br />",
	"Fatna is a young Sudanese girl from Darfur who has had to flee her village and seek refuge in a camp in eastern Chad after Janjaweed militias attacked her community and killed her sister. Despite the challenging conditions at the camp, Fatna is determined to continue her education to secure a better future for herself and her family.<br /><br /><a href=\"profiles/3_fatna.php\">Find out more about Fatna &gt;&gt;<br /><br /><a href=\"profiles/inequality_household.php\">Learn more about inequality in the household &gt;&gt;</a><br />",
	"At 13, Mulu Melka has already escaped abduction and a forced marriage. Education has helped her challenge the conservative attitudes of her traditional rural community and saved her from marrying an HIV-infected older man.<br /><br /><a href=\"profiles/4_mulu.php\">Find out more about Mulu &gt;&gt;<br /><br /><a href=\"profiles/double_dividend.php\">Learn more about education and the double dividend of gender equality &gt;&gt;</a><br />",
	"After the December 2004 tsunami killed her mother and two of her siblings and destroyed her living, Ena made a new life for herself and her family by starting a small business.<br /><br /><a href=\"profiles/5_ena.php\">Find out more about Ena &gt;&gt;<br /><br /><a href=\"profiles/inequality_employment.php\">Learn more about inequality in employment &gt;&gt;</a><br /><br /><br />",
	"A specialist in women’s affairs at the Ministry of Interior, Zahra has been working to support women’s groups and facilitate their social and economic development.<br /><br /><a href=\"profiles/6_zahra.php\">Find out more about Zahra &gt;&gt;<br /><br /><a href=\"profiles/inequality_politics.php\">Learn more about inequality in politics &gt;&gt;</a><br /><br /><br />",
	"Coco is one of the more than 1 million children trafficked worldwide every year. She was driven by poverty to leave her country in search of a job and a better life, but found herself forced into prostitution.<br /><br /><a href=\"profiles/7_coco.php\">Find out more about Coco &gt;&gt;<br /><br /><a href=\"profiles/equality.php\">Learn more about the need for gender equality &gt;&gt;</a><br /><br /><br />",
	"Like millions of women around the world, from the moment her day begins, Marisa starts juggling the competing and sometimes conflicting worlds of work and motherhood.<br /><br /><a href=\"profiles/8_marisa.php\">Find out more about Marisa &gt;&gt;<br /><br /><a href=\"profiles/empowerment_workplace.php\">Learn more about empowerment in the workplace &gt;&gt;</a><br /><br /><br />"	
	
);
var videoLink = new Array(
	"profiles/1_doly.php",
	"profiles/2_alaide.php",
	"profiles/3_fatna.php",
	"profiles/4_mulu.php",
	"profiles/5_ena.php",
	"profiles/6_zahra.php",
	"profiles/7_coco.php",
	"profiles/8_marisa.php"
	);

var profileNames = new Array(
	"<strong>Doly</strong>, BANGLADESH",
	"<strong>Alaíde</strong>, BRAZIL",
	"<strong>Fatna</strong>, CHAD",
	"<strong>Mulu</strong>, ETHIOPIA",
	"<strong>Ena</strong>, INDONESIA",
	"<strong>Zahra</strong>, ISLAMIC REPUBLIC OF IRAN",
	"<strong>Coco</strong>, ROMANIA",
	"<strong>Marisa</strong>, USA"
);

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 = "/sowc07/images/header_tagline_print_eng.gif";
document.getElementById('logo').firstChild.src = "/sowc07/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;
}