
	function orderRowType(element, parent) {

		this._element = element;
		this._parent = parent;

		this.option = dataTypeFactory('string', 'option', this);
		this.price = dataTypeFactory('string', 'price', this);
		this.ship = dataTypeFactory('string', 'ship', this);
		this.support = dataTypeFactory('string', 'support', this);
		this.total = dataTypeFactory('string', 'total', this);
		this.iva = dataTypeFactory('string', 'iva', this);
		this.totiva = dataTypeFactory('string', 'totiva', this);

		this.setValue = function(str ) { }
		this.getObjElement = _complexGetObjElement;
		this.addChild = _returnSelf;
		this.toXML = function (level) {
                   if(!(level > 0))
                     level = 0;
                   var ret = stringOfChar('\t',level) + '<' + this._element + '>';

		   ret += this.option.toXML(level+1);
		   ret += this.price.toXML(level+1);
		   ret += this.ship.toXML(level+1);
		   ret += this.support.toXML(level+1);
		   ret += this.total.toXML(level+1);
		   ret += this.iva.toXML(level+1);
		   ret += this.totiva.toXML(level+1);

                   ret += '</' + this._element + '>\n';
		   return ret;
		}
		return this;
	}

	function orderDocumentType(element, parent) {

		this._element = element;
		this._parent = parent;

		this.id = dataTypeFactory('string', 'id', this);
		this.date = dataTypeFactory('string', 'date', this);
                this.company = dataTypeFactory('string', 'company', this);
                this.username = dataTypeFactory('string', 'username', this);
                this.email = dataTypeFactory('string', 'email', this);
                this.phone = dataTypeFactory('string', 'phone', this);
                this.fulladdress = dataTypeFactory('string', 'fulladdress', this);
                this.cap = dataTypeFactory('string', 'cap', this);
                this.city = dataTypeFactory('string', 'city', this);
                this.province = dataTypeFactory('string', 'province', this);
                this.orderno = dataTypeFactory('string', 'orderno', this);
                this.clientip = dataTypeFactory('string', 'clientip', this);
                this.piva = dataTypeFactory('string', 'piva', this);
                this.cf = dataTypeFactory('string', 'cf', this);

		this.rows = dataTypeFactory('complex', 'rows',  this);
		this.rows.createChild = function() {
                   ret = new orderRowType('row', this); 
                   return ret
                }

 	        this.setValue = function(str ) { }
		this.getObjElement = _complexGetObjElement;
                this.addChild = _returnSelf;
                this.toXML = function (level) {

		    if(!(level > 0))
                        level = 0;

                    var ret = stringOfChar('\t',level) + '<' + this._element + '>';
                    ret += this.id.toXML(level+1);
                    ret += this.date.toXML(level+1);
                    ret += this.company.toXML(level+1);
                    ret += this.username.toXML(level+1);
                    ret += this.email.toXML(level+1);
                    ret += this.phone.toXML(level+1);
                    ret += this.fulladdress.toXML(level+1);
                    ret += this.cap.toXML(level+1);
                    ret += this.city.toXML(level+1);
                    ret += this.province.toXML(level+1);
                    ret += this.orderno.toXML(level+1);
                    ret += this.clientip.toXML(level+1);
                    ret += this.piva.toXML(level+1);
                    ret += this.cf.toXML(level+1);

                    ret += this.rows.toXML(level+1);
                    ret += '</' + this._element + '>\n';
                    return ret;
		}
		return this;
	}

 dataTypeInitialize();

 var docType = 'Order';
 var sourceSite = '';

 var command = '/order/current.xml';
 var Order = null;

 var processXml = function ( xml) {
     var aStack = [];
     Order = new orderDocumentType('Order', null);
     aStack.push(Order);
     var aNode = xml;
     xml2Objects(aNode, aStack);
	 getPrice ();
 }
