
function MPOrder()
{
	var http_request = false;
	var http_content = "";
	var http_xmlreq = "http://www.cartoonec.com/";

	/**
	 * Loading XMLDOM
	 **/
	this.XMLRequest = function(xmlfile)
	{
		xmlfile = http_xmlreq + xmlfile;

		http_request = false;
		if (window.XMLHttpRequest)
		{ // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/xml');
			}
		}else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}

		if (!http_request) {
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}

		http_request.onreadystatechange = this.buildListview;
		http_request.open("GET", xmlfile, true);
		http_request.send(null);
	}

	/**
	 * Read XML Node
	 **/
	this.getText = function(oo)
	{
		if(!oo)
		{
			return "";
		}
		if(oo.textContent)
		{
			return oo.textContent;
		}
		
		if(oo.firstChild)
		{
			oo = oo.firstChild;    
		}

		if(oo.nodeValue)
		{
			return oo.nodeValue;
		}

		if(oo.data)
		{
			return oo.data;
		}

		return "";
	}

	this.Load = function()
	{
		this.XMLRequest("ordersend.asp");	
	}

	this.buildListview = function()
	{
		var Page = 0;
		var Pagenum = 0;
		var Total = 0;

		if (http_request.readyState == 4)
		{
			var documentElement = http_request.responseXML;
			var http_content = "";

			var Node = documentElement.getElementsByTagName("items").item(0);

			$("div_comment_listview").innerHTML = "";

			if (documentElement.getElementsByTagName("items").length != 0)
			{
				http_content += '<ul>';

				for (var i=0;i<Node.childNodes.length;i++)
				{
					var ChildNode = Node.childNodes[i];
					
					if (ChildNode.nodeType == 1)
					{
						if (window.ActiveXObject)
						{
							OId = MPOrder.getText(ChildNode.childNodes[0]);
							OTransportCompany = MPOrder.getText(ChildNode.childNodes[2]);
							OTransportId = MPOrder.getText(ChildNode.childNodes[1]);
						}else{
							OId = MPOrder.getText(ChildNode.childNodes[1]);
							OTransportCompany = MPOrder.getText(ChildNode.childNodes[4]);
							OTransportId = MPOrder.getText(ChildNode.childNodes[3]);
						}

						http_content += '<li>';
						http_content += '订单号: <a href="orderdetail.asp?orderid='+ OId +'">'+ OId +'</a><br/>';
						http_content += '发货单: '+ OTransportCompany +' '+ OTransportId +' <br/>';
						http_content += '</li>';
					}
				}

				http_content += '</ul>';
			}else{
				http_content = "<p align='center' style='height:24px;line-height:24px;'>暂无相关发货信息</p>"
			}

			$("loading_bar").style.display = "none";
			
			if (http_content.length != 0)
			{
				$("div_comment_listview").innerHTML = http_content;
			}
		}else{
		
		}
	}
}