// Created by LiuYang 12/2006  ---> http://aboutliuyang.blogspot.com/index.html
// This file just deals with putting in to cart, no cart submission

function SpaceFilter(string) { //replace the spaces with "."
	var temp = "";
	string = '' + string;
	splitstring = string.split(" "); //双引号之间是个空格；
	for(i = 0; i < splitstring.length; i++)
	temp += splitstring[i]+".";
	return temp;
}

/*create text fileds in cart*/
function addToCart2(table_id) {
	var cartTable = parent.leftFrame.tb_cart;
	var itemTable = document.getElementById(table_id);
	itemInfo = itemTable.rows[0].cells[0].innerText+"; "+itemTable.rows[0].cells[1].innerText;

	//handling spaces
	itemInfo = SpaceFilter(itemInfo);
	
	//insert a new row and two cells
	cartTable.insertRow(cartTable.rows.length);
	cartTable.firstChild.lastChild.insertCell();
	cartTable.firstChild.lastChild.insertCell();
	
	//add check box and textfield
	cartTable.firstChild.lastChild.firstChild.innerHTML = '<input type="checkbox">';
	cartTable.firstChild.lastChild.lastChild.innerHTML = '<input type="text" name="ITEM" style="BORDER-RIGHT: 2px groove; BORDER-TOP: 2px groove; BORDER-LEFT: 2px groove; BORDER-BOTTOM: 2px groove" value='+itemInfo+'>';
}

/*create table elements in cart*/
function addToCart(table_id) {
	var cartTable = parent.leftFrame.tb_cart;
	var itemTable = document.getElementById(table_id);
	itemInfo = itemTable.rows[0].cells[0].innerText+"; "+itemTable.rows[0].cells[1].innerText;

	//handling length
	//itemInfo = SpaceFilter(itemInfo);
	
	//insert a new row and two cells
	cartTable.insertRow(cartTable.rows.length);
	cartTable.firstChild.lastChild.insertCell();
	cartTable.firstChild.lastChild.insertCell();
	
	//add check box and textfield
	cartTable.firstChild.lastChild.firstChild.innerHTML = '<input type="checkbox">';
	cartTable.firstChild.lastChild.lastChild.innerText = itemInfo;


}


