function Recherche (f){
if (f.rec_critere.value=='') {
	alert("Saisir un critère de recherche.");
	return;
}
f.Query.value = f.rec_critere.value;
Query = f.rec_critere.value;
runPage('../qwiser2/Search.php&Query='+Query);
//f.submit();
}

function changeImage(which,what)
	{
	eval ("document."+which+".src = \""+what+"\";");
	}

function tAdh(adh) {
	/*
	_________________________________________________________________
	
		_>>	Cette fonction vérifie la structure du numero d'adherent
		
		__?	Paramètre :
				-	adh numero d'adherent
	
		-->	Cette fonction retourne false si la structure n'est pas verifié
	_________________________________________________________________
	
	*/

	if ( adh == "" ) return false;
	t = adh.split("-",2);

	if ((t[0].length > 2) || (t[1].length > 8)) return false;
	else if ( (!(t[0]==5) && !(t[0]==16) && !(t[0]==6)) || (!tNum(t[1],t[1].length)) ) return false;

	return true; 
}

function tNum(n,nb) {
	/*
	_________________________________________________________________
	
		_>>	Cette fonction verifie que la chaine de caractere est un entier d'une certaine longueur
		
		__?	Paramètre :
				-	adh numero d'adherent
	
		-->	Cette fonction retourne false sinon
	_________________________________________________________________
	
	*/

	if ( n.length != nb ) return false;
	else
	{
		ok = 1;
		car = "0123456789";
		i = 0; 
		while( (ok == 1) && (i < nb) ){
			if(car.indexOf(n.charAt(i)) >= 0 ) i++;
			else
			{
				ok = 0;
				return false;
			}
		}
		return true;
	}
}


function checkDate (strDate,compareToToday)
	{
	/*
	_________________________________________________________________
	
		_>>	Cette fonction vérifie la validité d'une date
		
		__?	Paramètre :
				-	strDtae : une date sous forme STRING
				-	compareToToday : booléen indiquant si la date entrée doit être comparée
					à la date du jour
	
		-->	Cette fonction retourne false si la chaîne passée n'est pas une date
	_________________________________________________________________
	
	*/
	
	var ardate = strDate.split ("\/");
	
	var dstring = ardate [0];
	var mstring = ardate [1];
	var ystring = ardate [2];
	
	strDate = mstring+"/"+dstring+"/"+ystring;
	
	var d = parseInt (dstring);
	var m = parseInt (mstring);
	var y = parseInt (ystring);
	
	if ( (dstring.length != 2) || (mstring.length != 2) || (ystring.length != 4) )	{	return false;	}
	var mref = ( ( (m == 1) || (m == 3) || (m == 5) || (m == 7) || (m == 8) || (m == 10) || (m == 12) ) ? 31 : (m == 2) ? 29 : 30 );
		
	if ( d >= mref )	{	return false;	}
	
	if (compareToToday)
		{
		var cd = new Date ();
		var md = new Date (strDate);
		if (md < cd )	{	return false;	}
		}
	
	return true;	
	}//Fin de la fonction checkDate()
	
	
	
function DFViewer(url,wname,x,y,w,h,resizable,scrollbars)
	{
	
	w = ( ( (w == "") || (!w) || (w == null) ) ? "300" : w);
	h = ( ( (h == "") || (!h) || (h == null) ) ? "400" : h);
	resizable = ( ( (resizable == "") || (!resizable) || (resizable == null) ) ? "yes" : "no");
	scrollbars = ( ( (scrollbars == "") || (!scrollbars) || (scrollbars == null) ) ? "yes" : "no");
	
	var win = window.open (url,wname,"location=no,toolbar=n,directories=no,menubar=no,top="+y+",left="+x+",resizable="+resizable+",scrollbars="+scrollbars+",status=no,width="+w+",height="+h);
	win.moveTo (x,y);
	win.focus();

	}


//------pop-up------------
function openwin (windowURL,width,height)
	{
	if (windowURL == 'click-call') {windowURL = 'http://online.click-call.com/click-call.com/docs/clickCall28sep/index.php?fuseaction=user.welcome&page=MTQyNzE=';}
	window.open(windowURL,'articles','toolbar=no,location=no,menuBar=0,scrollBars=0,resizable=0,width='+width+',height='+height);
	}

function scanEmail (email,trgt)
	{
	var re = /[a-zA-Z0-9._\-]{1,}[@]{1}[a-zA-Z0-9._\-]{1,}[.]{1}[a-zA-Z0-9.]{2,6}/
	var test = re.exec(email);
			
	if ( (test  != email) && (email != "") )
		{
		eval("document."+trgt+".focus();");
		return false;
		}
	return true;
	}
	  


/*
DFViewer ("pop_adherent.html","pop1",20,30,400,400,"no","no");
<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/glm.js"></SCRIPT>

<A HREF="JavaScript:DFviewer ('url1','nom1',20,20,300,300,'no','no');DFviewer ('url2','nom2',20,20,300,300,'no','no');window.open ('url','_self');">lien</A>

DFviewer ('url','nom');

<SCRIPT LANGUAGE="JavaScript">

moveTo (20,20);
resizeTo(300,300);

</SCRIPT>
*/	
  



/*
Script du formulaire adhésion (adhesion1.php en include dans le page adhesion_01a.php)																						   

--- fonction ajoutant un livre dans le champ------																		  
*/

SOUSTOTAL_F = 0.00;
SOUSTOTAL_E = 0.00;

function updateField (title,prizeF,prizeE)
	{	  
	var prixF = parseFloat (prizeF);	
	var prixE = parseFloat (prizeE);
																						  
	var df = document.form;								 														   
	
	SOUSTOTAL_F += prixF;
	SOUSTOTAL_E += prixE;							   
	
/* ---------boucle permettant d'évaluer un champ vide afin de le remplir; de calculer
la somme des prix en sous-total, total et reste sur 400*/

	for ( alpha = 0 ; alpha < 9 ; alpha ++ ) 											  
	 {				  
	 val = "df.control"+alpha+".value";
	 eval ("current = parseInt ("+val+");");
	 if (current == 0 )
	 	{
		eval ("df.titre"+alpha+".value = \""+title+"\";");
		eval ("df.prix"+alpha+"F.value = \""+prizeF+" F\";");
		eval ("df.prix"+alpha+"E.value = \""+prizeE+" €\";");	
																		
		df.soustotalF.value = SOUSTOTAL_F + " F";
		df.soustotalE.value = SOUSTOTAL_E + " €";												  
		
		var total_F = ( (SOUSTOTAL_F <= 400.00) ? 0.00 : (SOUSTOTAL_F - 400.00) );
		var total_E = ( (SOUSTOTAL_F <= 400.00) ? 0.00 : (SOUSTOTAL_E - 60.98) );
		df.totalF.value = total_F + " F";
		df.totalE.value = total_E + " €";										  
		
		var reste_F = ( (SOUSTOTAL_F > 400.00) ? 0.00 : (400.00 - SOUSTOTAL_F) );
		var reste_E = ( (SOUSTOTAL_F > 400.00) ? 0.00 : (400.00 - SOUSTOTAL_E) );
		df.resteF.value = reste_F + " F";
		df.resteE.value = reste_E + " €";
				
		eval ("df.control"+alpha+".value = 1;");												 
/*boucle permettant de supprimer un livre du champ
	 	valsup = "df.cb"+alpha+".checked";
	 	eval ("currentBox = parseInt ("+valsup+");");
	 	if (currentBox == true )
	 		{
			"df.titre" + alpha + ".value" = 0;
			"df.prix" + alpha + "F.value" + " F" = 0;
			"df.prix" + alpha + "E.value" + " €" = 0;
			eval ("df.cb"+alpha+".value = 0;");
			return;
			}				 
fin de la boucle suppression*/			
		return;
		}
	 if (alpha == 8 )
		{
		window.alert ("Vous n'avez droit qu'à neuf livres au maximum");
		return;
		}		   

		
	 }	 
	}
