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 border_rouge(nom){
		window.document.getElementById(nom).style.border = "thin solid #FF0000";
}





function border_normale(nom){
window.document.getElementById(nom).style.borderWidth = '';
window.document.getElementById(nom).style.borderStyle = '';
window.document.getElementById(nom).style.borderColor = '';
}





function verify_form(arr){

for(i=0;i<arr.length;i++){border_normale(arr[i].id);};
var	ok=1;
var msg='.';

for(i=0;i<arr.length;i++){
	if(arr[i].value==""){border_rouge(arr[i].id);ok=0;};					// On test si le champs est rempli
	if((arr[i].id.indexOf("mail")>-1) || (arr[i].id.indexOf("Mail")>-1)){	// Si c'est un mail on teste la validité du mail
		adresse_email = arr[i].value;arobase = adresse_email.indexOf("@");point = adresse_email.indexOf(".",arobase);mauvais_endroit_point = arobase+1;
		double_point = adresse_email.indexOf("..",arobase);nbr_carac = adresse_email.length - point;double_arobase = adresse_email.indexOf("@",arobase+1);
		if((arobase < 1) || (point <= mauvais_endroit_point) || (adresse_email.length < 5) || (double_point >= 0) || (nbr_carac < 3) || (double_arobase >= 0))
		{msg=l_email_n_est_pas_valide;ok=0; border_rouge(arr[i].id);}
	}
};//for

	if(ok==0){alert(les_champs_en_rouge_sont_necessaires+msg);arr[0].focus();return false}
	if(ok==1)return true
}



function fc_port()
{
var radio_choice = false;
for (i = 0; i < window.document.forms.bon.frais_de_port.length; i++)
{
if (window.document.forms.bon.frais_de_port[i].checked)radio_choice = true; 
}

if (!radio_choice)
{
alert(veuillez_choisir_mode_expedtion);return false;
}
return true;
}




function cheque(){
	if(	window.document.forms.bon.conditions_vente.checked){
		window.open('blank.php', 'securecleserv','width=640,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
		window.document.forms.bon.target='securecleserv';
		window.document.forms.bon.type_paiement.value='Chèque';
		window.document.forms.bon.action='impression.php';
		return true;
	}
	else{
		alert(veuillez_accepter_les_cgv_avant_de_commander);
		return false;
	}
}



// SPECIFIQUE PIERREDOM 
function cheque_exclu(){
	if(	window.document.forms.bon.conditions_vente.checked){
		window.open('blank.php', 'securecleserv','width=640,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
		window.document.forms.bon.target='securecleserv';
		window.document.forms.bon.type_paiement.value='Chèque';
		window.document.forms.bon.action='impression_exclusivites.php';
		return true;
	}
	else{
		alert(veuillez_accepter_les_cgv_avant_de_commander);
		return false;
	}
}
// SPECIFIQUE PIERREDOM 


function carte_bleue_privee(){
	if(	window.document.forms.bon.conditions_vente.checked){
		window.open('blank.php', 'securecleserv','width=720,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
		window.document.forms.bon.target='securecleserv';
		window.document.forms.bon.type_paiement.value='Carte Bleue Aut';
		window.document.forms.bon.action='commande_transfert_ssl.php';
		return true;
		//window.document.forms.bon.submit();
	}
	else{
		alert(veuillez_accepter_les_cgv_avant_de_commander);
		return false;
	}
}


function id2element(id)
{
    if (!document.getElementById)return;
    if (document.all)return eval("document.all." + id);
    else
    return document.getElementById(id);
}



function toggle(id,type,collapse) 
{
	var x = window.document.getElementsByTagName(type);
		if(collapse==1){
			for (var i=0;i<x.length;i++){	x[i].style.display = 'none'; }
		}
	id2element(type + id).style.display = (id2element(type + id).style.display == "none" ? "block" : "none");
}







var TextesDefilants=new Array();
  	function TexteDefilant(tmpPasDefil,TempsAffichage,tmpLargeur,tmpHauteur,tmpDirection,tmpIndexDeDepart,tmpControleTitre)
  	{
//Définit et initialise les vaiables passées en paramètre
		this.PasDefil = 1
  		this.TimerDefile = null;
  		this.TableauTextes = new Array()
  		this.TableauTitres = new Array()
  		this.IndexEnCours = 0;
  		this.IndexEnPrecedent = -1;
  		this.Largeur = "100%";
  		this.Hauteur = "100%";
  		this.Direction = "UP";
		this.ControleTitre = tmpControleTitre
		this.PosLeft = 0;
		this.PosTop = 0;

  		if(tmpPasDefil)
  		{
  			this.PasDefil = tmpPasDefil;
  		}
  		if(tmpLargeur)
  		{
  			this.Largeur = tmpLargeur;
  		}
  		if(tmpHauteur)
  		{
  			this.Hauteur = tmpHauteur;
  		}
  		if(tmpIndexDeDepart)
  		{
  			this.IndexEnCours = tmpIndexDeDepart;
  		}
  		if(tmpDirection)
  		{
  			this.Direction = tmpDirection
  		}
		this.PosH=this.Hauteur;

//Détermine le nouveau numéro d'index de l'objet
		this.Index=TextesDefilants.length;
//Insère l'objet en cours dans le tableau des objets
		TextesDefilants[this.Index]=this;

//Ajoute la chaine passée en paramètre dans les textes à faire défiler
  		this.AddTexte = function(strChaine,strTitre)
  		{
			var TmpId = this.TableauTextes.length;
  			this.TableauTextes[TmpId] = strChaine;
		//Dessine le div ki va contenir le texte
		//overflow:hidden, c pour masquer les barres de défilement si le texte > taille du DIV
			
  			tmpDiv = "<DIV id='Div_TexteDefilant"+this.Index+"_"+TmpId+"' style='overflow:hidden;display:none;position:relative;left:"+this.PosLeft+";top:"+this.PosTop+";";
  			tmpDiv += "width:"+this.Largeur+"px;height:"+this.Hauteur+"px;z-index:100;'>";
  			document.write(tmpDiv);
  			document.write(this.TableauTextes[TmpId]);
  			document.write("</DIV>");
  			if(strTitre)
  			{
	  			this.TableauTextes[TmpId] = strTitre;
  			}
	  		else
  			{
	  			this.TableauTextes[TmpId] = "";
  			}
  		}
  		this.Previous = function()
  		{
			this.IndexEnPrecedent = this.IndexEnCours
  			this.IndexEnCours -=1
  			if (this.IndexEnCours>=this.TableauTextes.length)
  			{
  				this.IndexEnCours = 0;
  			}
  			else if (this.IndexEnCours<0)
  			{
  				this.IndexEnCours = (this.TableauTextes.length-1);
  			}
			eval('TextesDefilants[' + this.Index + '].ChangeTexte()');
  		}
  		this.Next = function()
  		{
			this.IndexEnPrecedent = this.IndexEnCours
  			this.IndexEnCours +=1
  			if (this.IndexEnCours>=this.TableauTextes.length)
  			{
  				this.IndexEnCours = 0;
  			}
  			else if (this.IndexEnCours<0)
  			{
  				this.IndexEnCours = (this.TableauTextes.length-1);
  			}
			eval('TextesDefilants[' + this.Index + '].ChangeTexte(1)');
  		}
//Change le texte à faire défiler
  		this.ChangeTexte = function()
  		{
			if(document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnPrecedent) )
			{
				document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnPrecedent).style.display= "none";
			}
  			this.IndexEnCours = this.IndexEnCours;
			document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.display= "";
			if(this.Direction == "UP")
			{
				this.PosH=this.Hauteur;
				this.PosTop =this.Hauteur;
				this.PosLeft =0;
			}
			else if(this.Direction == "LEFT")
			{
				this.PosL=this.Largeur;
				this.PosTop =0;
				this.PosLeft =0;
			}
			else if(this.Direction == "DOWN")
			{
				this.PosH=1;
				this.PosTop =0;
				this.PosLeft =0;
			}
			else if(this.Direction == "RIGHT")
			{
				this.PosL=1;
				this.PosTop =0;
				this.PosLeft =0;
			}

			eval('TextesDefilants[' + this.Index + '].Defile()');
			if(this.TableauTextes[this.IndexEnCours] != "")
			{
				document.getElementById(this.ControleTitre).innerHTML = this.TableauTextes[this.IndexEnCours]
			}
  		}
//Arret défilement
		this.Stop = function()
		{
			if (this.TimerDefile!= null)
			{
				clearTimeout(this.TimerDefile);
				this.TimerDefile=null;
			}
		}
//défilement
		this.Start=function ()
		{
			eval('TextesDefilants[' + this.Index + '].ChangeTexte()');
		}
//Action du défilement
		this.Defile= function ()
		{
			clearTimeout(this.TimerDefile);
			if(this.Direction == "UP")
			{
				this.PosH-=this.PasDefil;
				this.PosTop-=this.PasDefil;
				if (this.PosH<=0)
				{
					this.Stop();
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Next()",TempsAffichage)
				}
				else
				{
					document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.height = parseInt(this.Hauteur - this.PosH);
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Defile()",10)
				}
			}
			else if(this.Direction == "DOWN")
			{
				this.PosH+=this.PasDefil;
				if (this.PosH>this.Hauteur)
				{
					this.Stop();
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Next()",TempsAffichage)
				}
				else
				{
					document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.height = parseInt(this.PosH);
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Defile()",10)
				}
			}
			else if(this.Direction == "LEFT")
			{
				this.PosL-=this.PasDefil;
				if (this.PosL<=0)
				{
					this.Stop();
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Next()",TempsAffichage)
				}
				else
				{
					document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.width = parseInt(this.Largeur - this.PosL);
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Defile()",10)
				}
			}
			else if(this.Direction == "RIGHT")
			{
				this.PosL+=this.PasDefil;
				if (this.PosL>this.Largeur)
				{
					this.Stop();
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Next()",TempsAffichage)
				}
				else
				{
					document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.width = parseInt(this.PosL);
					this.TimerDefile = window.setTimeout("TextesDefilants[" + this.Index + "].Defile()",10)
				}
			}
			document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.top = parseInt(this.PosTop) + "px";
			document.getElementById("Div_TexteDefilant"+this.Index+"_"+this.IndexEnCours).style.left = parseInt(this.PosLeft)+"px";
		}
  	}
