
//edit by Cristina 28.11.2006
//mine sack for Ajax
function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;

						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;
							if (self.execute)
							{
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200")
							{
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

//end sack AJAX
//instantiate a sack object
var ajaxObjectArray=new Array();

var fileAjaxUser="ajx_sendcode.php";
function sendCodeAjax(code,coderet,user_id,order_id,admin_id){
//	alert(order_id);
	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;
	ajaxObjectArray[ajaxIndex].setVar('code',code);
	ajaxObjectArray[ajaxIndex].setVar('coderet',coderet);
	ajaxObjectArray[ajaxIndex].setVar('user_id',user_id);
	ajaxObjectArray[ajaxIndex].setVar('admin_id',admin_id);
	ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);


	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxUser;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    sendCode(ajaxIndex,order_id)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function sendCode(ajaxIndex,order_id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		//alert(response);
		if(response)
		{

	   document.getElementById('error'+order_id).innerHTML = "Merci de saisir les 2 codes TNT.";
	   window.location.reload( true );
		}else
	   	  {
			  document.getElementById('error'+order_id).innerHTML = "can't send";
		  }

}

//end send code admin part



//begin return sac back
var fileAjaxbag="ajx_returnBag.php";
function returnBagAjax(order_id,user_id){

	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;

	ajaxObjectArray[ajaxIndex].setVar('user_id',user_id);
	ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);

	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxbag;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    returnBag(ajaxIndex,user_id,order_id)
       };

       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function returnBag(ajaxIndex,user_id,order_id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		response = response.replace(" ","");
		if(response)
		{

	   $('ret_'+order_id).innerHTML = "Vous avez retourn&eacute; ce sac";
	   window.location.reload( true );
		}else
	   	  {
			  $('ret_'+order_id).innerHTML = "can't send";
		  }

}

//end ajax return sac back

//begin return sac back
var fileAjaxaddbag="cart_add.php";
function addBagAjax(id){

	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;

	ajaxObjectArray[ajaxIndex].setVar('id',id);

	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxaddbag;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    addBag(ajaxIndex,id)
       };

       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function addBag(ajaxIndex,id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		//response1 = response.replace(" ","");
		if(response)
		{
		show('addtocart'+id);
		$('span'+id).innerHTML = 'deja ajout&eacute;';

		}else
	   	  {
			alert("can't send");
		  }

}

var fileAjaxaddbag1="cart_add.php";
function addToCartAjax(id){

	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;

	ajaxObjectArray[ajaxIndex].setVar('id',id);

	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxaddbag1;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    addToCart(ajaxIndex,id)
       };

       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function addToCart(ajaxIndex,id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		//response1 = response.replace(" ","");
		if(response)
		{
		show('addcart'+id);
		$('span'+id).innerHTML = 'deja ajouté';

		}else
	   	  {
			alert("can't send");
		  }

}

//end ajax return sac back


//begin ajax edit a coment
var fileAjaxComent="ajx_editcoment.php";
function editNameAjax(eventid)
{
	var prio = $('prior'+eventid).value;
	var adminid = $('admin'+eventid).value;
	var deadline = $('deadline_date'+eventid).value+' '+$('deadline_hour'+eventid).value+':'+$('deadline_min'+eventid).value+':00';
	var nextact = $('nextact'+eventid).value;
	var coment = $('coment'+eventid).value;
	//alert(deadline);
      //alert(prio+"dea "+deadline+"adm: "+adminid+"ne "+nextact+"c: "+coment);return;
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
       ajaxObjectArray[ajaxIndex].setVar('coment',coment);
	   ajaxObjectArray[ajaxIndex].setVar('eventid',eventid);
	   ajaxObjectArray[ajaxIndex].setVar('prio',prio);
	   ajaxObjectArray[ajaxIndex].setVar('adminid',adminid);
	   ajaxObjectArray[ajaxIndex].setVar('nextact',nextact);
	   ajaxObjectArray[ajaxIndex].setVar('deadline',deadline);

       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxComent;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {

               editComent(ajaxIndex,eventid)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}
function editComent(ajaxIndex,eventid)
{
       response=ajaxObjectArray[ajaxIndex].response;
//alert(response);
	   /*document.getElementById("show_edit"+eventid).style.display ="none";*/
	   document.getElementById("coment"+eventid).style.display ="none";
       document.getElementById("savebuton"+eventid).innerHTML = "commentaires sauvegard&eacute;";

}

//end ajax edit a coment

//begin ajax cancel order
var fileAjaxOrder="ajx_cancelorder.php";
function cancelOrderAjax(eventid,order_id,user_id,product_id,admin_id)
{

      //alert(eventid+"dea "+order_id+"adm: "+user_id+"ne "+product_id);return;


       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
       ajaxObjectArray[ajaxIndex].setVar('eventid',eventid);
	   ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	   ajaxObjectArray[ajaxIndex].setVar('user_id',user_id);
	   ajaxObjectArray[ajaxIndex].setVar('product_id',product_id);
	   ajaxObjectArray[ajaxIndex].setVar('admin_id',admin_id);

       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxOrder;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {

               cancelOrder(ajaxIndex,eventid)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}

//begin ajax cancel order
var fileAjaxOrderit="ajx_cancelorderitbag.php";
function cancelitbagOrderAjax(eventid,order_id,user_id,product_id,admin_id)
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
       ajaxObjectArray[ajaxIndex].setVar('eventid',eventid);
	   ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	   ajaxObjectArray[ajaxIndex].setVar('user_id',user_id);
	   ajaxObjectArray[ajaxIndex].setVar('product_id',product_id);
	   ajaxObjectArray[ajaxIndex].setVar('admin_id',admin_id);

       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxOrderit;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
               cancelOrder(ajaxIndex,eventid)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function
}

function cancelOrder(ajaxIndex,eventid)
{
       response=ajaxObjectArray[ajaxIndex].response;
//alert(response);
	   /*document.getElementById("show_edit"+eventid).style.display ="none";*/
	   //document.getElementById("coment"+eventid).style.display ="none";
       document.getElementById("cancelord"+eventid).innerHTML = "commande annul&eacute;";

}

//end ajax cancel order

//begin return sac back
var fileAjaxreceivebag="ajx_receivebag.php";
function receiveBagAjax(event_id,order_id,admin_id,prod_id){

	//alert(admin_id+"dea "+order_id+"adm: "+user_id+"ne "+prod_id);return;

	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;

	ajaxObjectArray[ajaxIndex].setVar('event_id',event_id);
	ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	ajaxObjectArray[ajaxIndex].setVar('admin_id',admin_id);
	ajaxObjectArray[ajaxIndex].setVar('prod_id',prod_id);

	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxreceivebag;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    receiveBag(ajaxIndex,order_id)
       };

       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function receiveBag(ajaxIndex,order_id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		response = response.replace(" ","");
		//alert(response)


		if(response)
		{

	   $('error'+order_id).innerHTML = "Vous avez re&ccedil;u ce sac";
		window.location.reload( true );
		}else
	   	  {
			  $('error'+order_id).innerHTML = "error";
		  }

}

//end ajax return sac back


//extend bag confirmation/validation

var fileAjaxextendbag="ajx_extendbag.php";
function extendBagAjax(event_id,order_id,admin_id,prod_id,user_id){

	//alert(admin_id+"dea "+order_id+"adm: "+user_id+"ne "+prod_id);return;

	ajaxObjectArray[ajaxObjectArray.length] = new sack();
    var ajaxIndex = ajaxObjectArray.length-1;

	ajaxObjectArray[ajaxIndex].setVar('event_id',event_id);
	ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	ajaxObjectArray[ajaxIndex].setVar('admin_id',admin_id);
	ajaxObjectArray[ajaxIndex].setVar('prod_id',prod_id);
	ajaxObjectArray[ajaxIndex].setVar('user_id',user_id);

	ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxextendbag;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
		    extendBag(ajaxIndex,order_id)
       };

       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}



function extendBag(ajaxIndex,order_id)
{
       response=ajaxObjectArray[ajaxIndex].response;
		response = response.replace(" ","");
		if(response)
		{

	   $('error'+order_id).innerHTML = "Vous avez valid&eacute; la prolongation";
	   window.location.reload( true );
		}else
	   	  {
			  $('error'+order_id).innerHTML = "can't send";
		  }

}


//begin ajax cancel order
var fileAjaxLock="ajx_lockorder.php";
function lockOrderAjax(order_id)
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
	   ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	   ajaxObjectArray[ajaxIndex].setVar('action','lock');
       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxLock;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
               lockOrder(ajaxIndex)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function
}

function lockOrder(ajaxIndex)
{
       response=ajaxObjectArray[ajaxIndex].response;
	//alert(response);
}

//end ajax lock order


//begin ajax cancel order lock
function cancel_lockOrderAjax(order_id, url, id_link)
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
	   ajaxObjectArray[ajaxIndex].setVar('order_id',order_id);
	   ajaxObjectArray[ajaxIndex].setVar('action','cancellock');
       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxLock;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
              cancellockOrder(ajaxIndex,url, id_link)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function


}
function cancellockOrder(ajaxIndex, url, id_link)
{
	   document.getElementById(id_link).innerHTML = '<span>Louez-le !</span>';
	   document.getElementById(id_link).href = url;
}
//end ajax lock order



function modStockVente(product_id,type)
{

	var data = 'buy_tarif_delivery='+document.getElementById('buy_tarif_delivery'+product_id).value;

	if( type == 'acce')
	{
		data = data + '|buy_stock_acce='+document.getElementById('buy_stock_acce'+product_id).value;
		data = data + '|buy_tarif_acce='+document.getElementById('buy_tarif_acce'+product_id).value;
		data = data + '|buy_stock_acce_promo='+document.getElementById('buy_stock_acce_promo'+product_id).value;
		data = data + '|buy_tarif_acce_promo='+document.getElementById('buy_tarif_acce_promo'+product_id).value;
	}
	else
	{
		data = data + '|buy_stock_neuf='+document.getElementById('buy_stock_neuf'+product_id).value;
		data = data + '|buy_tarif_neuf='+document.getElementById('buy_tarif_neuf'+product_id).value;
		data = data + '|buy_stock_occa='+document.getElementById('buy_stock_occa'+product_id).value;
		data = data + '|buy_tarif_occa='+document.getElementById('buy_tarif_occa'+product_id).value;
		data = data + '|buy_stock_neuf_promo='+document.getElementById('buy_stock_neuf_promo'+product_id).value;
		data = data + '|buy_tarif_neuf_promo='+document.getElementById('buy_tarif_neuf_promo'+product_id).value;
		data = data + '|buy_stock_occa_promo='+document.getElementById('buy_stock_occa_promo'+product_id).value;
		data = data + '|buy_tarif_occa_promo='+document.getElementById('buy_tarif_occa_promo'+product_id).value;
	}
	mod_stockventeAjax(product_id, type, data , 'div_responce_' + product_id);
}

//begin ajax valid mod stock vente
var fileAjaxVente="ajx_vente.php";
function mod_stockventeAjax(product_id, type, data , divresponce)
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
	   ajaxObjectArray[ajaxIndex].setVar('product_id',product_id);
	   ajaxObjectArray[ajaxIndex].setVar('type',type);
	   ajaxObjectArray[ajaxIndex].setVar('data',data);

       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxVente;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
              mod_stockvente(ajaxIndex, divresponce)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function


}
function mod_stockvente(ajaxIndex, divresponce)
{
	document.getElementById(divresponce).innerHTML  = ajaxObjectArray[ajaxIndex].response;
	   //document.getElementById(divresponce).innerHTML = '<span>Modification effectuer</span>';
}
//end ajax lock order

function addProduct()
{
	document.getElementById('div_product_add').style.display = 'block';
}
//end extend bag confirmation/validation

//begin ajax valid mod stock vente
var fileAjaxDescOccaz="ajx_vente.php";
function mod_DescOccaz_ajax(product_id, id_occaz_product, method, divresponce)
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;
	   ajaxObjectArray[ajaxIndex].setVar('product_id',product_id);
	   ajaxObjectArray[ajaxIndex].setVar('id_occaz_product',id_occaz_product);
	   ajaxObjectArray[ajaxIndex].setVar('method',method);
	   ajaxObjectArray[ajaxIndex].setVar('tarif',document.getElementById(product_id+'_tarif_'+id_occaz_product).value);
	   ajaxObjectArray[ajaxIndex].setVar('desc',document.getElementById(product_id+'_text_'+id_occaz_product).value);

       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxDescOccaz;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
              mod_DescOccaz(ajaxIndex, divresponce)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}
function mod_DescOccaz(ajaxIndex, divresponce)
{
	document.getElementById(divresponce).innerHTML  = ajaxObjectArray[ajaxIndex].response;
	   //document.getElementById(divresponce).innerHTML = '<span>Modification effectuer</span>';
}
//end ajax lock order








//begin ajax addorder
var fileAjaxAddOrder="ajx_addorder.php";
function add_Order_ajax()
{
       ajaxObjectArray[ajaxObjectArray.length] = new sack();
       var ajaxIndex = ajaxObjectArray.length-1;

	   ajaxObjectArray[ajaxIndex].setVar('email',document.getElementById('email').value);
	   ajaxObjectArray[ajaxIndex].setVar('ref',document.getElementById('ref').value);
	   ajaxObjectArray[ajaxIndex].setVar('date_start',document.getElementById('date_start').value);
	   ajaxObjectArray[ajaxIndex].setVar('date_end',document.getElementById('date_end').value);
	   ajaxObjectArray[ajaxIndex].setVar('prix',document.getElementById('prix').value);
	   ajaxObjectArray[ajaxIndex].setVar('delivery',document.getElementById('delivery').value);


	   if(document.getElementById('rent_time_1').checked == true)
	   {
			ajaxObjectArray[ajaxIndex].setVar('rent_time','1');
	   }
	   else
	   {
			ajaxObjectArray[ajaxIndex].setVar('rent_time','2');
	   }


		if(document.getElementById('deliveryadress').checked == true)
		{
		    ajaxObjectArray[ajaxIndex].setVar('deliveryadress','true');
		    ajaxObjectArray[ajaxIndex].setVar('billingAddress2',document.getElementById('billingAddress2').value);
		    ajaxObjectArray[ajaxIndex].setVar('billzip2',document.getElementById('billzip2').value);
		    ajaxObjectArray[ajaxIndex].setVar('billcity2',document.getElementById('billcity2').value);
		    ajaxObjectArray[ajaxIndex].setVar('billphoneArea2',document.getElementById('billphoneArea2').value);
		    ajaxObjectArray[ajaxIndex].setVar('billland2',document.getElementById('billland2').value);
	    }
	    else
	    {
			ajaxObjectArray[ajaxIndex].setVar('deliveryadress','false');
	    }
	    ajaxObjectArray[ajaxIndex].setVar('comments',document.getElementById('comments').value);


       ajaxObjectArray[ajaxIndex].requestFile  = fileAjaxAddOrder;
       ajaxObjectArray[ajaxIndex].onCompletion = function()
       {
              mod_AddOrder(ajaxIndex)
       };
       // Specify function that will be executed after file has been found
       ajaxObjectArray[ajaxIndex].runAJAX();// Execute AJAX function

}
function mod_AddOrder(ajaxIndex)
{
	document.getElementById('f').innerHTML  = ajaxObjectArray[ajaxIndex].response;
	   //document.getElementById(divresponce).innerHTML = '<span>Modification effectuer</span>';
}
//end ajax lock order

function divposresize(my_box, toto)
{
	if (document.body)
	{
		var larg = (document.body.clientWidth);
	}
	else
	{
		var larg = (window.innerWidth);
	}
	if (larg > 954)
		var xx = ((larg - 954) / 2) + toto;
	else
		var xx = toto;
	document.getElementById(my_box).style.left = xx + 'px';
}