function duplicate(nb) {

	var path = top.location.href;
	var path2 = top.location.pathname;
	if (document.all) {
	path = path.replace(/\\/g,"/");
	path2 = path2.replace(/\\/g,"/");	
	}
	path = path.substr(0,path.lastIndexOf("/")+1);
	path2 = path2.substr(0,path2.lastIndexOf("/")+1);	//EUR

	var url_var = path + "ViewCurrentReq-AddProducts";
	var quantite;
	var produit;
	var sku;
	var corps;
	showover();
	jQuery('#fond').css({'opacity':'0.5' ,
		'-khtml-opacity': '0.5',
		'-moz-opacity':'0.5', 
		'color' : '#FFF',
		'border' : '1px solid #000',
		'width' : '100%',
		'filter':'alpha(opacity=50)',
    	'height':'200%', 
    	'position':'absolute',
    	'z-index':'10',
    	'background-color' : '#555',});
	
	jQuery('#over').css({ 'color' : '#000',
		'border' : '1px solid #777',
		'width' : '500px',
    	'height':'350px', 
    	'left':'50%',
    	'top':'50%',
    	'margin-top': '-150px',
    	'margin-left':'-250px',
    	'position':'absolute',
    	'z-index':'11',
       	'background-color' : '#EFEBEF',});
	
	var html = "<div id='titre_over'>Duplication de commande</div><div id='corps_over'></div><div id='foot_over'></div>";
	
	jQuery('#over').html(html);
	jQuery('#titre_over').css({ 'color' : '#fff',
		'border' : '0px',
		'width' : '100%',
    	'height':'34px', 
    	'padding-top':'10px',
    	'font-size': '18px',
    	'font-style': 'bold',
    	'font-family':'tahoma,Verdana, sans-serif',
    	'text-align':'center',
    	'background-image':'url("http://www.cae-extranet.fr/is-bin/intershop.static/WFS/CAE-EXT-Site/-/fr_FR/images/bg_over_wb.png")',
    	'background-repeat':'repeat-x',  	
      	'background-color' : '#009ADE',
       		});
	jQuery('#corps_over').css({
		'width' : '98%',
		'height':'180px',
    	'font-size': '12px',
		'overflow-y':'scroll',
		'padding':'5px',
		});	
	jQuery('#foot_over').css({
		'width' : '98%',
    	'font-size': '12px',
		'bottom':'0px',
		'height':'auto',
		'padding':'5px',
		'position':'absolute',
       		});	
	
	jQuery('#corps_over').html("Les produits suivants vont être ajoutés a votre panier<br/>");
	for (i = 1; i <= nb; i++) {
		quantite = jQuery('#q'+i).val();
		produit = jQuery('#p'+i).val();
		sku = jQuery('#sku'+i).val();
		jQuery.ajax( {
			type :"POST",
			url :url_var,
			data :"ProductRefIDs=" + produit + "&Quantity_" + produit + "=" + quantite,
			assync : false,
			success : print_ajout(i),
		});
	}

	var contenu =  
		"<p>" +
		"Lors de la duplication d'une commande, les produits sont simplement rajoutés dans votre panier actuel.<br/>" +
		"Si vous désirez modifier les quantités, il suffit de consulter le panier " +
		"</p><br/>" +
		"<p align='center'>" +
		"<a href='"+ path2
		+"ViewCurrentReq-Edit'  class='input_button padding_2'>Visualer votre panier</a>" +
		"  <a href='#' onclick='hideover()' class='input_button padding_2'>Fermer la fenetre</a>  " +
		"</p><br/>";
		jQuery('#foot_over').html(contenu);

	
}

function print_ajout(i) {
	var h = jQuery('#corps_over').html();
	var v = jQuery('#sku'+i).val();
	var n = jQuery('#name'+i).val();
	var q = jQuery('#q'+i).val();
	var puce = "<img src='http://www.cae-extranet.fr/is-bin/intershop.static/WFS/CAE-EXT-Site/-/fr_FR/images/arrow_bt.png' class='position_picture'>";
	h = h + "<br/>" + puce +"<font color='#4B9F00'>"+ q + "x</font> " + "<font color='#E73C8C'>"+ v + "</font> - <i>" + n + "</i>";
	jQuery('#corps_over').html(h);
}
function hideover() {
	jQuery('#over').hide();
	jQuery('#fond').hide();
}
function showover() {
	jQuery('#over').show();
	jQuery('#fond').show();
}
