dojo.declare("ProductDatasetLookup", null, {
	searchDataSetForSku: function(dataSet, sku, depth, foundAtInfo,prodCnt){
		if(foundAtInfo == null)
			foundAtInfo = {};
			
		if (dataSet[prodCnt].sku && (dataSet[prodCnt].sku == sku)) {
			foundAtInfo["depth" + depth + "_index"] =prodCnt + 1;
			foundAtInfo["wasFound"] = true;
					}
		else {
			if (dataSet[prodCnt]["attr" + (depth + 1)]) {
				foundAtInfo["depth" + depth + "_index"] = prodCnt + 1;
				foundAtInfo = this._searchDataSetForSkuHelper(dataSet[prodCnt]["attr" + (depth + 1)], sku, depth + 1, foundAtInfo);
			}
		}
		return foundAtInfo;
	},
	_searchDataSetForSkuHelper: function(dataSet, sku, depth, foundAtInfo){
		//if we already found our value, recurse out.
		if(foundAtInfo["wasFound"] && (foundAtInfo["wasFound"] == true))
			return foundAtInfo;
			
		for(var i = 0; i < dataSet.length; i++){
			if (dataSet[i].sku && (dataSet[i].sku == sku)) {
				foundAtInfo["depth" + depth + "_index"] = i+1;
				foundAtInfo["wasFound"] = true;
				
				break;
			}
			else {
				if (dataSet[i]["attr" + (depth + 1)]) {
					foundAtInfo["depth" + depth + "_index"] = i+1;
					foundAtInfo = this._searchDataSetForSkuHelper(dataSet[i]["attr" + (depth + 1)], sku, depth + 1, foundAtInfo);
					//if we already found our value, break out.
					if(foundAtInfo["wasFound"] && (foundAtInfo["wasFound"] == true))
					{
						
						break;
					}
				}	
			}
		}
		return foundAtInfo;
	}	
});