function AjaxRequest($requestURL, $responseFunction, $responseArguments, $delayTime) {
	if($delayTime === undefined || $delayTime < 10) {
		$delayTime = 700;
	}
	
	if($responseArguments === undefined) {
		$responseArguments = null;
	}
	
	this.requestURL = $requestURL;
	this.responseFunction = $responseFunction;
	this.responseArguments = $responseArguments;
	this.delayTime = $delayTime;
	
	this.timeoutObject = null;
	this.httpRequestObj = null;
	
	this.constructor = 'AjaxRequest';
	
	this.debug = false;
}


// This is used internally to build the http object
AjaxRequest.prototype.getHTTPObject = function() {
	var ro;
	var browser = navigator.appName;
	
	if(this.debug) {
		alert('DEBUG MODE: building http request: ' + browser);
	}
	
	if(browser == "Microsoft Internet Explorer") {
		try {
			ro = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			try {
				ro = new ActiveXObject("Msxml2.XmlHttp");
				
				if(this.debug) {
					alert('DEBUG MODE: retry 1: ' + ro);
				}
			} catch(e) {
				try {
					ro = new ActiveXObject("MSXML2.XMLHTTP");
					if(this.debug) {
						alert('DEBUG MODE: retry 2: ' + ro);
					}
				} catch(e) {
					try {
						ro = new ActiveXObject("Msxml2.XMLHTTP");
						
						if(this.debug) {
							alert('DEBUG MODE: retry 3: ' + ro);
						}
					} catch(e) {
						try {
							ro = new ActiveXObject("Msxml3.XMLHTTP");
							
							if(this.debug) {
								alert('DEBUG MODE: retry 4: ' + ro);
							}
						} catch(e) {
							try {
								ro = new ActiveXObject("MSXML3.XMLHTTP");
								
								if(this.debug) {
									alert('DEBUG MODE: retry 5: ' + ro);
								}
							} catch(e) {
								try {
									ro = new ActiveXObject("MSXML.XMLHTTP");
									
									if(this.debug) {
										alert('DEBUG MODE: retry 6: ' + ro);
									}
								} catch(e) {
									try {
										ro = new ActiveXObject("Msxml3.XmlHttp");
										
										if(this.debug) {
											alert('DEBUG MODE: retry 7: ' + ro);
										}
									} catch(e) {
										try {
											ro = new ActiveXObject("Msxml.XmlHttp");
											
											if(this.debug) {
												alert('DEBUG MODE: retry 8: ' + ro);
											}
										} catch(e) {
											try {
												ro = new ActiveXObject("MSXML.XmlHttp");
												
												if(this.debug) {
													alert('DEBUG MODE: retry 9: ' + ro);
												}
											} catch(e) {
												try {
													ro = new ActiveXObject("Excel.Application");
													
													if(this.debug) {
														alert('DEBUG MODE: retry 10: ' + ro);
													}
												} catch(e) {
													if(this.debug) {
														alert('DEBUG MODE: no ajax requests: ' + e.description);
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	} else {
		ro = new XMLHttpRequest();
	}
	
	if(this.debug) {
		alert('DEBUG MODE: request object: ' + ro);
	}
	//alert('test1' + this.constructor);
	
	//alert('test2' + ro.constructor);
	
	this.httpRequestObj = ro;
	
	//alert('test3' + this.httpRequestObj.constructor);
	
	//alert('test4' + this.constructor);
}


// This function sends the ajax request immediately
AjaxRequest.prototype.sendRequest = function() {
	if(this.debug) {
		alert('DEBUG MODE: sending request: ' + this.requestURL);
	}
	
	if(this.httpRequestObj == null) {
		//this.httpRequestObj = this.getHTTPObject();
		this.getHTTPObject();
		if(this.debug) {
			alert('DEBUG MODE: building http request: ' + this.httpRequestObj);
		}
		
		var fullRequestURL = this.requestURL;
		
		// If we have some required params to pass as well
		if(isset(this.responseArguments) && isset(this.responseArguments['ajaxAdditionalParams'])) {
			var appendRequestVals = new Array();
			var i = 0;
			for(param in this.responseArguments['ajaxAdditionalParams']) {
				if(typeof this.responseArguments['ajaxAdditionalParams'][param] != "function") {
					if(param == 'class' || param == 'text') {
						urlParam = 'search_' + param;
					} else {
						urlParam = urlencode(param);
					}
					
					appendRequestVals[i] = urlParam + '=' + urlencode(this.responseArguments['ajaxAdditionalParams'][param]);
					i++;
				}
			}
			
			if(fullRequestURL.indexOf("?") == - 1) {
				fullRequestURL = this.requestURL + '?' + appendRequestVals.join('&');
			} else {
				fullRequestURL = this.requestURL + '&' + appendRequestVals.join('&');
			}
		}
		
		if(this.debug) {
			alert('DEBUG MODE: full request: ' + fullRequestURL);
		}
		
		this.httpRequestObj.open("GET", fullRequestURL, true);
		this.httpRequestObj.send(null);
		//this.httpRequestObj.onreadystatechange = this.processResponse();
		this.httpRequestObj.onreadystatechange = (function(ajaxRequestObj) {
			return function() {
				if(ajaxRequestObj.debug) {
					alert('DEBUG MODE: readystatechange: ' + ajaxRequestObj.httpRequestObj.readyState);
				}
				
				if(ajaxRequestObj.httpRequestObj.readyState == 4) {
					//alert('test1' + ajaxRequestObj.responseFunction);
					if(ajaxRequestObj.debug) {
						alert('DEBUG MODE: readystatechange: ' + ajaxRequestObj.responseFunction);
					}
					ajaxRequestObj.responseFunction(ajaxRequestObj.httpRequestObj.responseXML, ajaxRequestObj.responseArguments);
					ajaxRequestObj.httpRequestObj = null;
				}
			}
		})(this);
	}
}


/* This doesn't work... but is basically what is passed to your responseFunction
AjaxRequest.prototype.processResponse = function() {
	return function() {
		if(this.httpRequestObj.readyState == 4) {
			alert(this.responseFunction);
			alert(this.responseArguments);
			alert(this.httpRequestObj.responseXML);
			this.responseFunction(this.httpRequestObj.responseXML, this.responseArguments);
			this.httpRequestObj = null;
		}
	}
}*/


// This function is used to delay the ajax request... say in an onkeyup call
AjaxRequest.prototype.start = function() {
	this.cancel();
	
	if(this.debug) {
		alert('DEBUG MODE: starting request: ' + this.requestURL);
	}
	
	var requestObj = this;
	
	this.timeoutObject = setTimeout((function($ajaxRequestObj) {
		return function() {
			//alert($ajaxRequestObj);
			$ajaxRequestObj.sendRequest();
		}
	})(requestObj), this.delayTime);
}


// This function is used to cancel an ajax request... say in an onkeydown call
AjaxRequest.prototype.cancel = function() {
	if(this.timeoutObject != null) {
		clearTimeout(this.timeoutObject);
	}
}


/* AjaxSearchable functions */

NimbusModel = {
	divObj: '',
	hidFieldId: '',
	requestArgs: new Array(),
	
	quickAdd: function(className, identifier) {
		this.processQuickAdd = (function(myClassName, myIdentifier, divObj, hidFieldId, requestArgs) {
			return function($xmlResponse, $requestArguments) {
				var $responseNode = $xmlResponse.getElementsByTagName('response')[0];
				
				// If the xml response has an error
				if($responseNode.getAttribute('error') != null) {
					alert($responseNode.getAttribute('error'));
				} else {
					//alert($responseNode.childNodes[0].nodeName + ': ' + $responseNode.childNodes[0].childNodes[0].nodeValue);
					var $returnId = $responseNode.childNodes[0].childNodes[0].nodeValue;
					// We should probably do some error checking to see if the add failed.
					document.getElementById(hidFieldId).value = $returnId;
					if(divObj) {
						divObj.parentNode.style.display = 'none';
						divObj.parentNode.innerHTML = '';
					}
				}
			}
		})(className, identifier, NimbusModel.divObj, NimbusModel.hidFieldId, NimbusModel.requestArgs);
		
		this.ajaxRequest = new AjaxRequest('ajax_model.php?class=' + urlencode(className) + '&func=quickAdd&identifier=' + urlencode(identifier), this.processQuickAdd, NimbusModel.requestArgs);
		//this.ajaxRequest.debug = true;
		
		this.ajaxRequest.sendRequest();
	}
}

// I'd like to see how much I can move to this namespacing method, I think it will be extremely beneficial.
AjaxSearchField = {
	blur: function(fieldId) {
		setTimeout('AjaxSearchField.delayedBlur(\'' + fieldId + '\');',400); // I found that 100 or less was not enough time to register the onclick
	},
	
	delayedBlur: function(fieldId) {
		AjaxSearchField.resetText(fieldId);
		document.getElementById(fieldId + '__ResultsDiv').style.display = 'none';
	},
	
	focus: function(fieldId) {
		var defaultText;
		
		eval('defaultText = ' + fieldId + '__DefaultText;');
		
		if (document.getElementById(fieldId + '__SearchField').value == defaultText) {
			document.getElementById(fieldId + '__SearchField').value = '';
			document.getElementById(fieldId + '__SearchField').className = 'ajaxSearchFieldInput';
		}
		
		document.getElementById(fieldId + '__SearchField').select();
	},
	
	resetText: function(fieldId) {
		var tempVal;
		var defaultText;
		
		try {
			eval('defaultText = ' + fieldId + '__DefaultText;');
		} catch(e) {
			defaultText = '';
		}
		
		// If our hidden input is empty, reset it to our default
		if(document.getElementById(fieldId).value == '') {
			document.getElementById(fieldId + '__SearchField').value = defaultText;
			document.getElementById(fieldId + '__SearchField').className = 'ajaxSearchFieldInputEmpty';
		}
		// Otherwise set it to whatever value we selected last
		else {
			eval('tempVal = ' + fieldId + '__CurrentText;');
			// If tempVal is our default or empty, we want to set it to our default
			if(tempVal == defaultText || tempVal == '') {
				document.getElementById(fieldId + '__SearchField').value = defaultText;
				document.getElementById(fieldId + '__SearchField').className = 'ajaxSearchFieldInputEmpty';
			} else {
				document.getElementById(fieldId + '__SearchField').value = tempVal;
				document.getElementById(fieldId + '__SearchField').className = 'ajaxSearchFieldInput';
			}
		}
	},
	
	setText: function(fieldId, newText) {
		eval(fieldId + '__CurrentText = newText;');
	}
}

/* Callback functions */
function proccessAjaxSearchResponse($xmlResponse, $requestArguments) {
	//alert($requestArguments.constructor);
	// RESULTS DIV ID
	var $resultsDivId = $requestArguments['ajaxSearchFieldId'] + "__ResultsDiv";
	var $resultsDiv = document.getElementById($resultsDivId);
	//alert($resultsDiv);
	// HIDDEN INPUT FIELD ID
	var $hiddenFieldId = $requestArguments['ajaxSearchFieldId'];
	//var $hiddenField = document.getElementById($hiddenFieldId);
	
	var $responseNode = $xmlResponse.getElementsByTagName('response')[0];
	
	//alert($responseNode.nodeName + ': ' + $responseNode.innerHTML);
	//alert($responseNode.childNodes.length);
	
	if($responseNode && $resultsDiv) {
		// RESET RESULTS
		$resultsDiv.innerHTML = '';
		var $showDiv = false;
		
		// IF THE XML RESPONSE HAS AN ERROR
	 	if($responseNode.getAttribute('error') != '') {
			//alert('Warning: ' + $responseNode.getAttribute('error'));
			$resultsDiv.innerHTML = '<div class="error" onclick="document.getElementById(\'' + $resultsDiv.id + '\').style.display=\'none\';document.getElementById(\'' + $resultsDiv.id + '\').style.border=\'none\';">Warning: ' + $responseNode.getAttribute('error') + ' <a href="#' + $resultsDiv.id + '" onclick="document.getElementById(\'' + $resultsDiv.id + '\').style.display=\'none\';return false">close</a></div>';
			$showDiv = true;
		}
		
		var $xmlNodeArray = $xmlResponse.getElementsByTagName('row');
		
		if($xmlNodeArray && $xmlNodeArray.length > 0) {
			$showDiv = true;
			//alert('got this far.');
			//alert(print_r($responseNode.childNodes));
			// FOR EVERY ITEM
			for(var $i = 0; $i < $xmlNodeArray.length; $i++) {
				//alert(print_r($xmlNodeArray[$i].nodeName));
				var $tempDiv = document.createElement('div');
				$tempDiv.innerHTML = $xmlNodeArray[$i].getAttribute('name');
				$tempDiv.className = 'ajaxResultsItem';
				
				// If we defined our own onclick for an individual item in the dropdown list... use that instead
				var $tempOnclick = $xmlNodeArray[$i].getAttribute('onclick');
				if($tempOnclick) {
					$tempDiv.onclick = (function(myDivObj, myHidFieldId, myNewValue, myNewText, myRequestArgs) {
						return function() {
							// divObj and other necessary variables aren't defined in our
							// eval, especially if our $tempOnclick is just a function. So we need to somehow
							// wrap our $tempOnclick in a closure and eval that.
							//eval('(function(divObj, hidFieldId, newValue, newText, requestArgs) {return ' + $tempOnclick +'})(divObj, hidFieldId, newValue, newText, requestArgs)');
							// not sure that was the problem at all, looking at it again.
							//alert(myHidFieldId); // it's defined here, but are not defined in our eval function.
							//eval('var eDivObj = myDivObj;var eHidFieldId = myHidFieldId;var eNewValue = myNewValue;var eNewText = myNewText;var eRequestArgs = myRequestArgs;alert(eHidFieldId);(function(divObj,hidFieldId,newValue,newText,requestArgs){return ' + $tempOnclick +'})(eDivObj,eHidFieldId,eNewValue,eNewText,eRequestArgs);');
							try {
								eval('NimbusModel.divObj = myDivObj;NimbusModel.hidFieldId = myHidFieldId;NimbusModel.newValue = myNewValue;NimbusModel.newText = myNewText;NimbusModel.requestArgs = myRequestArgs;' + $tempOnclick);
							} catch(e) {}
						}
					})($tempDiv, $hiddenFieldId, $xmlNodeArray[$i].getAttribute('id'), $xmlNodeArray[$i].getAttribute('name'), $requestArguments);
				}
				// Use the default onclick method, which is to set our value to the value for the item we selected
				else {
					$tempDiv.onclick = (function(divObj, hidFieldId, newValue, newText, requestArgs) {
						return function() {
							oldValue = document.getElementById(hidFieldId).value;
							
							document.getElementById(hidFieldId).value = newValue;
							document.getElementById(hidFieldId + '__SearchField').value = newText;
							
							// Detect whether our value changed
							if(newValue != oldValue) {
								// If we defined an onchange on our hidden input field... call that
								if(document.getElementById(hidFieldId).onchange) {
									try {
										document.getElementById(hidFieldId).onchange();
									} catch(e) {}
								}
							}
							
							AjaxSearchField.setText(hidFieldId, newText);
							
							divObj.parentNode.style.display = 'none';
							divObj.parentNode.innerHTML = '';
							
							// If we defined a onclick that is to be applied to all items in the dropdown list... do that now
							if(requestArgs['onclick'] !== undefined) {
								try {
									requestArgs['onclick']();
								} catch(e) {}
							}
						}
					})($tempDiv, $hiddenFieldId, $xmlNodeArray[$i].getAttribute('id'), $xmlNodeArray[$i].getAttribute('name'), $requestArguments);
				}
				
				$tempDiv.onmouseover = (function(divObj) {
					return function() {
						divObj.className = 'ajaxResultsItemOver';
					}
				})($tempDiv);
				
				$tempDiv.onmouseout = (function(divObj) {
					return function() {
						divObj.className = 'ajaxResultsItem';
					}
				})($tempDiv);
				
				$resultsDiv.appendChild($tempDiv);
			}
		}
		
		if($showDiv) {
			$resultsDiv.style.display = 'block';
			$resultsDiv.style.border = '1px solid black';
		}
	}
}


function populateCustomerAddressFields($xmlResponse, $requestArguments) {
	//alert('test');
	var $billingPrefix = $requestArguments['billingAddressFieldPrefix'];
	var $shippingPrefix = $requestArguments['shippingAddressFieldPrefix'];
	
	var $billingAddressNode = $xmlResponse.getElementsByTagName('BillingAddress')[0];
	//alert($billingAddressNode);
	if($billingAddressNode) {
		var $addressNode = $billingAddressNode.getElementsByTagName('Address')[0];
		
		if(typeof($addressNode) == 'undefined' || $addressNode == null) {
			$addressNode = $billingAddressNode.getElementsByTagName('UserAddress')[0];
		}
		
		//alert($addressNode);
		var $addresseeField = document.getElementById($billingPrefix + '__addressee');
		//alert($billingPrefix + '__addressee');
		if($addresseeField) {
			try {
				$addresseeField.value = $addressNode.getElementsByTagName('addressee')[0].childNodes[0].nodeValue;
			} catch(e) {
				try {
					$addresseeField.value = $addressNode.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				} catch(e) {}
			}
		}
		
		var $addressField = document.getElementById($billingPrefix + '__address');
		if($addressField) {
			try {
				var $tempAddress = $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue;
				
				var $tempAddress2 = $addressNode.getElementsByTagName('address2');
				if($tempAddress2 && $tempAddress2[0].childNodes[0].nodeValue != null) {
					$tempAddress += "\n" + $tempAddress2[0].childNodes[0].nodeValue;
				}
				
				$addressField.value = $tempAddress;
			} catch(e) {
				try {
					var $tempAddress = $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue;
					$addressField.value = $tempAddress;
				} catch(e) {}
			}
		}
		
		var $cityField = document.getElementById($billingPrefix + '__city');
		if($cityField) {
			try {
				$cityField.value = $addressNode.getElementsByTagName('city')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $stateField = document.getElementById($billingPrefix + '__state');
		if($stateField) {
			try {
				$stateField.value = $addressNode.getElementsByTagName('state')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $zipField = document.getElementById($billingPrefix + '__zip');
		if($zipField) {
			try {
				$zipField.value = $addressNode.getElementsByTagName('zip')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $countryField = document.getElementById($billingPrefix + '__country');
		if($countryField) {
			try {
				$countryField.value = $addressNode.getElementsByTagName('country')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $fullField = document.getElementById($billingPrefix + '__full');
		if($fullField) {
			try {
				var $tempAddress = $addressNode.getElementsByTagName('addressee')[0].childNodes[0].nodeValue + "\n";
				$tempAddress += $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue + "\n";
				
				try {
					var $tempAddress2 = $addressNode.getElementsByTagName('address2');
					if($tempAddress2 && $tempAddress2[0].childNodes[0].nodeValue != null) {
						$tempAddress += $tempAddress2[0].childNodes[0].nodeValue + "\n";
					}
				} catch(e) {}
				
				try {
					$tempCity = $addressNode.getElementsByTagName('city')[0].childNodes[0].nodeValue;
					$tempAddress += $tempCity;
				} catch(e) {
					$tempCity = false;
				}
					
				try {
					$tempState = $addressNode.getElementsByTagName('state')[0].childNodes[0].nodeValue;
					if($tempCity && $tempState) {
						$tempAddress += ", ";
					}
					
					$tempAddress += $tempState;
				} catch(e) {
					$tempState = false;
				}
				
				try {
					$tempZip = $addressNode.getElementsByTagName('zip')[0].childNodes[0].nodeValue;
					if(($tempState || $tempCity) && $tempZip) {
						$tempAddress += " ";
					}
					
					$tempAddress += $tempZip;
				} catch(e) {
					$tempZip = false;
				}
				
				$fullField.value = $tempAddress;
			} catch(e) {
				$fullField.value = $tempAddress;
			}
		}
	}
	
	var $shipingAddressNode = $xmlResponse.getElementsByTagName('ShippingAddress')[0];
	//alert($shipingAddressNode);
	if($shipingAddressNode) {
		var $addressNode = $shipingAddressNode.getElementsByTagName('Address')[0];
		
		if(typeof($addressNode) == 'undefined' || $addressNode == null) {
			$addressNode = $shipingAddressNode.getElementsByTagName('UserAddress')[0];
		}
		
		var $addresseeField = document.getElementById($shippingPrefix + '__addressee');
		if($addresseeField) {
			try {
				$addresseeField.value = $addressNode.getElementsByTagName('addressee')[0].childNodes[0].nodeValue;
			} catch(e) {
				try {
					$addresseeField.value = $addressNode.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				} catch(e) {}
			}
		}
		
		var $addressField = document.getElementById($shippingPrefix + '__address');
		if($addressField) {
			try {
				var $tempAddress = $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue;
				
				var $tempAddress2 = $addressNode.getElementsByTagName('address2');
				if($tempAddress2 && $tempAddress2[0].childNodes[0].nodeValue != null) {
					$tempAddress += "\n" + $tempAddress2[0].childNodes[0].nodeValue;
				}
				
				$addressField.value = $tempAddress;
			} catch(e) {
				try {
					var $tempAddress = $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue;
					$addressField.value = $tempAddress;
				} catch(e) {}
			}
		}
		
		var $cityField = document.getElementById($shippingPrefix + '__city');
		if($cityField) {
			try {
				$cityField.value = $addressNode.getElementsByTagName('city')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $stateField = document.getElementById($shippingPrefix + '__state');
		if($stateField) {
			try {
				$stateField.value = $addressNode.getElementsByTagName('state')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $zipField = document.getElementById($shippingPrefix + '__zip');
		if($zipField) {
			try {
				$zipField.value = $addressNode.getElementsByTagName('zip')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $countryField = document.getElementById($shippingPrefix + '__country');
		if($countryField) {
			try {
				$countryField.value = $addressNode.getElementsByTagName('country')[0].childNodes[0].nodeValue;
			} catch(e) {}
		}
		
		var $fullField = document.getElementById($shippingPrefix + '__full');
		if($fullField) {
			//alert($fullField);
			try {
				var $tempAddress = $addressNode.getElementsByTagName('addressee')[0].childNodes[0].nodeValue + "\n";
				$tempAddress += $addressNode.getElementsByTagName('address')[0].childNodes[0].nodeValue + "\n";
				
				try {
					var $tempAddress2 = $addressNode.getElementsByTagName('address2');
					if($tempAddress2 && $tempAddress2[0].childNodes[0].nodeValue != null) {
						$tempAddress += $tempAddress2[0].childNodes[0].nodeValue + "\n";
					}
				} catch(e) {}
				
				try {
					$tempCity = $addressNode.getElementsByTagName('city')[0].childNodes[0].nodeValue;
					$tempAddress += $tempCity;
				} catch(e) {
					$tempCity = false;
				}
					
				try {
					$tempState = $addressNode.getElementsByTagName('state')[0].childNodes[0].nodeValue;
					if($tempCity && $tempState) {
						$tempAddress += ", ";
					}
					
					$tempAddress += $tempState;
				} catch(e) {
					$tempState = false;
				}
				
				try {
					$tempZip = $addressNode.getElementsByTagName('zip')[0].childNodes[0].nodeValue;
					if(($tempState || $tempCity) && $tempZip) {
						$tempAddress += " ";
					}
					
					$tempAddress += $tempZip;
				} catch(e) {
					$tempZip = false;
				}
				
				$fullField.value = $tempAddress;
			} catch(e) {
				$fullField.value = $tempAddress;
			}
		}
	}
}


function populateProductFields($xmlResponse, $requestArguments) {
	var $fieldPrefix = $requestArguments['fieldPrefix'];
	var $callbackFunc = $requestArguments['callbackFunction'];
	
	var $productNode = $xmlResponse.getElementsByTagName('Product')[0];
	//alert($billingAddressNode);
	if($productNode) {
		var $descriptionField = document.getElementById($fieldPrefix + '__description');
		if($descriptionField) {
			try {
				$descriptionField.value = strip_tags($productNode.getElementsByTagName('short_description')[0].childNodes[0].nodeValue);
			} catch(e) {}
		}
		
		var $priceField = document.getElementById($fieldPrefix + '__price');
		if($priceField) {
			try {
				$priceField.value = parseFloat($productNode.getElementsByTagName('price')[0].childNodes[0].nodeValue).toFixed(2);
			} catch(e) {}
		}
	}
	
	if($callbackFunc !== undefined && $callbackFunc != null) {
		$callbackFunc();
	}
}



function changeAjaxSearchClass($ajaxFieldPrefix, $className) {
	var $searchFieldId = $ajaxFieldPrefix + '__SearchField';
	var $searchFieldObj = document.getElementById($searchFieldId);
	
	if($searchFieldObj) {
		eval('$requestObj = ' + $ajaxFieldPrefix + '__AjaxRequestObj');
		
		myAttachEvent($searchFieldObj, 'keyup', (function($myRequestObj, $myClass) {
			return function() {
				$myRequestObj.cancel();
				$myRequestObj.requestURL='ajax_search.php?class=' + $myClass + '&text='+this.value;
				$myRequestObj.start();
			}
		})($requestObj, $className));
	}
}

