//AUTOCOMPLETE DE ORIGEN
YAHOO.example.ACFlatData = new function(){
    // Define a custom formatter function
    this.fnCustomFormatter = function(oResultItem, sQuery) {
        var sKey = oResultItem[0];
        var nQuantity = oResultItem[1];
        var sKeyQuery = sKey.substr(0, sQuery.length);
        var sKeyRemainder = sKey.substr(sQuery.length);
        var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
            nQuantity,
            "</div>",
            sKeyQuery,
            "",
            sKeyRemainder,
            "</div>"];
	return (aMarkup.join(""));
	};

	// Instantiate one XHR DataSource and define schema as an array:
	//     ["Record Delimiter",
	//     "Field Delimiter"]
	this.oACDS = new YAHOO.widget.DS_XHR("/busca.aspx?control=origen&", ["\n", "\t"]);
	this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
	this.oACDS.maxCacheEntries = 100;
	this.oACDS.queryMatchSubset = false;

	// Instantiate second AutoComplete
	this.oAutoComp1 = new YAHOO.widget.AutoComplete('origen','ysearchcontainer1', this.oACDS);
	this.oAutoComp1.minQueryLength  = 3;
	this.oAutoComp1.delimChar = "";
	this.oAutoComp1.formatResult = this.fnCustomFormatter;
	this.oAutoComp1.typeAhead = false;
	this.oAutoComp1.useShadow = true;
	this.oAutoComp1.useIFrame = true;
	//this.oAutoComp1.autoHighlight = false;

	};

	//AUTOCOMPLETE DE DESTINO
	YAHOO.example.ACFlatData = new function(){
	// Define a custom formatter function
	this.fnCustomFormatter = function(oResultItem, sQuery) {
	var sKey = oResultItem[0];
	var nQuantity = oResultItem[1];
	var sKeyQuery = sKey.substr(0, sQuery.length);
	var sKeyRemainder = sKey.substr(sQuery.length);
	var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
            nQuantity,
            "</div>",
            sKeyQuery,
            "",
            sKeyRemainder,
            "</div>"];
	return (aMarkup.join(""));
	};

	// Instantiate one XHR DataSource and define schema as an array:
	//     ["Record Delimiter",
	//     "Field Delimiter"]
	this.oACDS = new YAHOO.widget.DS_XHR("/busca.aspx?control=destino&", ["\n", "\t"]);
	this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;

	this.oACDS.maxCacheEntries = 0;
	this.oACDS.queryMatchSubset = false;


	// Instantiate second AutoComplete
	this.oAutoComp2 = new YAHOO.widget.AutoComplete('destino','ysearchcontainer2', this.oACDS);
	this.oAutoComp2.minQueryLength  = 3;
	this.oAutoComp2.delimChar = "";
	this.oAutoComp2.formatResult = this.fnCustomFormatter;
	this.oAutoComp2.typeAhead = false;
	this.oAutoComp2.useShadow = true;
	this.oAutoComp2.useIFrame = true;
	//this.oAutoComp2.autoHighlight = false;
	};



  YAHOO.example.ACFlatData = new function(){
  // Define a custom formatter function
  this.fnCustomFormatter = function(oResultItem, sQuery) {
  var sKey = oResultItem[0];
  var nQuantity = oResultItem[1];
  var sKeyQuery = sKey.substr(0, sQuery.length);
  var sKeyRemainder = sKey.substr(sQuery.length);
  var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
      nQuantity,
      "</div>",
      sKeyQuery,
      "",
    sKeyRemainder,
    "</div>"];
	return (aMarkup.join(""));
	};

	// Instantiate one XHR DataSource and define schema as an array:
	//     ["Record Delimiter",
	//     "Field Delimiter"]
	this.oACDS = new YAHOO.widget.DS_XHR("/busca.aspx?control=origenofertas&", ["\n", "\t"]);
	this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;

	this.oACDS.maxCacheEntries = 0;
	this.oACDS.queryMatchSubset = false;


	// Instantiate second AutoComplete
	this.oAutoComp2 = new YAHOO.widget.AutoComplete('origenofertas','ysearchcontainer3', this.oACDS);
	this.oAutoComp2.minQueryLength  = 3
	this.oAutoComp2.delimChar = "";
	this.oAutoComp2.formatResult = this.fnCustomFormatter;
	this.oAutoComp2.typeAhead = false;
	this.oAutoComp2.useShadow = true;
	this.oAutoComp2.useIFrame = true;
	//this.oAutoComp2.autoHighlight = false;
	};

	YAHOO.example.ACFlatData = new function(){
	// Define a custom formatter function
	this.fnCustomFormatter = function(oResultItem, sQuery) {
	var sKey = oResultItem[0];
	var nQuantity = oResultItem[1];
	var sKeyQuery = sKey.substr(0, sQuery.length);
	var sKeyRemainder = sKey.substr(sQuery.length);
	var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
			nQuantity,
			"</div>",
		sKeyQuery,
		"",
		sKeyRemainder,
		"</div>"];
	return (aMarkup.join(""));
	};

	// Instantiate one XHR DataSource and define schema as an array:
	//     ["Record Delimiter",
	//     "Field Delimiter"]
	this.oACDS = new YAHOO.widget.DS_XHR("/busca.aspx?control=destinofertas&", ["\n", "\t"]);
	this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;

	this.oACDS.maxCacheEntries = 0;
	this.oACDS.queryMatchSubset = false;


	// Instantiate second AutoComplete
	this.oAutoComp4 = new YAHOO.widget.AutoComplete('destinofertas','ysearchcontainer4', this.oACDS);
	this.oAutoComp4.minQueryLength  = 3
	this.oAutoComp4.delimChar = "";
	this.oAutoComp4.formatResult = this.fnCustomFormatter;
	this.oAutoComp4.typeAhead = false;
	this.oAutoComp4.useShadow = true;
	this.oAutoComp4.useIFrame = true;
	//this.oAutoComp4.autoHighlight = false;
	};

