var ajax=function () 
{
	var xmlObj = false;
	var selfObj;
	selfObj=this;
	try { xmlObj=new XMLHttpRequest; }
	catch(e) {
		try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
		catch(e2) {
			try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e3) { xmlObj=false; }
		}
	}
	if (!xmlObj) return false;
	this.method="GET";// POST
	this.url;
	this.async=true;
	this.content="";
	this.callback=function(cbobj) {return;}
	this.requestValue;
	this.send=function() {
		if(!this.method||!this.url||!this.async) return false;
		xmlObj.open (this.method, this.url, this.async);
		if(this.method=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlObj.onreadystatechange=function() {
			if(xmlObj.readyState==4) {
				if(xmlObj.status==200) selfObj.callback(xmlObj.responseText);
				else selfObj.callback(selfObj.getError(xmlObj.status));
			}
		}
		if(this.method=="POST") xmlObj.send(this.content);
		else xmlObj.send(null);
	}
	this.getError=function(errs)
	{
		if(errs=='403'){
			return 'Sorry, but you do not have permission to perform the current operation.';//非常抱歉，您没有执行当前操作的权限
		}else if(errs=='404'){
			return 'Page does not exist or will be unable to access.';//页面不存在或则会无法访问
		}else{
			return 'Sorry, operation failed.';//非常抱歉，操作失败
		}
	}
}
function $(id){return document.getElementById(id);}
function getClientRect(obj) {
	
	var ol = obj.offsetLeft;
	var ot = obj.offsetTop;
	var or=obj.offsetWidth;
	var ob=obj.offsetHeight;
	while((obj = obj.offsetParent) != null) {
		ol += obj.offsetLeft;
		ot += obj.offsetTop;
	}
	return { 'left' : ol, 'top' : ot,'right' : or,'bottom' : ob };
}
function showStatusBox(p,r,t) {
	var oRect = getClientRect(p);

	var nl=oRect['left'];
	var nt=oRect['top'];
	var nw=oRect['right'];
	var nh=oRect['bottom'];
	
	var winObj=$('statusBox');
	winObj.style.position="absolute";
	
	winObj.style.zIndex=9999;
	winObj.style.filter = "Alpha(Opacity=95)";
	winObj.style.opacity=0.95;
	//winObj.innerHTML="";
	winObj.style.display="block";
	winObj.style.left=nl+(r==1?nw-winObj.offsetWidth:0)+"px";
	winObj.style.top=nt+(t!=0?t:nh)+"px";
	
	winObj.oncontextmenu=function(){return false;};
	winObj.ondragstart=function(){return false;};
	winObj.onselectstart=function(){return false;};
	
}
function setStatusBox(t)
{
	if(t==0){
		$('statusBox').innerHTML='<img src="/images/loading.gif" align="absmiddle" />Are being submitted.<br/>Please wait...';
		return true;
	}else if(t==1){
		$('statusBox').style.width='300px';
		$('statusBox').innerHTML='<p>Your goods have been successfully submitted to the shopping cart, whether to see now or not?<br/><a href="/sonny/cartlist/"><strong>Yes</strong></a></p>';
		//您的产品已成功提交到购物车，是否现在就查看？
	}else if(t==2){
		$('statusBox').innerHTML='<p>Your goods have been modified successfully!</p>';
		//您的商品已修改成功！
	}else if(t==5){
		$('statusBox').innerHTML='<p align="center"><img src="/images/arrow1.gif" align="absmiddle" />OK</p>';
		setTimeout("document.getElementById('statusBox').style.display='none'", 1000);
		return true;
	}else{
		$('statusBox').innerHTML='<p>Sorry, operation failed.</p>';
	}
	setTimeout("document.getElementById('statusBox').style.display='none'", 9000);
}