/**
 * Copyright (c) 2010, Culnou. All rights reserved.
 * http://www.culnou.com/license.txt
 * version: 1.0
*/

function addToCart(id, name, price, isBto) {
	var command = new AddCartCommand();
	var idInt = parseInt(id);
	var priceInt = parseInt(price);

	var quantityTag = document.getElementById('quantity');
	var quantityInt = parseInt(quantityTag.value);

	var productItem = {id:idInt, name:name, btoName:name, price:price, quantity:quantityInt, bto:isBto}

	command.execute(productItem);
}

function moveToProductsOfCategory() {
	var productLargeCategoryTag = document.getElementById('productLargeCategoryId');
	for (var i=0; i<productLargeCategoryTag.options.length; i++) {
		if (productLargeCategoryTag.options[i].selected == true) {
			var url = "/pc_bto/sales/category/" + productLargeCategoryTag.options[i].value;
			location.href = url;
		}
	}
}

function loadLeftContainer() {
	// immigrate left web contents from xml file.
	var leftContainerContentsTag = document.getElementById("leftContainerContents");
	Utils.appendXmlNode("/webcontents/pages/ones/leftContainerContents.xml", leftContainerContentsTag);
}

