// Pour enlever la chaine inscrite a l'avance dans un "input text" (qui doit debuter par '[') 
function viderBoite(boite) {
// Luc Grondin   // 
  if (boite.value.charAt(0) == "[") { boite.value = ""; }
}

function validerRecherche(){
           

            var texteRecherche = document.getElementById("texteRecherche");	  
        
	if  (texteRecherche.value ==""){
	 
		texteRecherche.focus();
		return false;
	}else{
		return true;
	}

}


function validerRecherchePageAccueil(){

            var texteRecherche = document.getElementById("mots");	  
        
	if  (texteRecherche.value ==""){
	 
		texteRecherche.focus();
		return false;
	}else{
		return true;
	}

}


function montrerBloc(  blocMontrer , blocFleche){
				
				var elemLI = document.getElementById(  blocMontrer );
				if( elemLI.style.display == "block"    ){ 
					elemLI.style.display = "none"; 
					document.getElementById(blocFleche).style.backgroundImage = 'url(/images/flecheOuvrir.png)' ;  
					document.getElementById(blocFleche).style.backgroundRepeat = 'no-repeat' ;  
					
				}
				else { 	
				    elemLI.style.display = "block"; 
					
					/* document.getElementById(blocFleche).style.backgroundImage = 'url(/revue/images/flecheFermer.png)' ;  */
					document.getElementById(blocFleche).style.backgroundImage = 'url(/images/flecheFermer.png)' ;  
					document.getElementById(blocFleche).style.backgroundRepeat = 'no-repeat' ;  
				} 

				 
			}
		


function ajusterBloc(  blocMontrer , blocFleche){

	
	var fooSpace = document.getElementById("espaceBas") ; 
	var elemLI = document.getElementById("blocDiscipline");


	if(  elemLI.style.display == "block"    || ( document.location.href.lastIndexOf("lettre=") > 0  ||  document.location.href.lastIndexOf("discipline=")  > 0  ) ){
 
		fooSpace.style.height = "500px";
	}else{
		fooSpace.style.height = "0px";
		}
}
			
			
				
 
 function accesRapide(){
 	 
 	 
 	var zeForm = document.getElementById("formAccesRapide");
 	var zeSelect = document.getElementById("rechercheRevue");
 	
 	if(zeSelect.value != '' ){
 		zeForm.action = "/recherche/" + zeSelect.value + "/";
 		zeForm.submit();
 	}else {
 		zeForm.action = "/recherche/" ;
 		zeForm.submit();
 		}
   	return false ;
  
 }
 
 function panierExport( action ){
 
 	var zeForm = document.getElementById("lesarticles");
  	
  	 	
  	 	
  	if( action == 1 ){
 	 	 zeForm.action = '/exporter/html' ; 
	
  	}
  	
  	if( action == 2 ){
  		zeForm.action = '/exporter/endnote.ciw' ;
  	
  	}
	if(action == 3 ){
 		 zeForm.action = '/exporter/expt.txt' ; 	
  	}
  	
  	if( action == 4 ){
  		zeForm.action = '/exporter/refworks.html' ;
  	
  	}
  	
  	if( action == 5 ){
  		zeForm.action = '/exporter/imprimernotice' ;
  	
  	}
	
	/*
  	if( action == 4 ){
  			
  			setDivVisible('emailChamps' , 'block' );
  			zeForm.action = '/panier/exporter.jsp'
  			
  	}
  	if(  zeForm.actions.selectedIndex != 4) {
	 	 	setDivVisible('emailChamps' , 'none' );
  	}
  	*/
  	
  	if(action == 0   ) {
  		zeForm.action = '/panier/' ;
  		document.getElementById("hiddenAction").value = "enlever" ;
  	}
  
 	zeForm.submit();
 }
 
 function panierSelect( form ) {
  
 	var zeForm = document.getElementById(form);
 	
 	
 	
 	if( zeForm.actions.selectedIndex == 3 ){
		 zeForm.action = '/exporter/expt.txt' ; 	
 	}
 	
 	
 	if( zeForm.actions.selectedIndex == 1 ){
	 	 zeForm.action = '/exporter/html' ; 	
 	}
 	
 	if( zeForm.actions.selectedIndex == 2 ){
 		zeForm.action = '/exporter/endnote.ciw' ;
 	
 	}
 	/*if( zeForm.actions.selectedIndex == 2 ){
 			
 			setDivVisible('emailChamps' , 'block' );
 			zeForm.action = '/panier/exporter.jsp'
 			
 	}*/
 	
 	if( zeForm.actions.selectedIndex == 0   ) {
 			zeForm.action = '/panier/' ;
 	}
 	if(  zeForm.actions.selectedIndex != 2) {
	 	setDivVisible('emailChamps' , 'none' );
 	}
 
 }


 function newCheck( formid , trueOrFalse ){
 	
	var lediv = document.getElementById(formid);
	loopchildrens(lediv , trueOrFalse) ;  
}

function loopchildrens(element , trueOrFalse ){

  var children = element.childNodes;  

  for(var c=0; c < children.length; c++) {
       
      
       if(children[c].type == "checkbox"){
       		children[c].checked = trueOrFalse ; 
       }
       
       
       if( children[c].childNodes.length > 0 ){
 
          loopchildrens(children[c] , trueOrFalse );
       }
     }
}


function setDivVisible(divId , visible ){
 
 document.getElementById(divId).style.display = visible ;
}



function setEmailFrameVisible(){

	document.getElementById("emailframe").src="/exporter/envoyernotice" ;		
	document.getElementById("emailframe").style.display="block" ;	

}


/** 
   Pour ouvrir une fenetre distincte
   Luc Grondin
*/
function fenetre2(uri,dimx,dimy,barre,nom) {
  if (barre == 1) {  // si barre est 1, on produit une fenetre depouillee
    if (!nom) { nom = 'fenx1'; }
    f=window.open(uri,nom,'toolbar=no,width='+dimx+',height='+dimy+',directories=0,status=0,scrollbars=1,resizable=1,menubar=0');
  }
  else if (barre == 2) {  // si barre est 2, on produit une fenetre depouillee, mais avec boutons de navigation
    if (!nom) { nom = 'fenx2'; }
    f=window.open(uri,nom,'toolbar=yes,location=no,width='+dimx+',height='+dimy+',directories=0,status=0,scrollbars=1,resizable=1,menubar=0');
  }
  else if (barre == 3) {  // si barre est 3, on produit une fenetre depouillee, mais avec menu suprieur
    if (!nom) { nom = 'fenx3'; }
    f=window.open(uri,nom,'toolbar=no,location=no,width='+dimx+',height='+dimy+',directories=no,status=0,scrollbars=yes,resizable=yes,menubar=yes');
  }
  else if (barre == 4) {  // si barre est 4, on produit une fenetre avec menu suprieur et boutons de navigation, mais pas URL
    if (!nom) { nom = 'fenx4'; }
    f=window.open(uri,nom,'toolbar=yes,location=no,width='+dimx+',height='+dimy+',directories=no,status=no,scrollbars=yes,resizable=yes,menubar=yes');
  }
  else if (barre == 5) {  // si barre est 5, on produit une fenetre avec menu suprieur et boutons de navigation (incl. URL)
    if (!nom) { nom = 'fenx4'; }
    f=window.open(uri,nom,'toolbar=yes,location=yes,width='+dimx+',height='+dimy+',directories=no,status=no,scrollbars=yes,resizable=yes,menubar=yes');
  }

  else {
    if (!nom) { nom = 'fenx5'; }
    f=window.open(uri,nom);
  }
}

