/**
	Update the specified 'div' with the content from 'uri', and optionally pass 'params' as querystring parameters to uri.

	div can be an id or the actual div element.
	params should be an associative array, i.e. [param1=value1, param2=value2]
*/
function include(uri, div, params) {
	if (div == null) {
		alert("div to update cannot be null (ssi.js :: include)");
		return;
	}

	if (_isString(div))
		var divElement = document.getElementById(div);
	else
		var divElement = div;

	if (divElement == null) {
		alert("div (id of " + div + ") was null (ssi.js :: include)");
		return;
	}

	var _ajaxResponse = function (response) {
		divElement.innerHTML = response.responseText;
	}

	var ajaxRequest = MochiKit.Async.doXHR(uri, {"queryString":params});
	ajaxRequest.addCallbacks(_ajaxResponse, _ajaxError);
}

function _ajaxError(response) {

}

/**
	Taken From: Kas Thomas
				http://www.planetpdf.com/developer/article.asp?ContentID=testing_for_object_types_in_ja
*/
function _isString(obj) {
	if (typeof obj == 'string') return true;
	
	if (typeof obj == 'object') {
		var criterion = obj.constructor.toString().match(/string/i); 
		return (criterion != null);
	}
	
	return false;
}