/*******************************************************************************************
START: EXPLORERSET-UP.JS
********************************************************************************************/
Explorer.setup = function (params) {
	param_default = function (pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };		
	param_default("useCookie"		, false); /*Should the cookie use a cookie to store the explorer state for a user.*/
	param_default("xmlPath"			, null); /*The path to the XML file to use as the source for the root node’s children.*/
	param_default("persistencePath"	, null); /* what is the path to the CF file that persists nodes (adds/removes) in the CF application. Use this only when useCookie is false */
	param_default("displayArea"		, null); /*The page element to add the explorer to.*/
	param_default("lBreadCrumb"		, new String()); /*A breadcrumb list of uuid’s to initialise the explorer to. This will only take effect if UseCookie is set to false. */
	param_default("canExpandAll"	, false); /*NOT IMPLEMENTED*/
	param_default("dragging"		, false); /*NOT IMPLEMENTED*/
	param_default("uuid"			, '00000000-0000-0000-0000-000000000000'); /*the root uuid*/
	param_default("type"			, null); /*The type of the root node.*/
	param_default("timeout"			, null); /*The timeout on freshness the childnodes. After the number of  milliseconds specified have passed, the childnode will be reloaded. If set to null, the childnodes will never expire.*/
	param_default("blankImage"		, null); /*The path the blank image to use, should be 1px by 1px and transparent.*/

	param_default("expandEvent" 	, 'click'); /*The event on the root node that triggers it to expand. This is inherited by all child nodes, but can be overridden in the XML for individual nodes.*/
	param_default("collapseEvent" 	, 'click'); /*The event on the root node that triggers it to collapse. This is inherited by all child nodes, but can be overridden in the XML for individual nodes.*/

	/*
	EVENT HANDLERS
	--------------
	The event handler to call when the ‘XXXX’ event happens on the root node. This is inherited by all child nodes, but can be overridden in the XML for individual nodes.*/
	
	param_default("blur" 			, null);
	param_default("focus" 			, null);

	param_default("click" 			, null);
	param_default("dblclick" 		, null);
	
	param_default("mousedown" 		, null);
	param_default("mouseup" 		, null);
	param_default("mouseover" 		, null);
	param_default("mousemove" 		, null);
	param_default("mouseout" 		, null);
	
	param_default("keypress" 		, null);
	param_default("keydown" 		, null);
	param_default("keyup" 			, null);

	param_default("expand" 			, null);
	param_default("collapse" 		, null);
	/*
	END EVENT HANDLERS
	--------------
	*/
	var tmp = ["displayArea"];
	for (var i in tmp) {
		if (typeof params[tmp[i]] == "string") {
			params[tmp[i]] = document.getElementById(params[tmp[i]]);
		}
	}
	
	if (!(params.displayArea)) {
		params.displayArea 		= document.body;
	}
	window.explorer = new Explorer(params);
	window.explorer.create(params);
};

function refresh() {
	window.explorer.sync({
							breadcrumb:null,
							collapseFirst:false});
}
/*******************************************************************************************
END: EXPLORERSET-UP.JS
********************************************************************************************/

