function addtp(prod,qty) {
//document.formaadp.action="addpanier.php?sid="+sess_id;
document.formaadp.action="addpanier.php";
document.formaadp.rtn_url.value=document.location.href;
if ((document.formaadp.sstr.value.length>0)&&(document.formaadp.rtn_url.value.indexOf("sstr=")<0)) 
	{
	document.formaadp.rtn_url.value=document.location.href+'&sstr='+document.formaadp.sstr.value;
	}
document.formaadp.adp.value=prod;
document.formaadp.qty.value=qty;
document.formaadp.submit();
}

function changevals(n,form) {
infodispodiv=document.getElementById(form.name.replace('fprod','infdispo'));

	
eval("showIt=showQ"+n+"[form.selectYe_prod.selectedIndex];");
eval("nbEnStock=qstock"+n+"[form.selectYe_prod.selectedIndex];");

if (showIt>0) 
	{
	eval("form.dispo.value=qstock"+n+"[form.selectYe_prod.selectedIndex];");
	infodispodiv.innerHTML=form.dispo.value;
	}
else {
		if (nbEnStock>0) 
			{
			form.dispo.value='OUI'; 
			infodispodiv.innerHTML='<img src="../images/coche.gif" width="13" height="12" title="en stock">';
			}
			else 
			{
			form.dispo.value='NON';
			infodispodiv.innerHTML='<img src="../images_style/b_drop.png" width="16" height="16" title="approvisionnement en cours">';
			}
		}

eval("tprix=pvente"+n+"[form.selectYe_prod.selectedIndex];");
eval("tpromo=pbarre"+n+"[form.selectYe_prod.selectedIndex];");

if (tpromo!="") { // check si prix promo
	form.prixb.value=' '+tpromo+" &euro;";
	form.prixb.size="10";
	form.prixb.className="pbarre";
	} 
	else
	{
	form.prixb.value="";
	form.prixb.size="1";
	form.prixb.className="pasbarre";
	} 	
form.prix.value=' '+tprix+" &euro;";	
}

function make_select(n,form) {

if (ctStkOnly==1) 
	eval("maxQ=qstock"+n+"[form.selectYe_prod.selectedIndex];"); 
	else maxQ=1000;
	
eval("Qmin=pcommini"+n+"[form.selectYe_prod.selectedIndex];");
eval("Qpack=ppack"+n+"[form.selectYe_prod.selectedIndex];");
while (form.qty.length>0) {form.qty.options[0] = null;}

// parproduit=new Array(); // already declared

qdja=(parproduit[form.selectYe_prod.options[form.selectYe_prod.selectedIndex].value]*1);
if (parproduit[form.selectYe_prod.options[form.selectYe_prod.selectedIndex].value]*1!=0) {
	if (qdja>0) {maxQ=(maxQ*1)-qdja;}
	}

j=0;
if ((qdja*1)==0) {i=Qmin;} else {i=Qpack;}
while (((i*1)<=(maxQ*1))&&(j<100)) {
    form.qty.options[j] = new Option(i, i,0,0);
	j++;
	i=(i*1)+(Qpack*1);
	}
if ((i*1)<(maxQ*1)) {form.qty.options[j] = new Option("+>", "+++",0,0);}
}

function checkplus(n,form) {
eval("maxQ=qstock"+n+"[form.selectYe_prod.selectedIndex];");
laqty=form.qty.options[form.qty.selectedIndex].value;
if (laqty=="+++") {
	laqty=prompt("Veuillez préciser la quantité SVP",maxQ);
	if (laqty*1>0) {
		if (confirm("Vous avez spécifié :"+laqty+"\nCliquez sur OK pour ajouter votre choix au panier")) {
			// addto panier ici !
			addtp(form.selectYe_prod.options[form.selectYe_prod.selectedIndex].value,laqty);
			} 
		}
	}
if (form.qty.options[form.qty.selectedIndex].value=="+++") {form.qty.selectedIndex=0;}
}
