var win=null;
function delGoods(){
  	var dels = '';
	var cart = document.ShoppingCart;


  	for(var i=0;i<cart.elements.length;i++){
  		if((cart.elements[i].checked == true) && (cart.elements[i].id.substr(0,3) == 'del')){
  			if(dels) dels += '|';
  			dels += cart.elements[i].id.substr(3);
  		}
  	}

  	if(dels){
  		//alert(dels);

  		window.open("http://www.tntmarket.com/explorer/delFromCart&dels=" + dels,"cart");


  		return true;
  	}
  	else{
  		//alert("false");
  		return false;
  	}
}

function NewWindow(mypage){
	settings='width=350,height=400,top=50,left=50,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,'Help',settings);
	if(win.focus){
		win.focus();
	}
}

function makeCart(){

  	//cart = window.open("","cart",'location=0,height=600,width=820,top=50,left=50,menubar=0,toolbar=0,resizable=0,scrollbars=1');
  	cart = window.open("","cart",'location=0,height=760,width=820,top=50,left=50,menubar=0,toolbar=0,resizable=0,scrollbars=1');
  	cart.focus();
};

function addToCart(form){
	makeCart();
  	form.submit();
  	return true;
}

function gotoUrl(url){
    location.href=url;
}
function returnToPriceList(){
	if (window.opener && !window.opener.closed)
		window.opener.focus();
	return true;
}
function setDeliveryLabel(i, cost){
	var el;
	var dls = [23];
	for(j=0;j<dls.length;j++){
		if(el = document.getElementById('deliveryLabel' + dls[j])){
			if(i == dls[j]){
				el.style.fontWeight = 'bold';
				el.style.color = '#000';
			}
			else
				el.style.fontWeight = 'normal';
		}
	}

	el = document.getElementById('discountNotice');
	el.style.display = 'none';
	if(el){
		if(cost >= 200 && i == 1) el.style.display = 'block';

	}
}
function number_format( number, decimals, dec_point, thousands_sep ) {
  var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
  var d = dec_point == undefined ? "." : dec_point;
  var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
  var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;

  return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}



