
	function tipLookup()
	{

	}
	
	//var to hold an instance of the XMLHTTPRequest object
	tipLookup.prototype._request = undefined;

	// Application Callbacks
	tipLookup.prototype.appCallback = undefined;
	tipLookup.prototype.errCallback = undefined;
	
	// Other data
	tipLookup.prototype.tipId = -1;
	tipLookup.prototype.ToolID = -1;
	tipLookup.prototype.keyword = '';
	tipLookup.prototype.tip = '';
	tipLookup.prototype.refUrl = '';

	
	//
	// Invokes the lookup
	//
	tipLookup.prototype.lookup = function(siteId, ToolID, keyword)
	{
		this._request = ajaxRequestNew();
		var url = ajaxSiteUrl + '/itg/hm/ajax/tipLookup.asp?ToolID=' + ToolID + '&keyword=' + keyword;
		
		var _this = this;
		
		this._request.onreadystatechange = function(){ _this._lookupCallback() };
		
		this._request.open("GET", url, true);
		this._request.send(null);
		
	}
		
	//
	// tip Lookup
	//
	tipLookup.prototype._lookupCallback = function()
	{
		if (this._request.readyState == 4) 
		{
			// Transaction completed				
			if (this._request.status == "200") 
			{
				
				var response       = this._request.responseXML.documentElement;
				
				this.tipId      = response.getElementsByTagName('tipId')[0].firstChild.data;
				this.tip        = response.getElementsByTagName('tip')[0].firstChild.data;
				this.refUrl     = response.getElementsByTagName('refUrl')[0].firstChild.data;
				
				try
				{
					this.appCallback(this);
				}
				catch (e)
				{
					if (this.errCallback)						
					{
						this.errCallback(e)
					}
					else
					{
						alert('error ->' + e);						
					}

				}
				
//				alert(this.tipId);
//				alert(this.tip);
//				alert(this.isExpired);
//				alert(this.discount);
//				alert(this.discountType);
				
				delete this_request;
			} 
			else 
			{
				//check if an error callback handler has been defined
//				if(this.onError != undefined)
//				{
//					//pass an object to the callback handler with info about the error
//					this.onError({status:this_request.status, statusText:this._request.statusText});
//				}				
//				else
//				{
					  alert ('error -> ' + this._request.status);					
//				}

			}
		}		
	}



