//
//  Alapage Remote ShoppingCart Functions v 1.0 - (24-jun-2004)
//  Written by:  Alapage.com
//  The following functions are released to the public domain.

//
//  Function to add product on your Alapage remote shopping cart.
//    category - Alapage.com Catalogue Category code.
//    productId - Alapage.com product code
//    productSupport - Alapage.com product support code
//    quantity - numbers of product ordered
//    returns - nothing
//


//
//  positionne la source de la IFRAME "ShoppingCartIframe" sur une URL d'ajout 
//  (http://www1.alapage.dev.villiers.e-merchant.org/cart/shoppingcart.php)
//
function addToCart(category,productId,productSupport,quantity,sv,myRemoteSessionId,partnerId,usedAndNewNum)
{
	if (category == 51 || category == 52) {
		category = 5;
	}

	//var myRemoteSessionId = window.frames['shoppingCartSessionManager'].document.forms['shoppingCartSessionContainer'].elements['myRemoteSessionId'].value;
	var myShoppingCartUrl = AlapageURL+ShoppingServiceRoot+ShoppingServiceFile+"?shoppingCart=add&id="+myRemoteSessionId+"&donnee_appel="+partnerId+"&pdt[]="+category+"_"+productId+"_"+quantity+"_"+productSupport+"_"+usedAndNewNum+sv;
	document.getElementById("shoppingCartIFrame").src=myShoppingCartUrl;
}

function MultiaddToCart(formCart,quantity,sv,myRemoteSessionId,partnerId)
{
	var myShoppingCartUrl = AlapageURL+ShoppingServiceRoot+ShoppingServiceFile+"?shoppingCart=add&id="+myRemoteSessionId+"&donnee_appel="+partnerId+sv;
	var MiniOne=false;
	var i=0;
	while(typeof formCart.product[i] != 'undefined')
	{
		if(formCart.product[i].checked == true)
		{
			myShoppingCartUrl = myShoppingCartUrl+"&pdt[]="+formCart.product[i].value;
			MiniOne=true;
		}
		i++;
	}
	if(MiniOne) {
		document.getElementById("shoppingCartIFrame").src=myShoppingCartUrl;
	}
}