
function addtobasket(id,listcode,product_type,isValid){  
		var pro_num = 1;
		var pro_size = "-";
		var pro_color = "-";
		var formBuy = document.forms['LEBI_FORMBUY_'+listcode];
		if (formBuy)
		{
			var pro_num = formBuy.elements['pro_num_'+listcode+'_'+id].value;
			var pro_size = formBuy.elements['pro_size_'+listcode+'_'+id].value;
			if (pro_size == "")
			{
				var pro_size = document.getElementById("pro_size_"+listcode+"_"+id+"").options

[document.getElementById("pro_size_"+listcode+"_"+id+"").selectedIndex].value;  
			}
			var pro_color = formBuy.elements['pro_color_'+listcode+'_'+id].value;
			if (pro_color == null || pro_color == "")
			{
				var pro_color = document.getElementById("pro_color_"+listcode+"_"+id+"").options

[document.getElementById("pro_color_"+listcode+"_"+id+"").selectedIndex].value;  
			}
		}
		var url="Admin_order_cart.asp?action=buy&id="+id+"&pro_num="+pro_num+"&pro_size="+escape(pro_size)

+"&pro_color="+escape(pro_color)+"&product_type="+product_type;
		xmlHttp.open("GET", url, true);
        xmlHttp.send(null);  
		xmlHttp1.open("GET", "Ajax_cart.asp?showtype=0&t="+Math.random(), true);
		xmlHttp1.onreadystatechange = upcart;
        xmlHttp1.send(null);  
		fixedtooltip(formBuy.elements['button_'+listcode+'_'+id+''], "<b>恭喜：商品订购成功！</b><br><br><a 

href='Admin_order_cart.asp'>结帐</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='#'  

onclick=\"this.parentNode.style.display=\'none\';return false;\">继续订购</a>", null, null)
}

var _jsc = {};
_jsc.pos = (function(){
	var t = {};
	t.getX = function (obj){
        var curleft = 0;
        if (obj.offsetParent)
        {
          while (obj.offsetParent){
             curleft += obj.offsetLeft;
             obj = obj.offsetParent;
          }
          curleft += obj.offsetLeft;
        }
        else if (obj.x) {
          curleft += obj.x;
        }
        return curleft;
    };
    t.getY = function (obj){
    var curtop = 0;
        if (obj.offsetParent){
          while (obj.offsetParent){
             curtop += obj.offsetTop;
             obj = obj.offsetParent;
          }
          curtop += obj.offsetTop;
        }
        else if (obj.y)
          curtop += obj.y;
        return curtop;
    };
	return t;
})();

function market_tooltip(c){
	var _tooltips = document.getElementsByTagName('div');
	for (var i=0;i<_tooltips.length;i++) {
		if (_tooltips[i].getAttribute('tooltip') == 'market') _tooltips[i].parentNode.removeChild(_tooltips[i]);
	}
	var _tooltip = document.createElement('div');
	_tooltip.innerHTML = '<div id="fixedtipdiv">'+c+'</div>';
	_tooltip.className = 'mm_tips_market mm_tips_market_right';
	_tooltip.setAttribute('tooltip', 'market');
	//_tooltip.style.width='200px';
	_tooltip.style.zIndex = '9999';
	_tooltip.style.display = 'none';
	return document.body.appendChild(_tooltip);
}

// 气泡控制
var simple_fixedtooltip_timer;
function fixedtooltip(o, _tooltip_body,offsetT,offsetL){
	clearTimeout(simple_fixedtooltip_timer);
	var tooltip = market_tooltip(_tooltip_body);
	tooltip.style.top = offsetT ? (_jsc.pos.getY(o) + offsetT) + 'px' : (_jsc.pos.getY(o) - 80) + 'px';
	tooltip.style.left = offsetL ? (_jsc.pos.getX(o) + offsetL) + 'px' : (_jsc.pos.getX(o) - 80) + 'px';
	tooltip.style.display = 'block';
	tooltip.id = 'market_tooltip';
	tooltip.onmouseover = function() {
		clearTimeout(simple_fixedtooltip_timer);
	}
	simple_fixedtooltip_timer = setTimeout(function(){
		document.getElementById('market_tooltip').style.display = 'none';
	}, 6000);
}