

function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_preloadImages() {
  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_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function MM_swapImgRestore() {   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_findObj(n, d) { 
  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_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_swapImage() { 
  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 RandomPic(){	return Math.round((Math.random()*1)+1)+".jpg"; }

function breakFrames(){	if (window != top) top.location.href = location.href;}


function VerifMail(texte)
{
var test="" + texte;
if (test!="")
	{
   	var suite=1;
   	for(var k = 0; k < test.length;k++)
    	{
    	var c = test.substring(k,k+1);
    	if(suite == 1 && c == "@") {suite=0;}
    	if (suite == 0 && c == "." && k<(test.length-1)) {suite = 2;}
    	}
   	if (suite != 2)
    	{
    	return false;
    	}
   	}
return true; 
}	

function VerifDate(texte)
	{
	var tableau = texte.split("/");
	if (tableau.length<3) {return false;}
	
	jour  = tableau[0];
	mois  = tableau[1];
	annee = tableau[2];
	
	if (jour.length<2) {return false;}
	if (mois.length<2) {return false;}
	if (annee.length<2) {return false;}
	
	if (isNaN(jour)) {return false;}
	if (isNaN(mois)) {return false;}
	if (isNaN(annee)) {return false;}
	
	return true;
	} 
	
function VerifHeure(texte)
	{
	var tableau = texte.split(":");
	if (tableau.length<3) {return false;}
	
	heure   = tableau[0];
	minute  = tableau[1];
	seconde = tableau[2];
	
	if (heure.length<2) {return false;}
	if (minute.length<2) {return false;}
	if (seconde.length<2) {return false;}
	
	if (isNaN(heure)) {return false;}
	if (isNaN(minute)) {return false;}
	if (isNaN(seconde)) {return false;}
	
	return true;
	} 	
	
function VerifVersionWin()
	{
	var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
	
	if (win_ie_ver>= 5.5) 	return true;
	else					return false;
	}	 

function supprimer_fichier(nom_fichier,repertoire,page)
   	{
   	if (confirm("Confirmez vous la suppression du fichier?"))
      	{
      	document.forms[0].fichier_repertoire.value  = ""+repertoire;
      	document.forms[0].fichier_supprimer.value   = ""+nom_fichier;
     	document.forms[0].action = page+"?action_fichier=fichier";
      	document.forms[0].submit();
      	}
   	return false;
   	}	
	
	
	
// Multiple file selector by Stickman -- http://www.the-stickman.com
function MultiSelector(list_target,max,file_name)
	{
	this.list_target=list_target;
	this.count=0;this.id=0;
	
	if(max)
		{
		this.max=max;
		}
	else
		{
		this.max=-1;
		};
	
	this.addElement=function(element)
		{
		if(element.tagName=='INPUT' && element.type=='file')
			{
			element.name=file_name+'_'+this.id++;
			element.multi_selector=this;
			element.className='style_16';
			element.onchange=function()
				{
				var new_element=document.createElement('input');
				new_element.type='file';
				this.parentNode.insertBefore(new_element,this);
				this.multi_selector.addElement(new_element);
				this.style.display='none';
				this.multi_selector.addListRow(this);
				};
			if( this.max != -1 && this.count >= this.max )
				{
				element.disabled=true;
				};
			
			this.count++;this.current_element=element;
			}
		else
			{
			alert('Error: not a file input element');
			};
		};
	this.addListRow=function(element)
		{
		var new_row=document.createElement('div');
		var new_row_button=document.createElement('input');
		new_row_button.type='button';
		new_row_button.value='Delete';
		new_row.element=element;
		new_row_button.onclick=function()
			{
			this.parentNode.element.parentNode.removeChild(this.parentNode.element);
			this.parentNode.parentNode.removeChild(this.parentNode);
			this.parentNode.element.multi_selector.count--;
			this.parentNode.element.multi_selector.current_element.disabled=false;
			};
		new_row.innerHTML=element.value;new_row.appendChild(new_row_button);
		this.list_target.appendChild(new_row);
		};
	};	
	
function VerifFile(fichier_parametre)
	{
	
	var chaine_nom = fichier_parametre;
	tab = chaine_nom.split("\\");
	if(tab[1]=="")
		{
		var tab = chaine_nom.split("/");
		}
	var nom_image = tab[tab.length-1];
	caract = escape(nom_image);
	var verif = caract.indexOf("%");
	if(verif!=-1)
		{
		return false;
		}
	else
		{
		return true;
		}	
	}
	
