/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \
|		
|		Copyright (c) 2008 C'EST NETTEMENT MIEUX
|		http://www.nettementmieux.com/
|		
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


/* ______________________[ JQuery ]________________________ */

$('document').ready(function(){
	/* Access to payment if terms checkbox is checked */
	if ($("p.com-chkout-listing-terms input").is(":checked")){
		$("#gotoPayment").show();
	} else {
		$("#gotoPayment").hide();
	}
	$("p.com-chkout-listing-terms input").click(function(){
		if ($("p.com-chkout-listing-terms input").is(":checked")){
			$("#gotoPayment").show("fast");
		} else {
			$("#gotoPayment").hide("fast");
		}
	});
});



/* ______________________[ Incrˇmentation / Dˇcrˇmentation d'un nombre d'article dans la vue single d'un produit]________________________ */

function setArticleQuantity(articleUid,articlePrice,quantity) {
	var artQty = parseInt(document.forms.productForm['tx_commerce_pi1[artAddUid]['+articleUid+'][count]'].value);
	var basketPrice;
	artQty += quantity; 
	if(artQty >= 0){
		// Update quantity
		document.forms.productForm['tx_commerce_pi1[artAddUid]['+articleUid+'][count]'].value = artQty;
		// Update basket price : quantity * unit price
		basketPrice = (artQty*articlePrice)/100;
		basketPrice = basketPrice.toFixed(2).toString();
		document.getElementById('articleBasketPrice_'+articleUid).innerHTML = basketPrice.replace(/\./,",");
	}
}

/* ______________________[ Incrˇmentation / Dˇcrˇmentation d'un nombre d'article dans le panier]________________________ */

function setBasketArticleQuantity(articleUid,articlePrice,quantity) {
	var artQty = parseInt(document.forms.basket['tx_commerce_pi1[artAddUid]['+articleUid+'][count]'].value);
	artQty += quantity; 
	if(artQty >= 0){
		// Update quantity
		document.forms.basket['tx_commerce_pi1[artAddUid]['+articleUid+'][count]'].value = artQty;
	}
}

