var nbrPhotos=0;
var Tabidphoto=new Array();
var SelectAll=0;
var idphoto=new Array();
var data;
var texte;

function Setidphoto(idphotos){
		var reg=new RegExp("[,]+", "g");
		this.idphoto=idphotos.split(reg);
}

function SelectionPhoto(idphoto,nomclasse_selected,nomclasse){
	if(this.Tabidphoto[idphoto]!=idphoto)//on sélectionne la photo
	{
		this.nbrPhotos++;
		this.Tabidphoto[idphoto]=idphoto;
		document.getElementById("idphoto_"+idphoto).className=nomclasse_selected;
	}else{
		this.nbrPhotos--;
		this.Tabidphoto[idphoto]="";
		document.getElementById("idphoto_"+idphoto).className=nomclasse;
	}
	writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
	writediv(this.nbrPhotos,"nbr_photos_del");
}
function Deleteidphoto(idphoto){
	var del=-1;
	var i;
		for(i=0;i<this.idphoto.length && del==-1;i++){
			if(this.idphoto[i]==idphoto)
				del=i;
		}
		if(del!=-1){
		for(i=del;i<this.idphoto.length-1;i++)
			this.idphoto[i]=this.idphoto[i+1];
		this.idphoto.pop();
		}
}
function DeplacerPhotos(idalbum){
	var data;
	var fichier;
	var texte;
	if(this.nbrPhotos==0)
		return;
        confirm("Deplacer les photos ?","Confirmation", function(result){
            if (result) {
                data="action=move_photos&idalbum="+idalbum+"&idphoto="+Implode(",",this.Tabidphoto);
		fichier=this.path+"action_to_photo.php?"+data+"&"+new Date()*Math.random();
		texte=PostInfosSurServer(fichier,data,"");
		//alert(texte);
		this.nbrPhotos=0;
		CacherPhotos();
		//writediv(texte,"menu_photos_a_classer");
		writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
		writediv(this.nbrPhotos,"nbr_photos_del");
            }
        });
}
function SupprimerUnePhoto(idphoto,idformatphoto,message){
	var data;
	var fichier;
	var texte;
        confirm(message,"Confirmation", function(result){
            if (result) {
                data="action=delete_photos&idphoto="+idphoto+"&idformatphoto="+idformatphoto;
		fichier=this.path+"action_to_photo.php?"+data+"&"+new Date()*Math.random();

		texte=PostInfosSurServerWait(fichier,data,"");
		//alert(texte);
		document.getElementById("icone_photo_commande").removeChild(document.getElementById("idphoto_"+idformatphoto));
		//alert(this.path);
		if(this.path=="modules/pro/ajax/")
			document.getElementById("photos_select").removeChild(document.getElementById("photo_small_dr_"+idformatphoto));

		var tab=Array();
		tab[0]=idphoto;
//		CacherPhotos();
		Deleteidphoto(tab);
		//writediv(texte,"menu_photos_a_classer");
		//writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
		//writediv(this.nbrPhotos,"nbr_photos_del");
		setTimeout("TotalCommande()",500);
                var nbPhotos = select_photo(idformatphoto,0);
                setNbPhotosSelected(nbPhotos);
            }
        });
    
}
function AnnulerCommande(idcommande,message){
    var data;
	var fichier;
	var texte;
        confirm(message,"Confirmation", function(result){
            if (result) {
                data="action=cancel_order";
		fichier=this.path+"action_to_photo.php?"+data+"&"+new Date()*Math.random();
		texte=PostInfosSurServer(fichier,data,"");
                document.location.href="index.php?step=2&sid="+this.sid;
            }
        });
}
function SupprimerPhotos(){
    var data;
    var fichier;
    var texte;
    if(this.nbrPhotos==0)
            return;
    confirm("Supprimer les photos selectionnees ?","Confirmation", function(result){
        if (result) {
            data="action=delete_photos&idphoto="+Implode(",",this.Tabidphoto);
            fichier="modules/ajax/action_to_photo.php?"+data+"&"+new Date()*Math.random();
            texte=PostInfosSurServer(fichier,data,"");
            //alert(texte);
            this.nbrPhotos=0;
            CacherPhotos();
            Deleteidphoto();
            //writediv(texte,"menu_photos_a_classer");
            writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
            writediv(this.nbrPhotos,"nbr_photos_del");
        }
    });  
}


/*function update_nb_photos(offset) {
    if ($('nb_photos_selected'))
        $('nb_photos_selected').nbphotos = $('nb_photos_selected').nbphotos+0+offset;
    $('nb_photos_selected').innerHTML = $('nb_photos_selected').nbphotos;
	setNbPhotosSelected();
}*/


function CacherPhotos(){
    for (key in this.Tabidphoto){
            if(!isNaN(this.Tabidphoto[key]) && this.Tabidphoto[key]==key){
                    document.getElementById("idphoto_"+this.Tabidphoto[key]).style.visibility="hidden";
                    this.Tabidphoto[key]="";
                    Deleteidphoto(key);
            }
    }
}
function Implode(symb,array){
	var chaine='';
	var i=0;
	var key="";

	for (key in array){
		if(!isNaN(array[key]) && array[key]==key){
			if(i>0)
				chaine+=symb;
			chaine+=array[key];
		i++;
		}
	}
	return chaine;
}

function SelectionAll(nomclasse_selected,nomclasse){
	var i=0;
	if(this.SelectAll==0){
		this.nbrPhotos=0;
		for(i=0;i<this.idphoto.length;i++){
			this.nbrPhotos++;
			document.getElementById("idphoto_"+this.idphoto[i]).className=nomclasse_selected;
			this.Tabidphoto[this.idphoto[i]]=this.idphoto[i];
			this.SelectAll=1;
			writediv("D&eacute;selectionner toutes les photos","info_select_all");
			writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
			writediv(this.nbrPhotos,"nbr_photos_del");
		}
	}
	else
	{
		this.nbrPhotos=0;
		for(i=0;i<this.idphoto.length;i++){
			document.getElementById("idphoto_"+this.idphoto[i]).className=nomclasse;
			this.Tabidphoto[this.idphoto[i]]="";
			this.SelectAll=0;
			writediv("Selectionner toutes les photos","info_select_all");
			writediv(this.nbrPhotos,"nbr_photos_move");//on écrit le nbr de photos sélectionnée
			writediv(this.nbrPhotos,"nbr_photos_del");
		}
	}
}

function TraiterPhoto(idphoto){
	var data;
	var fichier;
	var texte;
	data="action=traiter_photos&idphoto="+idphoto;
	fichier="modules/ajax/traitement_fichier.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"thumb_"+idphoto);
	//alert(texte);
	//writediv(texte,"thumb_"+idphoto);
}

function SupprimerPhotosKeyDel(e,idalbum)
{
	var whKey;
	whKey = e ? e.which : event.keyCode; // check for which is supported
	if(!whKey)
		whKey=window.event.keyCode;
	if(whKey==46)// on appuye sur delete ->
		SupprimerPhotos(idalbum);
	return;
}

function RotationPhoto(idphoto,rotation){
	var data;
	var fichier;
	var texte;
	data="action=rotate&idphoto="+idphoto+"&rotation="+rotation;
	fichier="modules/ajax/rotation_photo.php?"+new Date()*Math.random();
	//document.getElementById("info_"+idphoto).style.visibility="visible";
	writediv('Rotation en cours...<br><img src="pictures/spinner.gif">',"info_"+idphoto);
	texte=PostInfosSurServerWait(fichier,data,"idphoto_"+idphoto);
	//alert(texte);
	//writediv(texte,"idphoto_"+idphoto);
	//document.getElementById("info_"+idphoto).style.visibility="hidden";
}

function ApplyToAll(){
	confirm("Appliquer &agrave; toutes les photos ?","Confirmation", function(result){

            if (result) {
                var quantite=document.getElementById("qty").value;
                var idformat=document.getElementById("format").value;
                var bord=0;
                var remplir=0;
                var auto=0;

                if(document.getElementById("bord").checked)
                        bord=1;
                if(document.getElementById("remplir").checked)
                        remplir=1;
                if(document.getElementById("auto").checked)
                        auto=1;

                data="action=apply_to_all&quantite="+quantite+"&format="+idformat+"&bord="+bord+"&remplir="+remplir+"&auto="+auto;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid;
                //processSelected(1,value);

            }
	
	});
}


function CheckQty(e,idformatphoto,idphoto){
	var whKey;
	whKey = e ? e.which : event.keyCode; // check for which is supported
	if(!whKey)
		whKey=window.event.keyCode;
	//alert(whKey);
	//if(whKey==46)// on appuye sur delete ->
 	if ((whKey < 48 || whKey > 57) && whKey!=8 && whKey!=9){
		if(e){
			return false;
		}
		else{
			return false;
			event.returnValue = false;
		}
	}
}
function SauverPapier(idpapier){
	data="action=papier&idpapier="+idpapier;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	//alert(texte);
}
function SauverMarque(idmarque){
	data="action=marque&idmarque="+idmarque;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("TotalCommande()",500);
	//alert(texte);
}

function SauverQuantite(idformatphoto,idphoto){
	var quantite=document.getElementById("qty_"+idformatphoto).value;
	data="action=qty&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&quantite="+quantite;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("TotalCommande()",500);
	//alert(texte);
	//writediv('Rotation en cours...<br><img src="pictures/spinner.gif">',"info_"+idphoto);
}

function SauverFormat(idformatphoto,idphoto,width,height){
	var idformat=document.getElementById("format_"+idformatphoto).value;
	data="action=format&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&idformat="+idformat;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("AfficherCadrage("+idformatphoto+","+idphoto+")",1000);
	width=parseInt(width)+100;
	height=parseInt(height)+120;

	document.getElementById("idlien_"+idformatphoto).href="recadrage.php?idphoto="+idphoto+"&idformatphoto="+idformatphoto+"&idformat="+idformat+this.lien+"&keepThis=true&#038;TB_iframe=true&#038;height="+height+"&#038;width="+width;
	if(this.path=="php/modules/commande/ajax/")
		setTimeout("GetQualite("+idphoto+","+idformat+","+idformatphoto+")",10);
	setTimeout("TotalCommande()",2000);
//	alert(texte);
}
function SauverFormatT(idformatphoto,idphoto){
	var idformat=document.getElementById("format_"+idformatphoto).value;
	data="action=format&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&idformat="+idformat;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("AfficherCadrage("+idformatphoto+","+idphoto+")",1000);
	if(this.path=="php/modules/commande/ajax/")
		setTimeout("GetQualite("+idphoto+","+idformat+","+idformatphoto+")",10);
	setTimeout("TotalCommandeT()",500);
//	alert(texte);
}

function AfficherCadrage(idformatphoto,idphoto){
	var texte1;
	data="action=cadrage&idphoto="+idphoto+"&idformatphoto="+idformatphoto+"&divid=photo_cadrage_"+idformatphoto;
	fichier=this.path+"cadrage_photo.php?"+new Date()*Math.random();
	//alert(idformatphoto);
	texte1=PostInfosSurServerWait1(fichier,data,"photo_cadrage_"+idformatphoto);
	//alert(texte1);
	//writediv(texte1,"photo_cadrage_"+idphoto);
}
function TotalCommande(){
	data="action=total"+"&divid=total_commande";
	fichier=this.path+"total_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait1(fichier,data,"total_commande");
	//alert(texte);
	//writediv(texte,"total_commande");
}

function TotalCommandeT(){
	data="action=total"+"&divid=total_commande";
	fichier=this.path+"total_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServer(fichier,data,"total_commande");
	//alert(texte);
	writediv(texte,"total_commande");
}
function SetBordBlanc(idformatphoto){
	if(document.getElementById("bord_"+idformatphoto).checked)
		document.getElementById("bord_"+idformatphoto).checked=false;
	else
		document.getElementById("bord_"+idformatphoto).checked=true;
	return ;
}
function SauverBordBlanc(idformatphoto,idphoto){
	var bord=0;
	if(document.getElementById("bord_"+idformatphoto).checked)
		bord=1;
	data="action=bord&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&bord="+bord;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("AfficherCadrage("+idformatphoto+","+idphoto+")",500);
}
function SauverRemplir(idformatphoto,idphoto){
	var remplir=0;
	if(document.getElementById("remplir_"+idformatphoto).checked)
		remplir=1;
	data="action=remplir&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&remplir="+remplir;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("AfficherCadrage("+idformatphoto+","+idphoto+")",500);
}
function SauverAutoCorrection(idformatphoto,idphoto){
	var auto=0;
	if(document.getElementById("auto_"+idformatphoto).checked)
		auto=1;
	data="action=auto&idformatphoto="+idformatphoto+"&idphoto="+idphoto+"&auto="+auto;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
}


function GetQualite(idphoto,idformat,idphotoformat){
	data="action=qualite&idformat="+idformat+"&idphoto="+idphoto+"&divid=qualite_"+idphotoformat;
	fichier=this.path+"getqualite.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait1(fichier,data,"qualite_"+idphotoformat);
	//writediv(texte,"qualite_"+idphoto);
	//alert(texte);
}

function SauverAdresseLiv(idadrliv){
	data="action=adrliv&idadrliv="+idadrliv;
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	setTimeout("TotalCommande()",500);
}
function SauverAdresseEnlevement(idenlevement){
	data="action=enlevement&idenlevement="+idenlevement;
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"");
	//alert(texte);
	setTimeout("TotalCommande()",500);
}
function NouveauFormat(idphoto,idformatphoto,e){
	data="&idphoto="+idphoto+"&idformatphoto="+idformatphoto;
	fichier=this.path+"add_format.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"addformat");
	//alert(texte);
	document.getElementById("contenu").className="modif_page";
	document.getElementById("addformat").style.visibility="visible";
	//alert(positionX(e));
	document.getElementById("addformat").style.top=positionY(e)-50+"px";
	document.getElementById("addformat").style.left=positionX(e)+"px";
}

function FermerPopUp(){
	document.getElementById("popup").style.visibility="hidden";
	document.getElementById("contenu").className="page_normal";
}
function PopUp(page,langue,e){
	var lang="";
	if(langue=="nl")
		lang="_nl";
	switch(page){
		case 'auto' :
			fichier=this.path+"pop_up_auto_correction"+lang+".php?"+new Date()*Math.random();
			break;
		default:
			break;
	}

	texte=PostInfosSurServerWait(fichier,data,"popup");
	//alert(texte);
	document.getElementById("contenu").className="modif_page";
	document.getElementById("popup").style.visibility="visible";
	//alert(positionX(e));
	document.getElementById("popup").style.top=positionY(e)-350+"px";
	document.getElementById("popup").style.left=positionX(e)+"px";
}

function AddFormat(idphoto,idformatphoto){
	var quantite=document.getElementById("qty_new").value;
	var remplir=0;
	if(document.getElementById("remplir_new").checked)
		remplir=1;
	var bord=0;
	if(document.getElementById("bord_new").checked)
		bord=1;
	var auto=0;
	if(document.getElementById("auto_new").checked)
		auto=1;
	var idformat=document.getElementById("format_new").value;
	data="&action=addformat&idphoto="+idphoto+"&quantite="+quantite+"&bord="+bord+"&remplir="+remplir+"&idformat="+idformat+"&auto="+auto;
	fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
	texte=PostInfosSurServer(fichier,data,"");
	//alert(texte);
	document.location.reload();
}

function SetBackPrint(idbackprint,line2){
	var backprint=document.getElementById("back_print_perso").value;
	data="&action=backprint&back_print=" + backprint+"&idbackprint="+idbackprint+"&line2="+line2;
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServerWait(fichier,data,"info_backprint");
	setTimeout("TotalCommande()",500);
}

function ValiderBackprint(backprint){
	document.getElementById('backprint').innerHTML=backprint;
}

function AnnulerAddFormat(){
	document.getElementById("addformat").style.visibility="hidden";
	document.getElementById("contenu").className="";
}
function FermerInfosUpload(){
	document.getElementById("info_telechargement").style.visibility="hidden";
}

function SauverRognage(idphoto,idformatphoto,color,crop){

	var data;
	var left=document.getElementById("input-left").value;
	var top=document.getElementById("input-top").value;
	var width=document.getElementById("input-width").value;
	var height=document.getElementById("input-height").value;

	//width=parseInt(width+50);
	//height=parseInt(height+50);
	data="&action=rognage&idphoto="+idphoto+"&idformatphoto="+idformatphoto+"&top="+top+"&left="+left+"&width="+width+"&height="+height+"&color="+color+"&crop="+crop;

        data += '&sid='+this.sid;

	var fichier="php/modules/commande/ajax/action_to_photo.php?"+new Date()*Math.random();
	PostInfosSurServer(fichier,data,"");
	//setTimeout("AfficherCadrage("+idformatphoto+","+idphoto+")",1000);
}

/**
 *
 * @access public
 * @return void
 **/
function ChargerLienRognage(){
	var data;


}



function ApplyToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var quantite=document.getElementById("qty").value;
                var idformat=document.getElementById("format").value;
                var bord=0;
                var remplir=0;
                var auto=0;

                if(document.getElementById("bord").checked)
                        bord=1;
                if(document.getElementById("remplir").checked)
                        remplir=1;
                if(document.getElementById("auto").checked)
                        auto=1;

                data="action=apply_to_selection&quantite="+quantite+"&format="+idformat+"&bord="+bord+"&remplir="+remplir+"&auto="+auto;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}

function SelectionPhotos(start,action,message){
    
    confirm(message,"Confirmation", function(result){
            if (result) {
                var boolaction = (action == 'select');
                if (boolaction) {
                    var data = "&todo=2";                    
                }                    
                else {
                    var data = "&todo=3";                    
                }
                    
                var imgsCheckbox = $$('.imgCheckbox');
                for (var i = 0 ; i < imgsCheckbox.length ; ++i) {
                        imgsCheckbox[i].checked = boolaction;
                }

                var fichier = 'php/modules/commande/ajax/action_to_selection.php';               
                var nbphotoselected = PostInfosSurServer(fichier,data,"");     

				setNbPhotosSelected(nbphotoselected);	
            }

    });
}

function select_photo(idformatphoto,todo) {
    var data = "&idformatphoto="+idformatphoto+"&todo="+todo;
    var fichier = 'php/modules/commande/ajax/action_to_selection.php';
    return PostInfosSurServer(fichier,data,"");
}


function ApplyFormatToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var format=document.getElementById("format").value;
                
                data="action=apply_format_to_selection&format="+format;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}

function ApplyQuantiteToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var quantite=document.getElementById("qty").value;

                data="action=apply_quantite_to_selection&quantite="+quantite;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}
function ApplyBordToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var bord = 0;
                if(document.getElementById("bord").checked)
                        bord=1;

                data="action=apply_bord_to_selection&bord="+bord;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}
function ApplyRemplirToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var remplir = 0;
                if(document.getElementById("remplir").checked)
                        remplir=1;

                data="action=apply_remplir_to_selection&remplir="+remplir;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}

function ApplyAutoToSelection(start,message,messageAucune){
        if ($('nb_photos_selected').nbphotos == 0) {
            showTip(messageAucune,2,'Info');
        }
        else
	confirm(message,"Confirmation", function(result){

            if (result) {
                var auto = 0;
                if(document.getElementById("auto").checked)
                        auto=1;

                data="action=apply_auto_to_selection&auto="+auto;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}
function Setidclient(idclient){
	data="&action=setidclient&idclient=" + idclient;
	//alert(data);
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServer(fichier,data,"");
	//alert(texte);
	document.location='index.php?step=1';
}

function ChangeTypePrix(idtypeprix) {
	data="&action=setidtypeprix&idtypeprix="+idtypeprix;
	//alert(data);
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServer(fichier,data,"");
	//alert(texte);
	TotalCommande();
}

function SetFraisTraitement() {
	data="&action=setfraistraitement&fraistraitement="+$('frais_traitement').value;
	//alert(data);
	fichier=this.path+"action_commande.php?"+new Date()*Math.random();
	texte=PostInfosSurServer(fichier,data,"");
	//alert(texte);
	TotalCommande();
}
/*
function ApplyValueToSelection(start,message,valueName,isCheckBox){
    confirm(message,"Confirmation", function(result){

            if (result) {              
                if (isCheckBox) {
                    var value = 0;
                    if(document.getElementById(valueName).checked)
                        value=1;                    
                }
                else {
                    var value = document.getElementById(valueName).value;
                }
                
                data="action=apply_value_to_selection&valueName="+valueName+"&value="+value;
                //alert(data);
                fichier=this.path+"action_to_photo.php?"+new Date()*Math.random();
                beLoader_load_start();
                texte=PostInfosSurServer(fichier,data,"");
                //alert(texte);
                document.location.href="index.php?step=3&sid="+this.sid+"&start="+start;
                //processSelected(1,value);

            }

	});
}
*/
