function showAll() {
	Effect.BlindDown('causes_ul', 'blind');
	Effect.BlindDown('impacts_ul', 'blind');
	Effect.BlindDown('sol_ul', 'blind');
	Effect.BlindDown('inter_ul', 'blind');
	Effect.BlindDown('media_ul', 'blind');
}

function hideAll() {
	Effect.BlindUp('causes_ul', 'blind');
	Effect.BlindUp('impacts_ul', 'blind');
	Effect.BlindUp('sol_ul', 'blind');
	Effect.BlindUp('inter_ul', 'blind');
	Effect.BlindUp('media_ul', 'blind');
}


function dossierToggle(t) {
		if (t == "ins") {
			Effect.Fade('facts');
			Effect.Appear('ins');
			Effect.Fade('uses');
			Effect.Fade('response');
			Effect.Fade('sources');
			Effect.Fade('special1');
			document.getElementById('m_facts').className = "inactive";
			document.getElementById('m_ins').className = "active";
			document.getElementById('m_uses').className = "inactive";
			document.getElementById('m_response').className = "inactive";
			document.getElementById('m_sources').className = "inactive";
			document.getElementById('m_special1').className = "inactive";
		} else if (t == "facts") {
			Effect.Fade('ins');
			Effect.Appear('facts');
			Effect.Fade('uses');
			Effect.Fade('response');
			Effect.Fade('sources');
			Effect.Fade('special1');
			document.getElementById('m_facts').className = "active";
			document.getElementById('m_ins').className = "inactive";
			document.getElementById('m_uses').className = "inactive";
			document.getElementById('m_response').className = "inactive";
			document.getElementById('m_sources').className = "inactive";
			document.getElementById('m_special1').className = "inactive";
		} else if (t =="uses") {
			Effect.Fade('facts');
			Effect.Fade('ins');
			Effect.Appear('uses');
			Effect.Fade('response');
			Effect.Fade('sources');
			Effect.Fade('special1');
			document.getElementById('m_facts').className = "inactive";
			document.getElementById('m_ins').className = "inactive";
			document.getElementById('m_uses').className = "active";
			document.getElementById('m_response').className = "inactive";
			document.getElementById('m_sources').className = "inactive";
			document.getElementById('m_special1').className = "inactive";
		} else if (t == "response") {
			Effect.Fade('facts');
			Effect.Fade('ins');
			Effect.Fade('uses');
			Effect.Appear('response');
			Effect.Fade('sources');
			Effect.Fade('special1');
			document.getElementById('m_facts').className = "inactive";
			document.getElementById('m_ins').className = "inactive";
			document.getElementById('m_uses').className = "inactive";
			document.getElementById('m_response').className = "active";
			document.getElementById('m_sources').className = "inactive";
			document.getElementById('m_special1').className = "inactive";
		} else if (t == "sources") {
			Effect.Fade('facts');
			Effect.Fade('ins');
			Effect.Fade('uses');
			Effect.Fade('response');
			Effect.Appear('sources');
			Effect.Fade('special1');
			document.getElementById('m_facts').className = "inactive";
			document.getElementById('m_ins').className = "inactive";
			document.getElementById('m_uses').className = "inactive";
			document.getElementById('m_response').className = "inactive";
			document.getElementById('m_sources').className = "active";
			document.getElementById('m_special1').className = "inactive";
		} else if(t == "special1") {
			Effect.Fade('facts');
			Effect.Fade('ins');
			Effect.Fade('uses');
			Effect.Fade('response');
			Effect.Fade('sources');
			Effect.Appear('special1');
			document.getElementById('m_facts').className = "inactive";
			document.getElementById('m_ins').className = "inactive";
			document.getElementById('m_uses').className = "inactive";
			document.getElementById('m_response').className = "inactive";
			document.getElementById('m_sources').className = "inactive";
			document.getElementById('m_special1').className = "active";
		}
}

function mainToggle(t) {
	if(t == "c1") {
		Effect.Appear('c1');
		document.getElementById('c1tab').className = "active";
		Effect.Fade('c2');
		document.getElementById('c2tab').className = "inactive";
		Effect.Fade('c3');
		document.getElementById('c3tab').className = "inactive";
		Effect.Fade('c4');
		document.getElementById('c4tab').className = "inactive";
		Effect.Fade('c5');
		document.getElementById('c5tab').className = "inactive";
		Effect.Fade('c6');
		document.getElementById('c6tab').className = "inactive";
	} else if(t == "c2") {
		Effect.Fade('c1');
		document.getElementById('c1tab').className = "inactive";
		Effect.Appear('c2');
		document.getElementById('c2tab').className = "active";
		Effect.Fade('c3');
		document.getElementById('c3tab').className = "inactive";
		Effect.Fade('c4');
		document.getElementById('c4tab').className = "inactive";
		Effect.Fade('c5');
		document.getElementById('c5tab').className = "inactive";
		Effect.Fade('c6');
		document.getElementById('c6tab').className = "inactive";
	} else if(t == "c3") {
		Effect.Fade('c1');
		document.getElementById('c1tab').className = "inactive";
		Effect.Fade('c2');
		document.getElementById('c2tab').className = "inactive";
		Effect.Appear('c3');
		document.getElementById('c3tab').className = "active";
		Effect.Fade('c4');
		document.getElementById('c4tab').className = "inactive";
		Effect.Fade('c5');
		document.getElementById('c5tab').className = "inactive";
		Effect.Fade('c6');
		document.getElementById('c6tab').className = "inactive";
	} else if(t == "c4") {
		Effect.Fade('c1');
		document.getElementById('c1tab').className = "inactive";
		Effect.Fade('c2');
		document.getElementById('c2tab').className = "inactive";
		Effect.Fade('c3');
		document.getElementById('c3tab').className = "inactive";
		Effect.Appear('c4');
		document.getElementById('c4tab').className = "active";
		Effect.Fade('c5');
		document.getElementById('c5tab').className = "inactive";
		Effect.Fade('c6');
		document.getElementById('c6tab').className = "inactive";
	} else if(t == "c5") {
		Effect.Fade('c1');
		document.getElementById('c1tab').className = "inactive";
		Effect.Fade('c2');
		document.getElementById('c2tab').className = "inactive";
		Effect.Fade('c3');
		document.getElementById('c3tab').className = "inactive";
		Effect.Fade('c4');
		document.getElementById('c4tab').className = "inactive";
		Effect.Appear('c5');
		document.getElementById('c5tab').className = "active";
		Effect.Fade('c6');
		document.getElementById('c6tab').className = "inactive";
	}	else if(t == "c6") {
		Effect.Fade('c1');
		document.getElementById('c1tab').className = "inactive";
		Effect.Fade('c2');
		document.getElementById('c2tab').className = "inactive";
		Effect.Fade('c3');
		document.getElementById('c3tab').className = "inactive";
		Effect.Fade('c4');
		document.getElementById('c4tab').className = "inactive";
		Effect.Fade('c5');
		document.getElementById('c5tab').className = "inactive";
		Effect.Appear('c6');
		document.getElementById('c6tab').className = "active";
	}
}

function getQuote() {
	var quotes = new Array("<em>In Sudan we were distributed to men and I was given to a man who had just killed his woman. I was not given a gun but I helped in the abductions and grabbing of food from the villages. Girls who refused to become prostitutes were killed in front of us.</em> - age 15, Sudan", "<em>It was very bad. They put all the 15 and 16 year olds in the front line while the army retreated. I was with 40 other kids. My friends were lying around me like stones. I was fighting for 24 hours. When I saw only three of my friends were alive, I ran back.</em> - age 17, recruit at 14, Ethopia", "<em>I was so afraid of dying. But my friends warned me if the rebel commanders detected any fear in me they would kill me. So I had to pretend to be brave.</em> - age 12, Rwanda", "<em>I joined the army when I was young (at 15) without thinking much. I admired soldiers, their guns and crisp, neat uniforms. I just wanted to fight the way they did in the movies and so I joined the army.</em> - Burma", "<em>They came to collect and my father said he didnt have the money. They asked me to go with them. My father said no. They took me anyway.</em> - Colombia", "<em>One day some men who rule [where I lived] arrived and told me I had to fight against bureaucracy! I dont know what bureaucracy is, and in three days they taught me how to handle weapons.</em> - age 13, Colombia", '<em>I heard someone say, "Theyre coming, its the Ninjas!" I went out and saw young men, not more than 14 or 15 years old, all wearing black shorts, bodies covered with charcoal, a gun in one hand, the bible in the other.</em> - Congo', "<em>My job is to burn buildings. Sometimes the Whites shoot at me, but they never hit. I go very fast behind the walls, running.</em> - age 16, Indonesia", "<em>Some of us said we didn't want to join them, but they started to hit us with a gun. Most of them were very, very, very bad people.</em> - age 13, Liberia", "<em>They would shoot people between the legs, just to scare them. I didn't do that type of thing. I was a good guy in the faction. I was a bodyguard to one of the generals. I was scared initially, but then I lost my fear. I fought for two years, and then I managed to escape.</em> - age 13, Liberia", "<em>I became a combatant in 1991 when I was 8 years old. I became a fighter because I felt that my friends and my parents were suffering. I joined a faction and served as a bodyguard to one of the chiefs of staff. I used an AK-47. It wasn't too heavy. I used it often, but I never killed civilians. I was often really afraid.</em> - age 14, Liberia", "<em>Sometimes I fell asleep when I was on guard duty, I was beaten by my corporal. He beat me like a dog, like I was an animal, not a human being.</em> - Myanmar", "<em>We were all ten, twelve, thirteen years old and older. Then we were sent to Camp Vert in Moba and trained there. Lots were killed in the training. Lots died of sickness. The food was poorly prepared and many got dysentery.</em> - age 13, Rwanda", "<em>I had to go through the training and learn to fight, otherwise the RUF people would beat me or kill me.</em> - age 10, Sierra Leone", "<em>I did not want to go; I was forced to go. They killed a lot of women who refused to go with them, when they capture young girls, you belong to the soldier who captured you.</em> - age 14, Sierra Leone", "<em>I killed another child. I did this three times. I felt bad but I knew what would happen if I disobeyed. Now I see dead people and blood in my dreams and I know the spirits of the children are coming to haunt me.</em> - age 12, Uganda", "<em>At the camp we were trained to use guns. Those who disobeyed had their ears and fingers cut off. I didnt want to participate in the killing, but they threatened to shoot me if I refused to do it.</em> age 14, Uganda", "<em>They gave me pills that made me crazy. When the craziness got in my head, I beat people on their heads and hurt them until they bled. When the craziness got out of my head I felt guilty. If I remembered the person I went to them and apologized. If they did not accept my apology, I felt bad.</em> - 13, Liberia"); 
	var pos = Math.floor(Math.random()*quotes.length);
	var flag = Math.ceil(Math.random()*18);
document.getElementById("testimony").innerHTML = '<span id="quotebox"><strong>Real testimony</strong><a onclick="getQuote();" id="newquote">(new)</a></span><p id="quote" style="background:url(images/'+flag+'.gif) no-repeat bottom;"><em><span style="background-color:#f0f0f0;display:block;margin-right:0;margin-bottom:10px;padding:0 5px 0 5px;">'+quotes[pos]+'</span></em></p>';
	var doss = document.title;
	if(doss.match(" - Country dossiers - ") != null) {
		document.getElementById("testimony").innerHTML = '<span id="quotebox"><strong>Real testimony</strong><a onclick="getQuote();" id="newquote">(new)</a></span><p id="quote" style="background:url(../images/'+flag+'.gif) no-repeat bottom;"><em><span style="background-color:#f0f0f0;display:block;margin-right:0;margin-bottom:14px;padding:0 5px 0 5px;">'+quotes[pos]+'</span></em></p>';
	}
}

function getFact() {
	var facts = new Array("There are an estimated 300,000 child soldiers currently taking part in warfare.", "According to recent studies, one or both sides of 33 conflicts around the world are using child soldiers in their day-to-day battles.", "The reason child soldiers fail to resist recruitment is because of their immaturity and ability to be manipulated.", "The development of lightweight military technology and easily accessible weaponry has contributed to the growing use of child soldiers.", "Children who are displaced from their family and home, reside in zones of civil strife, poor, or uneducated are most likely to become child soldiers because of their emotional weakness and instability.", "Child soldiers enlist in armed forces generally because of one of three reasons: social or economic pressure, a false sense of protection, or forced recruitment and abduction by such armed groups.", "Contrary to common knowledge, girls make up a great portion of the number of child soldiers.  Girls usually serve the purpose of toys and wives.", "Child soldiers are usually cooks, guards, spies, messengers, or human mine detectors.  Many child soldiers are used on suicide missions into the front lines.", "In order to ensure the reliability and effectiveness of child soldiers, they are usually forced to murder their family or neighbors.", "Because of the inadequate provisions made to rehabilitate child soldiers, they usually end up back in armed conflicts or as criminals in the street.", "Child soldiers of all ages are sexually abused, giving them a much higher risk of pregnancy and contracting sexually transmitted diseases.", "Child soldiers usually receive no formal training before being thrown into active frontlines.", "When not involved in active combat, child soldiers usually man security checkpoints.", "Many younger child soldiers collapse because of the intense pressure and load of their day-to-day tasks.", "Combat has many negative psychological effects on child soldiers.  In a report from Algeria, a 12 year-old boy was found playing with the head of 15-year-old girl he had just killed.", "Every year on February 12th, Red Hand Day is held in order to recognize the disastrous use of child soldiers.");
	var pos = Math.floor(Math.random()*facts.length);
	document.getElementById("factoid").innerHTML = facts[pos]+"<br />";
}

function getNews() {
	var news = new Array("On February 12, 2007, CNN reporter Jeff Koinange <a href='http://www.cnn.com/2007/WORLD/africa/02/12/btsc.koinange.childsoldiers/index.html' onclick='window.open(this.href); return false;'>reflected</a> on his first encounter with child soldiers in Sierra Leone, where he lost a journalist friend in 1999. This news story provides a first-hand tale of how horrifying an encounter with child soldiers can be.", 'On March 20, 2007, CNN wrote a <a href="http://www.cnn.com/2007/WORLD/meast/03/19/iraq.children/index.html" onclick="window.open(this.href); return false;">story on children in war-torn Iraq</a>. Included in this story are interviews with Iraqi doctors who explain the psychological effects of war on children.', 'The January 22, 2007, issue of Newsweek magazine had a cover story entitled <em><a href="http://www.msnbc.msn.com/id/16610767/site/newsweek/" onclick="window.open(this.href); return false;">Iraq&#8217;s Young Blood</a></em> that explores the fact that more and more Iraqi children are turning towards warfare and joining military groups in their country.', 'In January 2007, Ishmael Beah released a book, <em>A Long Way Gone</em>, documenting his former life as a child soldier. He wrote an <a href="http://www.nytimes.com/2007/01/14/magazine/14soldier.t.html?ex=1326430800&amp;en=18db63da3854259e&amp;ei=5088&amp;partner=rssnyt&amp;emc=rss" onclick="window.open(this.href); return false;">article</a> in the New York Times to coincide with the release of his book.', 'Ishael Beah, a former child soldier and author of <em>A Long Way Gone: Memoirs of a Boy Soldier</em>, recently appeared on "The Daily Show with Jon Stewart" in an <a href="http://www.comedycentral.com/sitewide/media_player/play.jhtml?itemId=82274">interview</a> where he discussed his journey and recovery.', 'In Liberia, <a href="http://www.unicef.org/infobycountry/liberia_27400.html" onclick="window.open(this.href); return false;">UNICEF reports</a> that former child soldiers have formed sports teams and have started a life after being soldiers, proving that current demobilization efforts are indeed worthwhile.', 'On November 9, 2006, Newsweek <a href="http://www.msnbc.msn.com/id/15642006/site/newsweek/" onclick="window.open(this.href); return false;">reported</a> on the first time a child soldier case was to be brought before the International Criminal Court. On January 29, 2007, the court <a href="http://news.bbc.co.uk/2/hi/africa/6308963.stm" onclick="window.open(this.href); return false;">concluded</a> that there was enough evidence to conduct a trial.', 'On November 13, 2006, a U.N. representative <a href="http://www.signonsandiego.com/news/world/20061113-1232-srilanka-childsoldiers.html" onclick="window.open(this.href); return false;">accused</a> Sri Lanka&#8217;s government of helping an armed military group recruit child soldiers to fight a rebel force in Sri Lanka.', 'On January 15, 2007, the UNICEF representative to Somalia <a href="http://www.foxnews.com/wires/2007Jan15/0,4670,SomaliaChildSoldiers,00.html" onclick="window.open(this.href); return false;">accused</a> the government and militia groups in the country of recruiting child soldiers.', 'The International Herald Tribune <a href="http://www.iht.com/articles/ap/2007/01/12/africa/AF-GEN-Somalia-Child-Soldiers.php" onclick="window.open(this.href); return false;">documented</a> the stories of some child soldiers in Somalia recently on January 12, 2007.');
	var pos = Math.floor(Math.random()*news.length);
	document.getElementById("newstoid").innerHTML = news[pos]+"<br />";
}

function getQuiz() {
	var quests = new Array('<p class="q">How many child soldiers are there in the world today?</p><p><input type="radio" name="a" value="a1" />50,000<br /><input type="radio" name="a" value="a2" />100,000<br /><input type="radio" name="a" value="a3" />300,000<br /><input type="radio" name="a" value="a4" />600,000<br /><input type="hidden" name="q1" value="q1" />', '<p class="q">About what percentage of child soldiers are female?</p><p><input type="radio" name="a" value="a1" />10%<br /><input type="radio" name="a" value="a2" />20%<br /><input type="radio" name="a" value="a3" />30%<br /><input type="radio" name="a" value="a4" />40%<br /><input type="hidden" name="q2" value="q2" />', '<p class="q">Which country has the most child soldiers?</p><p><input type="radio" name="a" value="a1" />Myanmar<br /><input type="radio" name="a" value="a2" />Seirra Leone<br /><input type="radio" name="a" value="a3" />Iraq<br /><input type="radio" name="a" value="a4" />Colombia<br /><input type="hidden" name="q3" value="q3" />', '<p class="q">The oldest a child can be to qualify as a "child soldier" is...</p><p><input type="radio" name="a" value="a1" />15<br /><input type="radio" name="a" value="a2" />16<br /><input type="radio" name="a" value="a3" />17<br /><input type="radio" name="a" value="a4" />18<br /><input type="hidden" name="q4" value="q4" />', '<p class="q">Which of the following is found in <em>nearly every</em> nation with child soldiers?</p><p><input type="radio" name="a" value="a1" />Corrupt government<br /><input type="radio" name="a" value="a2" />Civil strife<br /><input type="radio" name="a" value="a3" />Uneven socio-economic classes<br /><input type="radio" name="a" value="a4" />Lack of proper military<br /><input type="hidden" name="q5" value="q5" />', '<p class="q">Which of the following is the most prominent psychological impact on child soldiers?</p><p><input type="radio" name="a" value="a1" />Depression<br /><input type="radio" name="a" value="a2" />Eating disorder<br /><input type="radio" name="a" value="a3" />Tuberculosis<br /><input type="radio" name="a" value="a4" />Post-Traumatic Stress Disorder<br /><input type="hidden" name="q6" value="q6" />', '<p class="q">A psychological disorder that occurs after a sudden change from normal life to the life of a child soldier is...</p><p><input type="radio" name="a" value="a1" />Adjustment disorder<br /><input type="radio" name="a" value="a2" />Depression<br /><input type="radio" name="a" value="a3" />Post-Traumatic Stress Disorder<br /><input type="radio" name="a" value="a4" />Personality disorder<br /><input type="hidden" name="q7" value="q7" />', '<p class="q">What kills more child soldiers: malnutrition or actual warfare?</p><p><input type="radio" name="a" value="a1" />Malnutrition<br /><input type="radio" name="a" value="a2" />Actual warfare<br /><input type="radio" name="a" value="a3" />They are equal<br /><input type="radio" name="a" value="a4" />Warfare, slightly<br /><input type="hidden" name="q8" value="q8" />', '<p class="q">What is the first step <em>anyone</em> can take to help stop the use of child soldiers?</p><p><input type="radio" name="a" value="a1" />Send UN aid<br /><input type="radio" name="a" value="a2" />Raise awareness<br /><input type="radio" name="a" value="a3" />Rescue operations<br /><input type="radio" name="a" value="a4" />Eradicate factions<br /><input type="hidden" name="q9" value="q9" />', '<p class="q">In the past 20 years, about how many children have died as a result of factional warfare?</p><p><input type="radio" name="a" value="a1" />Indeterminable<br /><input type="radio" name="a" value="a2" />About 500,000<br /><input type="radio" name="a" value="a3" />About 1,000,000<br /><input type="radio" name="a" value="a4" />About 2,000,000<br /><input type="hidden" name="q10" value="q10" />');
	var pos = Math.floor(Math.random()*quests.length);
	document.getElementById("sidequiz").innerHTML = '<form action="side_know_results.html" method="get">'+quests[pos]+'<br /><input type="submit" value="Submit" /></p></form>';
	var doss = document.title;
	if(doss.match(" - Country dossiers - ") != null) {
		document.getElementById("sidequiz").innerHTML = '<form action="../side_know_results.html" method="get">'+quests[pos]+'<br /><input type="submit" value="Submit" /></p></form>';
	}
}

function getSub() {
	var sub = window.location.search.substring(1);
	if(sub == "c2") {
		mainToggle("c2");
	} else if(sub == "c3") {
		mainToggle("c3");
	} else if(sub == "c4") {
		mainToggle("c4");
	} 	else if(sub == "c5") {
		mainToggle("c5");
	} else if(sub == "c6") {
		mainToggle("c6");
	} else { 
		return null;
	}
}

/* used with permission from activsoftware */

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function grow(pic) {
	document.getElementById(pic).style.width = "115px";
	document.getElementById(pic).style.height = "115px";
	document.getElementById(pic).style.margin = "-10px 0px -10px 0px";
}
function shrink(pic) {
	document.getElementById(pic).style.width = "100px";
	document.getElementById(pic).style.height = "100px";
	document.getElementById(pic).style.margin = "0px 0px 0px 0px";
}

window.onload = function() {
	getQuote();
	getFact();
	getNews();
	getQuiz();
	getSub();
	var ord = readCookie("override");
	if(ord == null || ord == false) {
		var w = document.documentElement.clientWidth;
		if(w < 975) {
			window.location = "text/index.html";
		}
	}
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
	if(cookie == "null") {
		setActiveStyleSheet("default");
	} else {
		setActiveStyleSheet(title);
	}
}

window.onunload = function() {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

/* style sheet switcher used with permission from ALA article: http://www.alistapart.com/articles/alternate/ */

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

