$(document).ready(function() {

	$('#menu-haut li').each(function() {
 		$(this).mouseover(function(){$('ul', this).show();}).mouseout(function(){$('ul', this).hide();});
 	});
 
 	$('#menu-haut > li ').each(function() {
 		$(this).mouseover(function(){$('a',this).addClass("mhover");}).mouseout(function(){$('a',this).removeClass("mhover");});
 	});
 	
 	/*$('#annuaire-gauche table').each(function() {  		
 		$('tr:has(td)').filter(':even').addClass('even'); 	
 		$('tr:has(td)').filter(':odd').addClass('odd');	
 	}); */
 	/*$("ul#phrasescroll").liScroll(); */
 	
 	//initialisation du select
 	$("#search_chp_19").val($("#keywords").val());

});

var tableau_l=new Array();

function clicZone(id_localisation,nom,actif){

	var chaine="";
	if (actif==true){
		tableau_l[id_localisation]=true;
	}else{
		tableau_l[id_localisation]=false;
		/*$("#rlocalisation_n"+id_localisation).remove();*/
	}
	for (var i in tableau_l){ 
		if (tableau_l[i]==true) chaine+=i+",";
	}

	//insertion dans le champ input
	$("#idLocalisation").val(chaine.substr(0,chaine.length-1));
	
}


function deselectionnerAllZone() {
	$("#idLocalisation").val('');
	for (var i in tableau_l) tableau_l[i]=false;
}


function selectionnerZone(){
	if (getMovieName("cartographie").setSelectionZone!=null) {
		getMovieName("cartographie").setSelectionZone($("#idLocalisation").val());
		
	} 

}

function getMovieName(movieName) {
	return document.getElementById(movieName);
}



function PlayVideo(num){
	document.getElementById("player-video").SetVariable("player:jsPlay", num);
}

//appelé par les selects de champ ou de categorie
function searchByCategorie(id_categorie,nameS) {
	$("#f_keywords").val($("#search_chp_19").val());
	//$("#keywords").val(id_categorie);
	//$("#typeFiltre").val('keywordCatLoc');
	$("#form_filiere").submit();
}

function ann_valid_form()
{
	$("#id_localisation").val($("#idLocalisation").val());
	$("#cherchable").val("_Y");
	
	var annu="";
	if ($("#search_annu_2").prop("checked")==true){
		annu+=$("#search_annu_2").val()+",";
	}	

	if ($("#search_annu_3").prop("checked")==true){
		annu+=$("#search_annu_3").val()+",";
	}
	
	annu=annu.substring(0,annu.length-1);
	
	
	if ($("#keywords").val()!=""){
		$("#cherchable_id_annu").val(annu);
		$("#cherchable").val("_Y");
	}else {
		$("#cherchable_id_annu").val("");
		$("#cherchable").val("");
	}
	
	$("#id_annuaire").val(annu);
	$("#id_champ").val('');		
	//$("#typeFiltre").val('keywordCatLoc');
	return true;
}

