AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.133.155.253


Current Path : /var/www/lhjmq-records.qc.ca/public_html/xsl/records/book/js/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/xsl/records/book/js/functions_hugo__.js

//INIT FUNCTION CALLS

var xml_path = "xml/";
var xsl_path = "xsl/";
var evolution_path = "_tableaux/evolution_v2/";
var relatifs_path = "_tableaux/relatifs/";

var pop_type = "0";
var ligue_last = "";
var equipe_last = "";
var franchise_last = "";
var btn_selection = "";

var final_file_name_without_year = "";
var drop_scheme = "";
var select_exists = false;
var pre_opened_browser = "";
var selected_type = "ligue";
var is_main_selector = false;

var p_lang = "fr";

var document_title = p_lang == "fr" ? ":: Livre des records de la LHJMQ ::" : ":: QMJHL's all-time records ::";

var version_to_validate = Number(6);
var get_nav_version;
var get_nav_agent_array;
var split_n = Number(0);
var navigator_error_fr = "La section « Livre des records de la LHJMQ » ne peut s'afficher que sous la version 6 (ou plus récente) d'Internet Explorer.\nVeuillez mettre à jour votre navigateur.";
var navigator_error_en = "To view the QMJHL Record's book website, Internet Explorer 6 or later version is required";

var subdirectory = default_rep2.split("||");
var subdirectory_path = subdirectory[0] + '/' + subdirectory[1];
var is_subdirectory_exists = 'L';

window.onload = function () {
	document.getElementById("section00").value = '-1';

	if (document.body) {
		if (document.location.href.indexOf('index2.php') != -1) {
			if (navigator.userAgent.indexOf('MSIE') != -1) {
				get_nav_agent_array = navigator.userAgent.split(";");
				get_nav_version = get_nav_agent_array[1].split("MSIE ").join("");
				split_n = parseFloat(get_nav_version.split("."));

				if (split_n < version_to_validate) {
					document.location.href = "./index.php";
					return;
				}
			}
			else {
				if (document.getElementById("search_tool")) {
					if (document.getElementById("main_records")) {
						document.getElementById("preload_msg").style.display = "none";
						swf_header();
					}
				}
			}
		}
		else {
			if (document.getElementById("search_tool")) {
				if (document.getElementById("main_records")) {
					document.getElementById("preload_msg").style.display = "none";
					swf_header();
				}
			}
		}
	}
}

//INIT FUNCTION CALLS
function start_display() {
	this.window.name = "records_win";

	document.title = document_title;

	if (document.location.href.indexOf("index2.php") > 0) {
		$('.search4').hide();
		scheme = document.getElementById("section2_number").value + document.getElementById("section3_number").value;

		if (!scheme) {
			scheme = '11'
		}

		// TABLEAUX DETECTION
		if (is_catcher) {
			document.getElementById("section02").value = catch_rep
			get_final_xml_name(catch_file, p_lang)
			catcher_rep = catch_rep
		}
		else {
			document.getElementById("section02").value = subdirectory[0];
			get_final_xml_name(default_xml_file_name, p_lang);
			catcher_rep = subdirectory[0];
		}

		if (document.getElementById("main_records")) {
			load_and_transform(xml_path + 'root.xml', xsl_path + 'main_tool_selectors.xsl', 'main_level_tool', null, { lang: p_lang, level_type: scheme });
		}

		if (document.getElementById("main_level_tool")) {
			load_and_transform(xml_path + 'root.xml', xsl_path + 'saisons.xsl', 'main_seasons', null, { season_in: '0', season_out: '3000', lang: p_lang });
		}

		if (document.getElementById("main_seasons")) {
			load_and_transform(xml_path + 'root.xml', xsl_path + 'second_tool_selectors.xsl', 'second_level_tool', null, { lang: p_lang });
		}

		actual_record_file_no_slash = actual_record_file.split("/");

		if (actual_record_file_no_slash.length > 0 && actual_record_file_no_slash[0] != 'temp_rec') {
			if (document.getElementById("section02").value == 'V') {
				actual_record_file_without_year = actual_record_file_no_slash[1].split("_");
			}
			else {
				if (actual_record_file_no_slash[2] != undefined) {
					actual_record_file_without_year = actual_record_file_no_slash[2].split("_");
				}
			}

			if (actual_record_file_without_year[1] != undefined) {
				final_file_name_without_year = actual_record_file_without_year[1];
			} else {
				final_file_name_without_year = null
			}

			if (actual_record_file_without_year[0]) {
				final_file_name_with_year = actual_record_file_without_year[0];
			} else {
				final_file_name_with_year = null
			}
		}

		// DETECT IF THERE IS A «CETTE SAISON» XML FILE
		is_this_season_exists = is_file_exists(xml_path + selected_season + "/" + selected_season + "_" + final_file_name_without_year)

		if (!is_this_season_exists) {
			file_path = 'false';
		} else {
			file_path = selected_season
		}

		// DETECT IF THERE IS A «EVOLUTION» XML FILE
		if (document.getElementById("section00").value != '-1') {
			is_evolution_exists = is_file_exists(xml_path + evolution_path + document.getElementById("section00").value + '/' + final_file_name_without_year);
			is_subdirectory_exists = document.getElementById("section00").value;
		}
		else {
			is_evolution_exists = is_file_exists(xml_path + evolution_path + subdirectory[1] + '/' + final_file_name_without_year);
			is_subdirectory_exists = subdirectory[1];
		}

		// DETECT IF THERE IS A RELATIFS» XML FILE

		// Modification hugo remove records relatifs
		if (document.getElementById("section02").value == 'V') {
			is_relatifs_exists = is_file_exists(xml_path + relatifs_path + final_file_name_without_year);
		}
		else {
			is_relatifs_exists = is_file_exists(xml_path + relatifs_path + "/" + default_rep + "/" + final_file_name_without_year);
		}
		// modification hugo remove records relatifs set value to false
		is_relatifs_exists = false;

		// TABLEAUX DETECTION
		get_section_number(document.getElementById('section2_number'), '1');
		get_section_number(document.getElementById('section3_number'), '1');
		set_tool_texts(p_lang)
		get_default(selected_type, null, null, null, true)

		debug = false;

		if (debug) {
			document.getElementById("debug_zone").style.display = 'block'
		} else {
			document.getElementById("debug_zone").style.display = "none"
		}

		rload = $.url('rload');

		if (rload != undefined) {
			decodedRload = atob(rload);
			decodedRload = decodedRload.split('***');

			select_1 = decodedRload[0];
			select_2 = decodedRload[1];
			select_3 = decodedRload[2];
			ligue_selector = decodedRload[3];
			equipe_selector = decodedRload[4];
			franchise_selector = decodedRload[5];
			season_selector = decodedRload[6];
			second_l = decodedRload[7];
			third_l = decodedRload[8];
			forth_l = decodedRload[9];
			fifth_l = decodedRload[10];
			sixth_l = decodedRload[11];
			seventh_l = decodedRload[12];

			//console.log('ligue_selector = ' + ligue_selector);
			/*console.log('select_1 = ' + select_1);
			console.log('select_2 = ' + select_2);
			console.log('select_3 = ' + select_3);
			console.log('ligue_selector = ' + ligue_selector);
			console.log('equipe_selector = ' + equipe_selector);
			console.log('franchise_selector = ' + franchise_selector);
			console.log('season_selector = ' + season_selector);
			console.log('second_l = ' + second_l);
			console.log('third_l = ' + third_l);
			console.log('forth_l = ' + forth_l);
			console.log('fifth_l = ' + fifth_l);
			console.log('sixth_l = ' + sixth_l);
			console.log('seventh_l = ' + seventh_l);*/

			$('input[name="select_1"][value="' + select_1 + '"]').prop('checked', true).trigger('click');

			if (select_1 == 'L') {
				$('#ligue_selector').val(ligue_selector).trigger('change');
			}
			else if (select_1 == 'E') {
				$('#equipe_selector').val(equipe_selector).trigger('change');
			}
			else if (select_1 == 'F') {
				$('#franchise_selector').val(franchise_selector).trigger('change');
			}

			$('input[name="select_2"][value="' + select_2 + '"]').prop('checked', true).trigger('click');

			if (select_2 == 'S') {
				$('#season_selector').val(season_selector).trigger('change');
			}

			$('input[name="select_3"][value="' + select_3 + '"]').prop('checked', true).trigger('click');
			$('#advanced_records option:contains("' + second_l + '")').prop('selected', true).trigger('change');
			$('#third_tool_select option:contains("' + third_l + '")').prop('selected', true).trigger('change');
			$('#forth_tool_select option:contains("' + forth_l + '")').prop('selected', true).trigger('change');
			$('#fifth_tool_select option:contains("' + fifth_l + '")').prop('selected', true).trigger('change');
			$('#sixth_tool_select option:contains("' + sixth_l + '")').prop('selected', true).trigger('change');
			$('#seventh_tool_select option:contains("' + seventh_l + '")').prop('selected', true).trigger('change');
		}

		$('.search4').show();
	}

	load_pub_sidebar();
}

function get_default(type, level_id_0, level_id_1, level_id_2, is_default, is_reload) {
	var this_selector;
	selected_type = type;

	if (!type) {
		type = 'ligue'
	}

	if (!level_id_0) {
		level_id_0 = '0'
	}

	if (!level_id_1) {
		level_id_1 = '11LJ'
	}

	if (!level_id_2) {
		level_id_2 = '1LJ2But'
	}

	level_id_3 = "1LJ3ButBPB"
	level_id_4 = "1LJ4ButBPBPJO"
	level_id_5 = "1LJ5ButBPBPJO1Sa"

	drop_label_0 = p_lang == "fr" ? "Joueurs" : "Players";
	drop_label_1 = p_lang == "fr" ? "Buts" : "Goals";
	drop_label_2 = p_lang == "fr" ? "Plus de buts" : "Most goals";
	drop_label_3 = p_lang == "fr" ? "Par un joueur" : "By a player";
	drop_label_4 = p_lang == "fr" ? "En une saison" : "One season";
	drop_label_5 = p_lang == "fr" ? "Dom. et étr." : "Home and away";

	if (is_default) {
		$('#select_ligue').attr('checked', true);
		$('#select_equipe').attr('checked', false);
		$('#select_franchise').attr('checked', false);
		$('#ligue_selector').show();
		$('#equipe_selector').show();
		$('#franchise_selector').show();
		$('#select_carriere').attr('checked', true);
		$('#select_reg').attr('checked', true);
	}

	$('#ligue_selector').hide();
	$('#equipe_selector').hide();
	$('#franchise_selector').hide();

	this_selector = $('#' + type + '_selector')

	if (this_selector.length > 0) {
		this_selector.show();
	}

	if (is_default) {
		if (type == 'ligue') {
			get_type_level_and_id('|' + type + '0|' + level_id_0, 'second_tool_selectors.xsl', 'second_level_tool', document.getElementById('ligue_selector'), drop_label_0);
			get_type_level_and_id('|' + type + '1|' + level_id_1, 'third_tool_selectors.xsl', 'thrid_level_tool', document.getElementById('ligue_selector'), drop_label_1);
			get_type_level_and_id('|' + type + '2|' + level_id_2, 'forth_tool_selectors.xsl', 'forth_level_tool', document.getElementById('ligue_selector'), drop_label_2);
			get_type_level_and_id('|' + type + '3|' + level_id_3, 'fifth_tool_selectors.xsl', 'fifth_level_tool', document.getElementById('ligue_selector'), drop_label_3);
			get_type_level_and_id('|' + type + '4|' + level_id_4, 'sixth_tool_selectors.xsl', 'sixth_level_tool', document.getElementById('ligue_selector'), drop_label_4);
			get_type_level_and_id('|' + type + '5|' + level_id_5, 'seventh_tool_selectors.xsl', 'seventh_level_tool', document.getElementById('ligue_selector'), drop_label_5);
		}
		else if (type == 'equipe') {
			get_type_level_and_id('|' + type + '0|' + level_id_0, 'second_tool_selectors.xsl', 'second_level_tool', document.getElementById('equipe_selector'), "");
			get_type_level_and_id('|' + type + '1|' + level_id_1, 'third_tool_selectors.xsl', 'thrid_level_tool', document.getElementById('equipe_selector'), "");
			get_type_level_and_id('|' + type + '2|' + level_id_2, 'forth_tool_selectors.xsl', 'forth_level_tool', document.getElementById('equipe_selector'), "");
		}
		else if (type == 'franchise') {
			get_type_level_and_id('|' + type + '0|' + level_id_0, 'second_tool_selectors.xsl', 'second_level_tool', document.getElementById('franchise_selector'), "");
			get_type_level_and_id('|' + type + '1|' + level_id_1, 'third_tool_selectors.xsl', 'thrid_level_tool', document.getElementById('franchise_selector'), "");
			get_type_level_and_id('|' + type + '2|' + level_id_2, 'forth_tool_selectors.xsl', 'forth_level_tool', document.getElementById('franchise_selector'), "");
		}
	}

	if (!is_default) {
		if (type == 'franchise') {
			get_section_letter(document.getElementById('section02'), "V");
			get_section_number(section2_number, '1');
			reload_drop_lists(true)
		}
		else {
			reload_drop_lists(true, selected_type)
		}
	}

	if (is_default) {
		get_section_letter(document.getElementById('section00'), $('#select_ligue').val(), '0');
		get_section_letter(document.getElementById('section01'), $('#ligue_selector').val());
		get_section_letter(document.getElementById('section02'), $('#select_carriere').val());
		get_section_letter(document.getElementById('section03'), $('#select_reg').val());
		get_section_letter(document.getElementById('section04'), 'ButBPBPJO1SaD-E');
	}
}

function sortTypeDispatcher(field_name, div_name) {
	if (eval('typeof sort_type_' + field_name + '_' + div_name + ' != \'undefined\'')) {
		if (eval("previous_field_" + div_name + "_name") != (field_name + '_' + div_name)) {
			eval('sort_type_' + field_name + '_' + div_name + ' = \'ascending\'')
		} else if (eval('sort_type_' + field_name + '_' + div_name + ' == \'ascending\'')) {
			eval('sort_type_' + field_name + '_' + div_name + ' = \'descending\'')
		} else {
			eval('sort_type_' + field_name + '_' + div_name + ' = \'ascending\'')
		}
	}
	else {
		eval('sort_type_' + field_name + '_' + div_name + ' = \'ascending\'')
	}

	eval("previous_field_" + div_name + "_name = field_name + '_' + div_name");

	return eval('sort_type_' + field_name + '_' + div_name);
}

function loadXMLDoc(filename) {
	var xhttp;

	xhttp = new XMLHttpRequest();
	xhttp.open('GET', filename, false);

	try {
		//xhttp.responseType = 'msxml-document';
		xhttp.responseType = 'document';
	}
	catch (err) { } // Helping IE11

	xhttp.send('');

	return xhttp.responseXML;
}

function XmlTransform_chrome(xt_xml, xt_xsl, sort_field, sort_order_type, param) {
	var returndata;

	$.ajax({
		type: 'GET',
		url: 'test2.php',
		data: ({ xml: xt_xml, xsl: xt_xsl, param: param }),
		dataType: 'html',
		async: false,
		success: function (data) {
			returndata = data;
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert(errorThrown);
		}
	});

	return returndata;
}

function XmlTransform_ie(xt_xml, xt_xsl, xt_sort_field, xt_sort_order_type, param) {
	var xmldoc = new ActiveXObject('MSXML2.DOMDocument')
	xmldoc.async = false;
	xmldoc.resolveExternals = true;
	xmldoc.validateOnParse = true;
	xmldoc.load(xt_xml);

	if (xmldoc.parseError.errorCode != 0) {
		error = xmldoc.parseError;
	}

	// Chargement XSL
	var xsldoc = new ActiveXObject('MSXML2.FreeThreadedDOMDocument');
	xsldoc.async = false;
	xsldoc.resolveExternals = true;
	xsldoc.validateOnParse = true;
	xsldoc.load(xt_xsl);

	if (xsldoc.parseError.errorCode != 0) {
		error = xsldoc.parseError;
	}

	// Propriété de transformation
	xsldoc.setProperty('SelectionLanguage', 'XPath')
	xsldoc.setProperty('SelectionNamespaces', 'xmlns:xsl="http://www.w3.org/1999/XSL/Transform"')
	var xtemplate = new ActiveXObject('MSXML2.XSLTemplate');
	xtemplate.stylesheet = xsldoc;
	xprocessor = xtemplate.createProcessor();
	xprocessor.input = xmldoc;

	if (param) {
		for (var label in param) {
			xprocessor.addParameter(label, param[label]);
		}
	}

	// CONDITION FOR SORTING ONLY
	if (xt_sort_field != null) {
		if (typeof xt_sort_order_type != 'undefined') {
			xprocessor.addParameter('sort', xt_sort_field);
			xprocessor.addParameter('sort_order_type', xt_sort_order_type);
		}
	}

	// Transformation
	xprocessor.transform();
	output = xprocessor.output;

	return output;
}

function XmlTransform_moz(xt_xml, xt_xsl, sort_field, sort_order_type, param) {
	var processor;
	var xslt;
	var xmlDoc;
	var xmlDom;
	var output;
	var serializer;

	xslt = document.implementation.createDocument('', '', null);
	xslt.async = false;
	xslt = loadXMLDoc(xt_xsl);

	xmlDoc = document.implementation.createDocument('', '', null);
	xmlDoc.async = false;
	xmlDoc = loadXMLDoc(xt_xml);

	processor = new XSLTProcessor();
	processor.importStylesheet(xslt);

	// CONDITION FOR SORTING ONLY
	if (sort_field != null) {
		if (typeof sort_order_type != 'undefined') {
			processor.setParameter(null, 'sort_order_type', sort_order_type);
			processor.setParameter(null, 'sort', sort_field);
		}
	}

	if (param) {
		for (var label in param) {
			processor.setParameter(null, label, param[label]);
		}
	}

	xmlDom = processor.transformToDocument(xmlDoc);
	serializer = new XMLSerializer();
	output = serializer.serializeToString(xmlDom.documentElement);

	return output;
}

// function load_and_transform(XMLData, xslFile, div_name, sort_field, param)
// {
// 	var output = '';
// 	var sort_order_type = '';

// 	sort_order_type = sortTypeDispatcher(sort_field, div_name)

// 	var ie = (typeof window.ActiveXObject != 'undefined');
// 	var moz = (typeof document.implementation.createDocument != 'undefined');
// 	var chrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
// 	var safari = /Safari/.test(navigator.userAgent) && /Apple/.test(navigator.vendor);

// 	if ('ActiveXObject' in window) {
// 		ie = true;
// 	}

// 	if (chrome == true || safari == true) {
// 		output = XmlTransform_chrome(XMLData, xslFile, null, null, param);
// 	}
// 	else if (moz == true && ie == false)
// 	{
// 		if (param) {
// 			output = XmlTransform_moz(XMLData, xslFile, null, null, param);
// 		}
// 		else if (sort_field != null) {
// 			if (typeof sort_order_type != 'undefined') {
// 				output = XmlTransform_moz(XMLData, xslFile, sort_field, sort_order_type);
// 			}
// 		}
// 		else {
// 			output = XmlTransform_moz(XMLData, xslFile);
// 		}
// 	}
// 	else if (ie == true)
// 	{
// 		if (param) {
// 			output = XmlTransform_ie(XMLData, xslFile, null, null, param);
// 		}
// 		else if (sort_field && sort_order_type) {
// 			output = XmlTransform_ie(XMLData, xslFile, sort_field, sort_order_type);
// 		}
// 		else {
// 			output = XmlTransform_ie(XMLData, xslFile);
// 		}
// 	}

// 	$('#' + div_name).html(output);

// 	manage_available_data()
// }

function load_and_transform(XMLData, xslFile, div_name, sort_field, param) {
	var output = '';
	var sort_order_type = '';

	sort_order_type = sortTypeDispatcher(sort_field, div_name)

	var ie = (typeof window.ActiveXObject != 'undefined');
	var moz = (typeof document.implementation.createDocument != 'undefined');
	var chrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
	var safari = /Safari/.test(navigator.userAgent) && /Apple/.test(navigator.vendor);


	if ('ActiveXObject' in window) {
		ie = true;
	}

	if ((chrome == true || safari == true || moz == true) && ie == false) {
		if (param) {
			output = XmlTransform_moz(XMLData, xslFile, null, null, param);
		}
		else if (sort_field != null) {
			if (typeof sort_order_type != 'undefined') {
				output = XmlTransform_moz(XMLData, xslFile, sort_field, sort_order_type);
			}
		}
		else {
			output = XmlTransform_moz(XMLData, xslFile);
		}
	}
	else if (ie == true) {
		if (param) {
			output = XmlTransform_ie(XMLData, xslFile, null, null, param);
		}
		else if (sort_field && sort_order_type) {
			output = XmlTransform_ie(XMLData, xslFile, sort_field, sort_order_type);
		}
		else {
			output = XmlTransform_ie(XMLData, xslFile);
		}
	}

	$('#' + div_name).html(output);

	manage_available_data()
}

function get_season_by_selection(obj) {
	years = obj.split('|')
	yr_in = years[1]
	yr_out = years[2]

	if (yr_in && yr_out) {
		load_and_transform(xml_path + "root.xml", xsl_path + "saisons.xsl", "main_seasons", null, { season_in: yr_in, season_out: yr_out, visible_state: get_season_visibility_state(), lang: p_lang });
	}
}

function get_type_level_and_id(str, xsl_level_file, div_name, mode, selection, reload) {
	scheme = document.getElementById("section2_number").value + document.getElementById("section3_number").value

	if (!selection) {
		selection = 'void'
	}

	if (mode) {
		document.getElementById("ligue_selector").style.display = "none";
		document.getElementById("equipe_selector").style.display = "none";
		document.getElementById("franchise_selector").style.display = "none";

		if (mode.length > 0) {
			mode.style.display = "block";
		}
	}

	final_str = str.split("|")

	load_and_transform(xml_path + 'root.xml', xsl_path + xsl_level_file, div_name, null, { level_name: final_str[1], level_name_id: final_str[2], lang: p_lang, level_type: scheme, selection: selection })

	if (!reload) {
		if (div_name == "second_level_tool") {
			if (document.getElementById("advanced_records")) {
				value_label = document.getElementById("advanced_records").options[document.getElementById("advanced_records").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_second_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}

		if (div_name == "thrid_level_tool") {
			if (document.getElementById("third_tool_select")) {
				value_label = document.getElementById("third_tool_select").options[document.getElementById("third_tool_select").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_third_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}

		if (div_name == "forth_level_tool") {
			if (document.getElementById("forth_tool_select")) {
				value_label = document.getElementById("forth_tool_select").options[document.getElementById("forth_tool_select").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_forth_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}
		else if (final_str[7]) {
			load_and_transform(xml_path + 'root.xml', xsl_path + 'forth_tool_selectors.xsl', 'forth_level_tool', null, { level_name: final_str[6], level_name_id: final_str[7], lang: p_lang, level_type: scheme, selection: selection });
			get_drop_spec(document.getElementById('drop_forth_level'), final_str[8] + '@void|' + final_str[6] + '|' + final_str[7] + '|');
		}

		if (div_name == "fifth_level_tool") {
			if (document.getElementById("fifth_tool_select")) {
				value_label = document.getElementById("fifth_tool_select").options[document.getElementById("fifth_tool_select").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_fifth_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}

		if (div_name == "sixth_level_tool") {
			if (document.getElementById("sixth_tool_select")) {
				value_label = document.getElementById("sixth_tool_select").options[document.getElementById("sixth_tool_select").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_sixth_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}

		if (div_name == "seventh_level_tool") {
			if (document.getElementById("seventh_tool_select")) {
				value_label = document.getElementById("seventh_tool_select").options[document.getElementById("seventh_tool_select").selectedIndex].innerHTML;
				get_drop_spec(document.getElementById('drop_seventh_level'), value_label + "@void|" + final_str[1] + "|" + final_str[2]);
			}
		}
	}
}

function get_section_letter(obj, letter, group) {
	if (obj.id == 'section00') {
		if (group == '0') {
			value = $('#ligue_selector').val();
			$('#season_selector').val(ligue_last);
		}
		else if (group == '1') {
			value = $('#equipe_selector').val();
			$('#season_selector').val(equipe_last);
		}
		else if (group == '2') {
			value = $('#franchise_selector').val();
			$('#season_selector').val(franchise_last);
		}

		if (value) {
			this_final_letter = value.split('|');
			$('#section01').val(this_final_letter[0]);
		}

		if ($('#season_selector').is(':visible')) {
			value = $('#season_selector').val()
			this_final_letter = value.split('|')
			$('#section02').val(this_final_letter);
		}
	}
	else if (obj.id == 'section01') {
		if ($('#season_selector').is(':visible')) {
			value = $('#season_selector').val();
			this_final_letter = value.split('|');
			$('#section02').val(this_final_letter);
		}
	}

	if (letter) {
		final_letter = letter.split('|');
		obj.value = final_letter[0];
	}

	if ($('#ligue_selector').is(':visible') && $('#season_selector').is(':visible')) {
		ligue_last = $('#season_selector').val();
	}

	if ($('#equipe_selector').is(':visible') && $('#season_selector').is(':visible')) {
		equipe_last = $('#season_selector').val();
	}

	if ($('#franchise_selector').is(':visible') && $('#season_selector').is(':visible')) {
		franchise_last = $('#season_selector').val();
	}
}

function get_record(xml) {
	actual_record_file = xml;

	xml_split = xml.split("/");

	if (xml_split[2]) {
		final_xml = xml_split[2];
	}
	else if (xml_split[1]) {
		final_xml = xml_split[1];
	}
	else {
		final_xml = xml;
	}

	split_final_xml = final_xml.split("_");

	if (split_final_xml[1]) {
		final_file_name_without_year = split_final_xml[1];
	} else {
		final_file_name_without_year = null;
	}

	if (split_final_xml[0]) {
		final_file_name_with_year = split_final_xml[0];
	} else {
		final_file_name_with_year = null;
	}

	// TABLEAUX DETECTION

	// DETECT IF THERE IS A «CETTE SAISON» XML FILE
	is_this_season_exists = is_file_exists(xml_path + selected_season + "/" + selected_season + "_" + final_file_name_without_year)

	if (!is_this_season_exists) {
		file_path = 'false';
	} else {
		file_path = selected_season;
	}

	// DETECT IF THERE IS A «EVOLUTION» XML FILE
	if (document.getElementById("section00").value != '-1') {
		is_evolution_exists = is_file_exists(xml_path + evolution_path + document.getElementById("section00").value + '/' + final_file_name_without_year);
		is_subdirectory_exists = document.getElementById("section00").value;
	}
	else {
		is_evolution_exists = is_file_exists(xml_path + evolution_path + subdirectory[1] + '/' + final_file_name_without_year);
		is_subdirectory_exists = subdirectory[1];
	}

	// DETECT IF THERE IS A «RELATIFS» XML FILE
	is_relatifs_exists = is_file_exists(xml_path + relatifs_path + final_file_name_with_year + "/" + final_file_name_without_year)

	// modification hugo remove records relatifs set default value to false
	is_relatifs_exists = false;

	// TABLEAUX DETECTION
	if (is_get_link) {
		if (final_file_name_without_year != null) {
			document.getElementById("denis_links").style.display = 'block';
			document.getElementById("denis_links").style.color = '#ffffff';
			document.getElementById("denis_links").style.fontWeight = 'bold';
			document.getElementById("denis_links").style.fontSize = "10px";
			final_id = final_file_name_without_year.split(".xml").join("");

			document.getElementById("denis_links").innerHTML = "http://" + server_name + record_main_folder + "?rep=" + final_file_name_with_year + "&file_id=" + final_id + "&lang=" + p_lang;
		}
		else {
			document.getElementById("denis_links").innerHTML = 'Lien non disponible';
		}
	}
	else {
		document.getElementById("denis_links").style.display = 'none';
	}

	load_and_transform(xml_path + xml, xsl_path + 'records_new.xsl', 'main_records', null, { lang: p_lang, actual_file: final_xml, thisseason: file_path, img_year: selected_season, is_evolution: is_evolution_exists, is_relatifs: is_relatifs_exists, is_subdirectory: is_subdirectory_exists });

	//window.location.hash = "#a1";
	//document.title = document_title.split("#a1").join("");
	window.location.hash = "#a0";
	document.title = document_title.split("#a0").join("");
}

function get_pop_record(type) {
	load_and_transform(xml_path + 'most_pop_records_hugo.xml', xsl_path + 'most_pop_records_hugo.xsl', 'most_pop_records', null, { pop_type: type, lang: p_lang, is_subdirectory: is_subdirectory_exists });
}

function show_hide_season_section(obj) {
	if (obj.id == "select_saison") {
		document.getElementById("season_selector").style.display = "block";
	} else {
		document.getElementById("season_selector").style.display = "none";
	}
}

function get_season_visibility_state() {
	season_selector_obj = document.getElementById("season_selector")

	if (season_selector_obj.style.display == "none") {
		season_visibility = 'off'
	} else {
		season_visibility = 'on'
	}

	return season_visibility;

}

function IsNumeric(input) {
	var RE = /^-{0,1}\d*\.{0,1}\d+$/;
	return (RE.test(input));
}

function get_final_xml_name2(final_file_name, act_lang) {
	var alert_message = act_lang == 'fr' ? 'Les sélecteurs identifiés d\'un astérisque sont obligatoires' : 'Selectors with an asteric are required';

	if (document.getElementById('third_tool_select')) {
		if (document.getElementById('third_tool_select').value == "-1|||||") {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('forth_tool_select')) {
		if (document.getElementById('forth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('fifth_tool_select')) {
		if (document.getElementById('fifth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('sixth_tool_select')) {
		if (document.getElementById('sixth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('seventh_tool_select')) {
		if (document.getElementById('seventh_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	record_file = final_file_name.split('_');
	final_record_file = record_file[1].split('.xml');
	final_record_file = final_record_file[0];

	select_1 = $('input:radio[name="select_1"]:checked').val();
	select_2 = $('input:radio[name="select_2"]:checked').val();
	select_3 = $('input:radio[name="select_3"]:checked').val();
	ligue_selector = $('#ligue_selector').val();
	equipe_selector = $('#equipe_selector').val();
	franchise_selector = $('#franchise_selector').val();
	season_selector = $('#season_selector').val();

	drop_second_level = $('#drop_second_level').val();
	drop_third_level = $('#drop_third_level').val();
	drop_forth_level = $('#drop_forth_level').val();
	drop_fifth_level = $('#drop_fifth_level').val();
	drop_sixth_level = $('#drop_sixth_level').val();
	drop_seventh_level = $('#drop_seventh_level').val();

	second_l = drop_second_level.split('@');
	second_l = second_l[0];
	third_l = drop_third_level.split('@');
	third_l = third_l[0];
	forth_l = drop_forth_level.split('@');
	forth_l = forth_l[0];
	fifth_l = drop_fifth_level.split('@');
	fifth_l = fifth_l[0];
	sixth_l = drop_sixth_level.split('@');
	sixth_l = sixth_l[0];
	seventh_l = drop_seventh_level.split('@');
	seventh_l = seventh_l[0];

	rload_1 = select_1 + '***' + select_2 + '***' + select_3;
	rload_2 = ligue_selector + '***' + equipe_selector + '***' + franchise_selector + '***' + season_selector;
	rload_3 = second_l + '***' + third_l + '***' + forth_l + '***' + fifth_l + '***' + sixth_l + '***' + seventh_l;
	rload = rload_1 + '***' + rload_2 + '***' + rload_3;

	// Encode
	encodedRload = btoa(rload);

	window.location.href = '/xsl/records/book/index2.php?rep=V&file_id=' + final_record_file + '&lang=' + act_lang + '&rload=' + encodedRload;
}

function get_final_xml_name(final_file_name, act_lang) {
	var alert_message = act_lang == 'fr' ? 'Les sélecteurs identifiés d\'un astérisque sont obligatoires' : 'Selectors with an asteric are required';

	if (document.getElementById('third_tool_select')) {
		if (document.getElementById('third_tool_select').value == "-1|||||") {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('forth_tool_select')) {
		if (document.getElementById('forth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('fifth_tool_select')) {
		if (document.getElementById('fifth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('sixth_tool_select')) {
		if (document.getElementById('sixth_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById('seventh_tool_select')) {
		if (document.getElementById('seventh_tool_select').selectedIndex == 0) {
			alert(alert_message)
			return;
		}
	}

	if (document.getElementById("section02").value == 'V') {
		records_folder = "Z/" + document.getElementById("section00").value + "/";
	}
	else if (IsNumeric(document.getElementById("section02").value)) {
		records_folder = document.getElementById("section02").value + "/";
	}
	else {
		records_folder = document.getElementById("section02").value + "/" + subdirectory[1] + "/";
	}

	if (is_catcher && new_repertoire != '') {
		records_folder = document.getElementById("section02").value + "/" + new_repertoire + "/";
		document.getElementById("section00").value = new_repertoire;
	}

	if (is_file_exists(xml_path + records_folder + final_file_name)) {
		get_record(records_folder + final_file_name);
	}
	else {
		get_record('temp_rec/temp.xml');
	}
}

function get_other_xml_name(final_file_name, act_lang) {
	if (is_file_exists(xml_path + final_file_name)) {
		get_record(final_file_name)
	}
	else {
		if (act_lang == 'en') {
			alert("This record doesn't exists !")
		} else {
			alert("Ce record n'esiste pas !")
		}
	}
}

function is_file_exists(url) {
	var req = new AJ(); // XMLHttpRequest object

	try {
		req.open('HEAD', url, false);
		req.send(null);
		return req.status == 200 ? true : false;
	}
	catch (er) {
		return false;
	}
}

function AJ() {
	var obj;

	if (window.XMLHttpRequest) {
		obj = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		try {
			obj = new ActiveXObject('MSXML2.XMLHTTP.3.0');
		}
		catch (er) {
			try {
				obj = new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch (er) {
				obj = false;
			}
		}
	}

	return obj;
}

function start_animation_id(str) {
	var essai = str

	if (thisMovie("animation_call")) {
		thisMovie("animation_call").goHome(essai);
	}
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}
	else {
		return document[movieName]
	}
}

function swap_image(obj, img_on, img_off) {
	obj.src = "img/" + img_on

	obj.onmouseout = function () {
		if (obj.id == 'img_0' && btn_selection == 'img_0') {
			this.src = "img/" + "btn_gen_on.jpg"
		} else if (obj.id == 'img_1' && btn_selection == 'img_1') {
			this.src = "img/" + "btn_jours_on.jpg"
		} else {
			this.src = "img/" + img_off
		}
	}
}

function on_image(obj, img_on) {
	btn_selection = String(obj.id);

	document.getElementById("img_0").src = "img/" + "btn_gen.jpg";
	document.getElementById("img_1").src = "img/" + "btn_jours.jpg"

	obj.src = "img/" + img_on;
}

function set_over_image(id) {
	if (id == '0') {
		document.getElementById("img_0").src = "img/" + "btn_gen.jpg";
	}
	else if (id == '1') {
		document.getElementById("img_1").src = "img/" + "btn_jours_on.jpg";
	}
}

function call_swf_video(id, lang, player_name, h) {
	if (h) {
		h_ = h
	} else {
		h_ = "283"
	}

	$.get("ajax/get_cms_joueur_info.php?player_id=" + id + "&lang=" + lang, function (data) {
		$("#new_gui").html(data);
	});

	// view code
	/*	var so = new SWFObject("flvs/numberOne.swf?" + new Date().getTime(), "movie", "345", h_, "#ffffff");
		so.addParam("scale", "noscale");
		so.addParam("wmode", "transparent");
		so.addParam("menu", "false");
		so.addVariable("id_register", id)
		so.addVariable("f_lang", lang)
		so.addVariable("player_name", player_name);
		so.write("record_movie");
		document.title = document_title.split("#a1").join("");
	*/
}

function open_close_tool(obj) {
	if (p_lang == 'fr') {
		if (obj.style.display == 'none') {
			document.getElementById('tool_btn').innerHTML = '« Masquer l\'outil';
			obj.style.display = 'block';
		}
		else {
			obj.style.display = 'none';
			document.getElementById('tool_btn').innerHTML = 'Dévoiler l\'outil »';
		}
	}
	else {
		if (obj.style.display == 'none') {
			document.getElementById('tool_btn').innerHTML = '« Hide this tool';
			obj.style.display = 'block';
		}
		else {
			obj.style.display = 'none';
			document.getElementById('tool_btn').innerHTML = 'Show this tool »';
		}
	}
}

function set_tool_texts(act_lang) {
	if (act_lang == 'fr') {
		//$('#cat_01_text').html('LES CATÉGORIES 1 (titre de travail) :');
		$('#ligue_text').html('Ligue');
		$('#team_text').html('Équipe');
		$('#franchise_text').html('Franchise');
		//$('#season_text_cat_02').html('LA SAISON 2 (titre de travail) :');
		$('#career_text').html('À vie');
		$('#in_season_text').html('En une saison');
		//$('#season_type_cat_03').html('TYPE DE SAISON 3(titre de travail) :');
		$('#regular_season_text').html('Saison régulière');
		$('#playoffs_text').html('Séries éliminatoires');
		$('#both_seasons').html('Saison et séries');
		$('#nav_notice').html('Les sélecteurs identifiés d’une * sont obligatoires');
		//document.getElementById("search_btn").value="GO (titre de travail)";
		//$('#lang_text').html(BASCULER EN ANGLAIS (test)");
	}
	else {
		//$('#cat_01_text').html('SECTION ONE (temporary head title) :');
		$('#ligue_text').html('League');
		$('#team_text').html('Team');
		$('#franchise_text').html('Franchise');
		//$('#season_text_cat_02').html('SEASON SECTION TWO (temporary head title) :');
		$('#career_text').html('Lifetime');
		$('#in_season_text').html('Single season');
		//$('#season_type_cat_03').html('SEASON TYPE 3 (temp title) :');
		$('#regular_season_text').html('Regular season');
		$('#playoffs_text').html('Playoffs');
		$('#both_seasons').html('Season and playoffs');
		$('#nav_notice').html("Selectors with * are required");
		//document.getElementById("search_btn").value="GO (temp title)";
		//$('#lang_text').html(SWITCH TO FRENCH (test)");
	}
}

function swith_lang() {
	if (p_lang == 'fr') {
		p_lang = 'en'
	} else if (p_lang == 'en') {
		p_lang = 'fr'
	}

	set_tool_texts(p_lang)
}

function get_drop_spec(obj, val) {
	select_exists = false

	select_array = Array('advanced_records', 'third_tool_select', 'forth_tool_select', 'fifth_tool_select', 'sixth_tool_select', 'seventh_tool_select')
	drop_array = Array('drop_second_level', 'drop_third_level', 'drop_forth_level', 'drop_fifth_level', 'drop_sixth_level', 'drop_seventh_level')

	for (i = 0; i < select_array.length; i++) {
		if (document.getElementById(select_array[i])) {
			if (typeof (val) == 'object') {
				f_value = document.getElementById(select_array[i]).value
				f_array = f_value.split("|")

				document.getElementById(drop_array[i]).value = document.getElementById(select_array[i]).options[document.getElementById(select_array[i]).selectedIndex].innerHTML + '@' + 'void|' + f_array[5] + '|' + f_array[4]
			}
			else {
				document.getElementById(obj.id).value = val
			}
		}
		else {
			if (is_main_selector) {
				document.getElementById(drop_array[i]).value = ''
			}
		}
	}
}

function get_section_number(obj, n, bool) {
	document.getElementById(obj.id).value = n
}

function reload_drop_lists(bool, tpe) {
	if (!tpe) {
		tpe = selected_type
	}

	if (bool) {
		if (document.getElementById('drop_second_level').value != '') {
			box_value = document.getElementById('drop_second_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "0")

			get_type_level_and_id(box_value, 'second_tool_selectors.xsl', 'second_level_tool', null, f_selection, true);
		}

		if (document.getElementById('drop_third_level').value != '') {
			box_value = document.getElementById('drop_third_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "1")
			ref_table_filter = value_to_change[2].substring(0, 3)

			if (tpe == "equipe") {
				box_value = box_value.split("|" + ref_table_filter).join("|12E")
			}
			else if (tpe == "franchise") {
				box_value = box_value.split("|" + ref_table_filter).join("|13F")
			}
			else {
				box_value = box_value.split("|" + ref_table_filter).join("|11L")
			}

			get_type_level_and_id(box_value, 'third_tool_selectors.xsl', 'thrid_level_tool', null, f_selection, true);
		}

		if (document.getElementById('drop_forth_level').value != '') {
			box_value = document.getElementById('drop_forth_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "2")
			ref_table_filter = value_to_change[2].substring(0, 2)

			if (tpe == "equipe") {
				box_value = box_value.split("|" + ref_table_filter).join("|2E")
			}
			else if (tpe == "franchise") {
				box_value = box_value.split("|" + ref_table_filter).join("|3F")
			}
			else {
				box_value = box_value.split("|" + ref_table_filter).join("|1L")
			}

			get_type_level_and_id(box_value, 'forth_tool_selectors.xsl', 'forth_level_tool', null, f_selection, true);
		}

		if (document.getElementById('drop_fifth_level').value != '') {
			box_value = document.getElementById('drop_fifth_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "3")
			ref_table_filter = value_to_change[2].substring(0, 2)

			if (tpe == "equipe") {
				box_value = box_value.split("|" + ref_table_filter).join("|2E")
			}
			else if (tpe == "franchise") {
				box_value = box_value.split("|" + ref_table_filter).join("|3F")
			}
			else {
				box_value = box_value.split("|" + ref_table_filter).join("|1L")
			}

			get_type_level_and_id(box_value, 'fifth_tool_selectors.xsl', 'fifth_level_tool', null, f_selection, true);
		}

		if (document.getElementById('drop_sixth_level').value != '') {
			box_value = document.getElementById('drop_sixth_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "4")
			ref_table_filter = value_to_change[2].substring(0, 2)

			if (tpe == "equipe") {
				box_value = box_value.split("|" + ref_table_filter).join("|2E")
			}
			else if (tpe == "franchise") {
				box_value = box_value.split("|" + ref_table_filter).join("|3F")
			}
			else {
				box_value = box_value.split("|" + ref_table_filter).join("|1L")
			}

			get_type_level_and_id(box_value, 'sixth_tool_selectors.xsl', 'sixth_level_tool', null, f_selection, true);
		}

		if (document.getElementById('drop_seventh_level').value != '') {
			box_value = document.getElementById('drop_seventh_level').value;
			box_value_array = box_value.split("@")
			f_selection = box_value_array[0].split("'").join("\'")

			value_to_change = box_value.split("|")
			box_value = box_value_array[1].split(value_to_change[1]).join(tpe + "5")
			ref_table_filter = value_to_change[2].substring(0, 2)

			if (tpe == "equipe") {
				box_value = box_value.split("|" + ref_table_filter).join("|2E")
			}
			else if (tpe == "franchise") {
				box_value = box_value.split("|" + ref_table_filter).join("|3F")
			}
			else {
				box_value = box_value.split("|" + ref_table_filter).join("|1L")
			}

			get_type_level_and_id(box_value, 'seventh_tool_selectors.xsl', 'seventh_level_tool', null, f_selection, true);
		}
	}
}

function hide_this(obj) {
	//alert(obj.id)
	document.getElementById(obj.id).style.display = "none"
	document.getElementById("season_selector").style.display = "none"
	document.getElementById("section02").value = document.getElementById("select_carriere").value
	document.getElementById("select_saison").checked = false
	document.getElementById("select_carriere").checked = true
}

function show_this(obj) {
	document.getElementById(obj.id).style.display = "block"
	//document.getElementById("main_seasons").style.display = "block"
}

function hide_record_movie_div() {
	document.getElementById("record_movie").style.display = 'none';
}

function show_record_movie_div() {
	document.getElementById("record_movie").style.display = 'block';
}

function get_next_selector_label(thisobj, nextobj) {
	if (!document.getElementById(nextobj)) {
		label = null
		get_section_letter(document.getElementById('section04'), document.getElementById(thisobj).value);
	}
	else {
		label = document.getElementById(nextobj).options[document.getElementById(nextobj).selectedIndex].innerHTML
		get_section_letter(document.getElementById('section04'), document.getElementById(nextobj).value);
	}
	return label;
}

function open_window_browser(str) {
	Shadowbox.open({ content: str, width: 1200, height: 800, player: 'iframe' }); return false;
	//this_records_lhjmq = window.open(str, "win_lhjmq", 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,menubar=yes');
	//this_records_lhjmq.focus();
}

function open_window_browser2(str) {
	Shadowbox.open({ content: str, width: 1200, height: 800, player: 'iframe' });
	//this_records_lhjmq = window.open(str, "win_lhjmq", 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,menubar=yes');
	//this_records_lhjmq.focus();
}

function load_pub_sidebar() {
	googletag.cmd.push(function () { googletag.display('div-gpt-ad-1452832437881-1'); });

	if (p_lang == 'fr') {
		var season_date_text = '<h3>Saison en cours ' + selected_season_twodates + '</h3>'
	}
	else {
		var season_date_text = '<h3>Current season ' + selected_season_twodates + '</h3>'
	}

	$("#selected_season_lang").html(season_date_text);

}

function open_window_browser_dynamic(str, str2) {
	if (str2 != '') {
		//Shadowbox.open({ content: str2, width: 1200, height: 800, player:'iframe' });
		//window.open(str2, "win_lhjmq", 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,menubar=yes');

		if (p_lang == 'fr') {
			window.open('https://chl.ca/lhjmq/' + str2, 'win_lhjmq', 'width=1200,height=800,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
		}
		else {
			window.open('https://chl.ca/lhjmq/en/' + str2, 'win_lhjmq', 'width=1200,height=800,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
		}
	}
	else {
		//Shadowbox.open({ content: str, width: 1200, height: 800, player:'iframe' });
		window.open(str, "win_lhjmq", 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,menubar=yes');
	}

	//this_records_lhjmq.focus();
}

function swf_header() {
	//if (!hide_swf_header)
	//{
	// <![CDATA[
	/*
	var so = new SWFObject("swf/loaderRecord.swf", "animation_call", "945", "267", "8", "#ffffff");
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.addParam("allowScriptAccess", "always");

	so.addVariable("f_lang", p_lang);
	so.addVariable("is_home", home);
	so.addVariable("current_page", thisPage);

	so.write("flashcontent");
	*/
	// ]]>
	//}

	document.getElementById("display_search_tool").style.display = "block"
	document.getElementById("page_to_preload").style.display = "block"

	if (document.getElementById("flashcontent")) {
		start_display();
	}
}

function is_main_selector_selection(bool) {

	is_main_selector = bool
}

function manage_available_data() {
	if (document.getElementById('second_tool_select')) {
		if (document.getElementById('second_tool_select').innerHTML == '') {
			document.getElementById('second_level_tool').style.display = 'none'
		}
		else {
			document.getElementById('second_level_tool').style.display = 'block'
		}
	}

	if (document.getElementById('third_tool_select')) {
		if (document.getElementById('third_tool_select').innerHTML == '') {
			document.getElementById('thrid_level_tool').style.display = 'none'
		}
		else {
			document.getElementById('thrid_level_tool').style.display = 'block'
		}
	}

	//WORKING HERE --------------->

	if (document.getElementById('forth_tool_select')) {
		if (document.getElementById('forth_tool_select').innerHTML == '') {
			document.getElementById('forth_level_tool').style.display = 'none'

			var elSel = document.getElementById('third_tool_select');

			if (elSel.value != '-1|||||') {
				if (elSel.selectedIndex >= 0) {
					var elOptNew = document.createElement('option');
					elOptNew.text = p_lang == 'fr' ? '-FILTREZ PAR-' : '-FILTERED BY-';
					elOptNew.value = '-1|||||';
					elOptNew.selected = 'selected';
					var elOptOld = elSel.options[elSel.selectedIndex];
					try {
						elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
					}
					catch (ex) {
						elSel.add(elOptNew, elSel.selectedIndex); // IE only
					}
				}
			}
		}
		else {
			document.getElementById('forth_level_tool').style.display = 'block'
		}
	}

	if (document.getElementById('fifth_tool_select')) {
		if (document.getElementById('fifth_tool_select').innerHTML == '') {
			document.getElementById('fifth_level_tool').style.display = 'none'
		}
		else {
			document.getElementById('fifth_level_tool').style.display = 'block'
		}
	}

	if (document.getElementById('sixth_tool_select')) {
		if (document.getElementById('sixth_tool_select').innerHTML == '') {
			document.getElementById('sixth_level_tool').style.display = 'none'
		}
		else {
			document.getElementById('sixth_level_tool').style.display = 'block'
		}
	}

	if (document.getElementById('seventh_tool_select')) {
		if (document.getElementById('seventh_tool_select').innerHTML == '') {
			document.getElementById('seventh_level_tool').style.display = 'none'
		}
		else {
			document.getElementById('seventh_level_tool').style.display = 'block'
		}
	}
}

$.url = function (name) {
	var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);

	if (results != null) {
		return results[1] || 0;
	}

	return;
}