function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function PSR_imprimer () { 
    var PSR_f1 = null; 
    var PSR_content=document.getElementById('PSR_print').parentNode.innerHTML; 
    var PSR_title=document.getElementsByTagName('title')[0].innerText; 
	var url=window.location.href;
    /*var domaine=url.substring(44,url.indexOf("/",44));// permet de prendre le nom de la marque dans l'url de la page courante
	var domaine2=url.substring(25,url.indexOf("/",25));// permet de prendre le nom de la bu dans l'url de la page courante
	var up = url.substring(25,url.indexOf(".php",25));*/
	var tab = url.split('/');
	if(tab.length > 2)
		var css = 'style_marque_'+tab[tab.length-2]+'.css';
	else var css = 'style_auto.css';
    if (PSR_f1) {if(!PSR_f1.closed) PSR_f1.close();} 
    PSR_f1 = window.open ('',"PSR_f1", "height=700,width=540,menubar=yes,scrollbars=yes,resizable=yes,,left=10,top=10"); ; 
    PSR_f1.document.open();
    PSR_f1.document.write("<html><head><title>" + PSR_title + "</title><link href=\"../../../css/"+css+"\" rel=\"stylesheet\" type=\"text/css\"></head><body bgcolor='#ffffff' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onLoad='javascript:print()'><!--<img src=\"images/logo_print.gif\" >--><table width=\"654\" cellpadding=\"10\" cellspacing=\"0\"><tr><td><table>"+PSR_content+"</table></td></tr></table></body></html>"); 
    PSR_f1.document.close(); 
    //PSR_f1.document.getElementById('PSR_print').style.visibility='hidden'; 
    PSR_f1.focus(); 
}

function launch_res() {
	document.recherche.submit();
}
function isEmpty(aValue){
		iLength = aValue.length;
		if (iLength != 0) return false;
		return true;
	}
	
	function isEmail(aValue, iNullAllowed) {
		iLength = aValue.length;
		if (iLength == 0 && iNullAllowed == 1) { return true; }
		var tabData=aValue.split(",");
		for(i=0; i<tabData.length; i++) {
			re = /^[a-zA-Z0-9_.\-]+\@[a-zA-Z0-9_.\-]+\.[a-zA-Z0-9_\-]+$/;
			iSearch = re.exec(tabData[i]);
			if (iSearch == null) { return false; }
		}	
		return true;
	}
							
	function soumettre(){
		with(document.formulaire){
						
			if (isEmpty(nom_mabo.value)) {
				alert(''+saisir_nom.value+'');
				nom_mabo.focus();
				return;
			}
			
			if (isEmpty(pren_mabo.value)) {
				alert(''+saisir_prenom.value+'');
				pren_mabo.focus();
				return;
			}
			
			if (isEmpty(mail_mabo.value)) {
				alert(''+saisir_mail.value+'');
				mail_mabo.focus();
				return;
			}
			
			if( !isEmpty(mail_mabo.value) && !isEmail(mail_mabo.value)  ) {
				alert(''+mail_faux.value+'');
				mail_mabo.focus();
				return;
			}
			
			if(isEmpty(media_mabo.value)) {
				alert(''+saisir_media.value+'');
				media_mabo.focus();
				return;
			}

			retour.value='validation';
			submit();
		}
	}
	
	function soumettre2(){
		with(document.formulaire){
						
			if (isEmpty(nom_mabo.value)) {
				alert(''+saisir_nom.value+'');
				nom_mabo.focus();
				return;
			}
			
			if (isEmpty(pren_mabo.value)) {
				alert(''+saisir_prenom.value+'');
				pren_mabo.focus();
				return;
			}
			
			if (isEmpty(mail_mabo.value)) {
				alert(''+saisir_mail.value+'');
				mail_mabo.focus();
				return;
			}
			
			if( !isEmpty(mail_mabo.value) && !isEmail(mail_mabo.value)  ) {
				alert(''+mail_faux.value+'');
				mail_mabo.focus();
				return;
			}
			
			
			retour.value='validation_finance';
			submit();
		}
	}
	
	
/*
var NbElement_Rub2=<?=$res_rub2?>;


function closeOthers(keepit) {
	
	for(var t=1; t<=NbElement_Rub2; t++) {
		
		if(t!=parseInt(keepit)) {

			toggle_collapse('cell_'+t, 'close');
			
		} else {

			toggle_collapse('cell_'+t, 'open');
		}
	}
}

function closeAll() {

	for(var t=1; t<=NbElement_Rub2; t++) {
		
		toggle_collapse('cell_'+t, 'close');
		
	}
}

*/
function launch_res() {
	document.recherche.submit();
}
/*
function closeOthers(keepit,keepit2) {	
	
	//for(var t=1; t<=NbElement_Rub2; t++) {
	<?			
	$i=0;
	while($i<count($TableauIdRub1)) {
	
		$IdRub1=$TableauIdRub1[$i];
		
		if ($TableauLieuRub1[$IdRub1]=='G') { 
	
			if (count($TableauIdRub2[$IdRub1])>0) { 
				$a=0;
				while($a<count($TableauIdRub2[$IdRub1])) {
				
					$IdRub2=$TableauIdRub2[$IdRub1][$a];
		?>
			
						if(<?=$IdRub1?>!=parseInt(keepit)) {

							toggle_collapse('cell_R1_<?=$IdRub1?>_<?=$IdRub2?>', 'close');
							toggle_collapse('cell_R2_<?=$IdRub1?>_<?=$IdRub2?>', 'close');
													
						} else {

							toggle_collapse('cell_R1_<?=$IdRub1?>_<?=$IdRub2?>', 'open');
													
							if(<?=$IdRub2?>!=parseInt(keepit2)) {
							
								toggle_collapse('cell_R2_<?=$IdRub1?>_<?=$IdRub2?>', 'close');
							
							}else{
							
								toggle_collapse('cell_R2_<?=$IdRub1?>_<?=$IdRub2?>', 'open');
							
							}
							
						}
			
			
			<?
					$a++;
					}
				}
			}
		$i++;
		}
		?>
	//}
}*/
