// window.onerror=null;



/***********************
 * All the pages in the Particle Adventure are maintained by this list of the page order
 * and nesting level information. 
 *
 * This script first defines a giant array pageList for keeping track of the pages,
 * then provides manipulator functions for dealing with this data.
 ***********************/

	/* The page desciription format is "SECTION:Short Name:URL relative to index.html"
	   SECTION  FORMAT: 
	   					# == Top page of a section
	   					#.1 == First page of section #
	   					#.2 == second page of section #
	   					#.2.1 == first page of subsection of #.2
	   					and so on. 
	   					
	   					It's OK if two sections like 1 and 1.1 map to the same page.
	  */

pageList = new Array (
		"0:Página Inicial:index.html",
		"1:O Que é Fundamental?:startstandard.html",
		"1.1:Questões Eternas:startstandard.html",
		"1.2:A Busca do que é Fundamental:fundamental.html",
		"1.3:O Átomo:atom_fund.html",
		"1.4:O Núcleo é Fundamental?:nucleus_fund.html",
		"1.5:Os Prótons e os Nêutrons são Fundamentais?:pn_fund.html",
		"1.6:A Escala do Átomo:scale.html",
		"1.7:O Que Estamos Procurando?:modern_physics.html",
		"1.8:O Modelo Padrão:standard_model.html",
		"1.8.1:Exercício sobre o Modelo Padrão:quiz_sm.html",
		"1.9:blank:blank.html",
		"2:Do que o Mundo é Feito?:quarks_leptons.html",
		"2.0:Quarks e Léptons:quarks_leptons.html",
		"2.1:Matéria e Antimatéria:antipreface.html",
		"2.2:O que é Antimatéria?:antimatter.html",
		"2.2.1:Carga e Momento:momentum.html",
		"2.3:Quarks:quarks.html",
		"2.3.1:Dando Nome aos Quarks:quarknaming.html",
		"2.3.2:A Descoberta do Quark Top:topquark.html",
		"2.3.2.1:Um Evento do Top:topevent.html",
		"2.3.3:O Modelo dos Corks (Rolhas):cork.html",
		"2.4:Hádrons, Bárions, Mésons:hadrons.html",
		"2.4.1:Massa dos Hádrons:hadron_mass.html",
		"2.5:Léptons:leptons.html",
		"2.6:Decaimento dos Léptons:lepton_decay.html",
		"2.6.1:Conservação do Tipo de Lépton:lepton_conservation.html",
		"2.6.1.1:Exercício sobre Decaimentos de Léptons:quiz_ld.html",
		"2.6.2:blank:blank.html",
		"2.8:Neutrinos:neutrinos.html",
		"2.9.1:Exercício sobre do que o Mundo é Feito:quiz_wp.html",
		"2.10:A Geração de Matéria:generations.html",
		"2.11:Resumo do Tópico Matéria:matter_summary.html",
		"3:O que o Mantém Unido?:4interactions.html",
		"3.1:As Quatro Interações:4interactions.html",
		"3.1.1:Força Versus Interação:force_interact.html",
		"3.2:Como a Matéria Interage?:interact.html",
		"3.3:O Efeito Invisível:unseen.html",
		"3.4:Eletromagnetismo:electromagnetism.html",
		"3.5:Força Residual E-M:residuale_m.html",
		"3.6:E sobre o Núcleo?:binding.html",
		"3.7:Forte:strong.html",
		"3.7.1:Carga de Cor:color.html",
		"3.7.2:Quarks Emitem Glúons:quarks_gluons.html",
		"3.7.3:Confinamento dos Quarks:quark_confinement.html",
		"3.8:Força Residual Forte:residualstrong.html",
		"3.9:Fraca:weak.html",
		"3.9.1:Sabor:flavor.html",
		"3.9.2:Eletrofraca:electroweak.html",
		"3.10:Gravidade:gravity.html",
		"3.11:Resumo sobre Interações:inter_summary.html",
		"3.11.1:Exercícios sobre Interações:quiz_in.html",
		"3.12:Mecânica Quântica:quantum_mech.html",
		"3.13:O Princípio da Exclusão de Pauli:pauli.html",
		"3.14:Férmions & Bósons:fermibos.html",
		"3.15:Muito para Lembrar:remember.html",
		"4:Decaimento de Partículas:decay_intro.html",
		"4.0:O que é Decaimento?:decay_intro.html",
		"4.1:Radioatividade:decay_start.html",
		"4.2:Partículas Radioativas:radio_part.html",
		"4.3:Confusões Sobre Decaimentos:unhappy.html",
		"4.4:Residual Forte:rope.html",
		"4.5:Mecânica Quântica:quantum.html",
		"4.6:Meia Vida:half_life.html",
		"4.7:Massa Perdida:mm.html",
		"4.8:Mediadores do Decaimento de Partículas:mediator.html",
		"4.8.1:Princípio da Incerteza:uncertainty.html",	
		"4.8.2:Partículas Virtuais:virtual.html",
		"4.9:Interações Diferentes:decay_dif.html",
		"4.10:Aniquilações:annih.html",
		"4.11:Exemplos de Decaimentos:all_decay.html",
		"4.11.1:Decaimento Beta do Nêutron:npe.html",
		"4.11.2:Aniquilação Elétron/Pósitron:eedd.html",
		"4.11.3:Produção do Top:top_pro.html",
		"4.11.4:Fotografia de uma Câmara de Bolhas:bubble.html",
		"4.12:blank:blank.html",
		"5:Mistérios Não Resolvidos:beyond_start.html",
		"5.1:Além do Modelo Padrão:beyond_start.html",
		"5.2:O Modelo Padrão e as Teorias:standard_modeling.html",
		"5.3:E sobre as Massas?:masses.html",
		"5.4:Teorias Unificadas:unified.html",
		"5.4.1:Mais sobre Teorias Unificadas:more_unified.html",
		"5.4.2:Grande Teoria Unificada:grand.html",
		"5.5:Teoria Unificada de Todas as Interações:utai.html",
		"5.6:Supersimetria:supersymmetry.html",
		"5.7:Teoria das Cordas:string.html",
		"5.8:Dimensões Extras:extra_dim.html",
		"5.9:Matéria Escura:dark.html",
		"6:Como Podemos Conhecer Algo sobre Isto?:exp_start.html",
		"6.1:Testando uma Teoria:exp_start.html",
		"6.2:Pesquisando a Estrutura do Átomo:atom_search.html",
		"6.3:O Resultado de Rutherford:rutherfords_result.html",
		"6.4:A Análise de Rutherford:rutherfords_analysis.html",
		"6.5:Como os Físicos Experimentam:how_to_exp.html",
		"6.6:Pesquisa sobre Desvios:deflected.html",
		"6.6.1:Respostas do Jogo do Alvo:target_revealed.html",
		"6.7:blank:blank.html",
		"7:Como Podemos Detectar o que Está Acontecendo?:detect_world.html",
		"7.1:Detectando o Mundo:detect_world.html",
		"7.2:Um Microscópio Melhor:better_micro.html",
		"7.2.1:Comprimento de Onda, a Caverna:cave.html",
		"7.2.2:Comprimento de Onda, a Moral:moral.html",
		"7.2.3:Explicações sobre Comprimento de Onda e Resolução:wave_res.html",
		"7.3:A Ferramenta dos Físicos, o Acelerador:tool.html",
		"7.3.1:Ondas e Partículas:waves.html",
		"7.4:A Régua do Mundo:meterstick.html",
		"7.5:Massa e Energia:mass_and_energy.html",
		"7.6:Conversão Energia-Massa:collision.html",
		"8:Como Fazemos Experimentos com Partículas Minúsculas?:accel.html",
		"8.1:Os Aceleradores:accel.html",
		"8.1.1:Como Obter Partículas para Acelerar:get_part.html",
		"8.2:Acelerando Partículas:accel_particles.html",
		"8.2.1:Animação de uma Aceleração de Partícula:accel_ani.html",
		"8.3:Projeto de um Acelerador:accel_design.html",
		"8.4:Experimentos de Alvo Fixo:fixed_target.html",
		"8.5:Experimentos de Feixes de Colisão:colliding_beam.html",
		"8.6:Um Acelerador Linear ou Circular?:lin_circ.html",
		"8.6.1:O que Faz as Partículas se Moverem em Círculos?:circle.html",
		"8.7:Vantagens do Projeto de um Acelerador:accel_adv.html",
		"8.8:Os Principais Aceleradores:variation.html",
		"8.8.1:O SLAC:slac.html",
		"8.8.1.1:A Fábrica de B's:b_factory.html",
		"8.8.1.2:O BaBar:babar.html",
		"8.8.2:O Fermilab:fermilab.html",
		"8.8.2.1:Ímãs Supercondutores:superconductor.html",
		"8.8.3:O CERN:cern.html",
		"8.8.3.1:O LHC e o LEP:lhclep.html",
		"8.8.4:O Brookhaven:brookhaven.html",
		"8.8.5:O CESR:cesr.html",
		"8.8.6:O DESY:desy.html",
		"8.8.7:O KEK:kek.html",
		"8.8.8:O IHEP:ihep.html",
		"8.9:O Evento:event.html",	
		"8.10:Os Detectores:detectors.html",
		"8.11:As Formas dos Detectores:shape_detector.html",
		"9:Como Interpretamos Nossos Dados?:modern_detect.html",
		"9.1:Os Detectores Modernos:modern_detect.html",
		"9.2:Os Componentes Típicos de um Detector :component_detector.html",
		"9.2.1:Exercício sobre a Lei de Conservação:quiz_conservation.html",
		"9.3:Medindo Carga e Momento:measure.html",
		"9.4:O Corte Transversal de um Detector:end_view.html",
		"9.4.1:Exercício - Que Rastro de Partícula é Mostrado?:quiz_track.html",
		"9.5:Reconstrução Computadorizada de um Evento:computer.html",
		"9.5.1:Um Evento Quark/Glúon:comp_qg.html",
		"9.6:O Fim:exp_end.html",
		"10:blank:blank");
		
		
	function getIndexOfLevel(level) {
		for(var index = pageList.length-1; index > -1; index--) {
			if (getLevel(pageList[index]) == level)
				return index;
		}
		return -1;
	}
		
	/*********************/
	/* getLevel 
	   Take a description like "2.2:Atoms?:atoms.html" and return "2.2" */
	function getLevel(description) {
		var index = description.indexOf(":");
		if (index == -1) {
			alert(description + " is an illegal description.");
			return "1";
		} 
		return description.substring(0,index);
	}
	
	/*********************/
	/* getTitle
	   Take a description like "2.2:Atoms?:atoms.html" and return "Atoms?" */
	function getTitle(description) {
		var index_1 = description.indexOf(":");
		if (index_1 == -1) {
			alert(desription + " is an illegal description.");
			return "1";
		} 
		
		var index_2 = description.substring(index_1 + 1, description.length).indexOf(":");
		if (index_2 == -1) {
			alert(description + " is an illegal description.");
			return "1";
		} 
		return description.substring(index_1 + 1,index_2 + index_1 + 1);	
	}
	
	/*********************/
	/* getURL 
	   Take a description like "2.2:Atoms?:atoms.html" and return "atoms.html" */
	function getURL(description) {
		var index_1 = description.indexOf(":");
		if (index_1 == -1) {
			alert(description + " is an illegal description.");
			return "1";
		} 
		
		var index_2 = description.substring(index_1 + 1, description.length).indexOf(":");
		if (index_2 == -1) {
			alert(description + " is an illegal description.");
			return "1";
		} 
		return description.substring(index_1+ index_2 + 2, description.length);	
	}
	
	/*********************/
	/* Level Information Functions: How to extract the information about, e.g., 2.2.1 */
	function getLevelDepth(level) {
		level = level.toString();
		var index = 0;
		var depth = 1;
		for (index = 0; index < level.length; index++) {
			if(level.charAt(index) == ".") {
				depth++;	
			}
		}
		return depth;
	}
	
	function getLevelParent(level) {
		level = level.toString();
		if (getLevelDepth(level) == 1) 
			return "-1";
		
		var index_last = level.lastIndexOf(".");
		return level.substring(0, index_last);
	}

	function getLevelParentMax1(level) {
		if (getLevelDepth(level) == 1) 
			return level;
		
		var index_last = level.lastIndexOf(".");
		return level.substring(0, index_last);
	}
