
function open_pdf(the_form, menu)
{
	if (the_form.country.selectedIndex == 0)
	{
		alert('Please choose a country');
	}
	else
	{
		s_met = menu;
		s_country = the_form.country[the_form.country.selectedIndex].value
		window.open (s_met + '/' + s_country + '/' + s_met + '_' + s_country + '.pdf', 'Pdf', 'scrollbars=yes,status=no,width=700,height=500,top=40,left=120,resizable=yes')
	}
}




function _search(the_form)
{
// 	if(the_form.Branch)   the_form.h_Branch.value = the_form.Branch.options[the_form.Branch.selectedIndex].text;
// 	if(the_form.Service)  the_form.h_Service.value = the_form.Service.options[the_form.Service.selectedIndex].text;
//	if(the_form.SService) the_form.h_SService.value = the_form.SService.options[the_form.SService.selectedIndex].text;
// 	if(the_form.IService) the_form.h_IService.value = the_form.IService.options[the_form.IService.selectedIndex].text;
	the_form.submit();
}



function _reload(the_select, myVar, ScriptName)
{
	value = the_select.options[the_select.options.selectedIndex].value;
	if(value=='') _reset(myVar,ScriptName);
	else location.replace(ScriptName + '?' + myVar + '='+value);
}


function _reset(myVar, ScriptName)
{
	location.replace(ScriptName + '?' + myVar + '=reset#recherche');
}


function reset_all(ScriptName)
{
	location.replace(ScriptName + '?reset=all');
}





function _search_RI(the_form) {
	valid = false;
	if (document.search.branch.value != 0) {
		if (the_form.radionuclide){if (the_form.radionuclide.value != '') 	{valid=true}}
		if (the_form.quantity) 	{if (the_form.quantity.selectedIndex != 0){valid=true}}
		if (the_form.medium) 	{if (the_form.medium.selectedIndex != 0) 	{valid=true}}
		if (the_form.source) 	{if (the_form.source.selectedIndex != 0) 	{valid=true}}
		if (the_form.country_sel)  	{if (the_form.country_sel.selectedIndex != 0) 	{valid=true}}
		if(!valid) {
			alert('Without any selection there would be too many responses to display.\nPlease choose at least one item.');
		}
		else {
			the_form.submit()
		}
	}
	else {
		alert('Please choose one branch among the proposed list');
	}
}


//---------------------------------------------------------------
// JAVASCRIPT QM
//---------------------------------------------------------------

//Category = OTHERS
function open_pdf_QM_1(the_form, s_met)
{
 	if ((the_form.category.selectedIndex == 0) && (the_form.country.selectedIndex == 0))
	{
		alert('Please, choose one country and one category');
	}
 	else if (the_form.country.selectedIndex == 0)
	{
 	 	alert('Please, choose one country');
	}
 	else if (the_form.category.selectedIndex == 0)
	{
		alert('Please, choose one chemical category');
	}
 	else
	{
		 s_country = the_form.country[the_form.country.selectedIndex].value;
 		 s_category = the_form.category[the_form.category.selectedIndex].value;
 		 window.open (s_met + '/' + s_country + '/' + s_met + '_' + s_country + '_' + s_category + '.pdf', 'Pdf', 'scrollbars=yes,status=no,width=700,height=500,top=40,left=120,resizable=yes');

	}
}



//Category = PH and electrolyte
function open_pdf_QM_2(the_form, s_met)
{
	if (the_form.country.selectedIndex == 0)
	{
		alert('Please, choose one country');
	}
	else
	{
 		s_country = the_form.country[the_form.country.selectedIndex].value;
		window.open (s_met + '/' + s_country + '/' + s_met + '_' + s_country + '_6_7.pdf', 'Pdf', 'scrollbars=yes,status=no,width=700,height=500,top=40,left=120,resizable=yes')
 	}
}





function _search_QM_1(the_form)
{
	if (the_form.Analyte.value == 0)
	{
		alert('Please enter an analyte or component keyword in the search box.');
		//alert('Without any selection there would be too many responses to display.\nPlease choose at least one item.');
	}
	else
	{
		the_form.action = "search.asp?met=QM#search";
	 	the_form.submit()
	}
}



function _search_QM_2(the_form)
{
	the_form.s_Quantity.value = the_form.Quantity.options[the_form.Quantity.selectedIndex].text;
	the_form.action = "country_list_QM.asp";
 	the_form.submit()
}



function _searchAnalyte(the_form) {
	var compteur
	compteur = 0

	for ( var i=0; i < the_form.length ; i++)
	{

		// Les champs de type CheckBox
		if (the_form.elements[i].type == "checkbox" && the_form.elements[i].name=='Result')
		{
			if (the_form.elements[i].checked == true)
			{
				compteur = compteur + 1;
			}
		}
	}

	if (compteur == 0 )
		alert("Please select at least one analyte");
	else
	{
		the_form.action = "country_list_QM.asp";
		the_form.submit()
	}
}




function select_all(the_form) {
		// Parcours de tout les elements du formulaire
		for ( var i=0; i < the_form.length ; i++) {
			// Les champs de type CheckBox
			if ( the_form.elements[i].type == "checkbox" && the_form.elements[i].name=='Result') {
				the_form.elements[i].checked = true
			}
		}
}


function unselect_all(the_form) {
		// Parcours de tout les elements du formulaire
		for ( var i=0; i < the_form.length ; i++) {
			// Les champs de type CheckBox
			if ( the_form.elements[i].type == "checkbox" && the_form.elements[i].name=='Result') {
				the_form.elements[i].checked = false
			}
		}
}

