function hdl_class()
	{
	switch (navigator.platform)
		{
		case "Win32":
			this.platform = "win";
			this.mask = "win_";
			break;
		case "MacPPC":
			this.platform = "mac";
			this.mask = "mac_";
			break;
		default:
			this.platform = "xxx";
			this.mask = "xxx_";
			break;
		}
	
	switch (navigator.appName)
		{
		case "Microsoft Internet Explorer":
			this.browser = "ie";
			this.mask += "ie";
			this.version = parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE") + 5));
			if (isNaN(this.version))
				this.version = parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf("Internet Explorer") + 18));
			this.mask += this.version;
			break;
		case "Netscape":
			this.browser = "ns";
			this.mask += "ns";
			this.version = parseInt(navigator.appVersion);
			this.mask += this.version;
			break;
		default:
			this.browser = "xx";
			this.version = 0;
			this.mask += "xx0";
			break;
		}

	this.css_load = hdl_css_load;		
	this.lib_load = hdl_lib_load;
	this.method = hdl_obj_method;
	this.obj = hdl_obj_find;
	this.obj_init = hdl_obj_init;
	this.property = hdl_obj_property;
	}

function hdl_css_load(csss, mask, path)
	{
	if (path == null)
		path = "../_dhtml";
	
	if (mask != this.mask && mask != this.platform + "_" + this.browser && mask != this.platform && mask != this.browser + this.version && mask != this.browser)
		return;
	
	if (path.substr(path.length - 1) != "/")
		path += "/";
	csss = csss.split(",");
	for(var cnt = 0; cnt < csss.length; cnt++)
		document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + path + mask + "_" + csss[0] + ".css\">");
	}

function hdl_lib_load(libs, path)
	{
	var lib_sel;
	
	if (path == null)
		path = "../_hdl";
		
	if (path.substr(path.length - 1) != "/")
		path += "/";
	libs = libs.split(",");
	for(var cnt = 0; cnt < libs.length; cnt++)
		{
		lib_sel = lib[libs[cnt]][this.mask];
		if (!lib_sel)
			lib_sel = lib[libs[cnt]]["all"];
		document.write("<script language=\"javascript\" src=\"" + path + libs[cnt] + "/" + lib_sel + "_" + libs[cnt] + ".js\"></script>");
		}
	}

function hdl_obj_find(obj_name)
	{
	var cnt;
	var obj;

	if (obj_name == "window" || obj_name == "document")
		{
		obj = eval(obj_name);
		if (typeof(obj) != "undefined")
			return(obj);
		}
	obj = document[obj_name];
	if (typeof(obj) != "undefined")
		return(obj);

	obj = window[obj_name];
	if (typeof(obj) != "undefined")
		return(obj);

	for(cnt = 0; cnt < document.forms.length; cnt++)
		{
		obj = document.forms[cnt][obj_name];
		if (typeof(obj) != "undefined")
			return(obj);
		}

	if (hdl.browser == "ns")
		{
		if (hdl.version < 5)
			obj = hdl_obj_find_ns4("document", obj_name);
		else
			obj = document.getElementById(obj_name);
		if (typeof(obj) != "undefined")
			return(obj);
		}

	return(null);		
	}

function hdl_obj_find_ns4(parent, obj_name)
	{
	var cnt;
	var array;
	var obj;
	var parent_new;

	obj = eval(parent + "." + obj_name);
	if (typeof(obj) != "undefined")
		return(obj);

	array = eval(parent + ".forms");
	for(cnt = 0; cnt < array.length; cnt++)
		{
		obj = array[cnt][obj_name];
		if (typeof(obj) != "undefined")
			return(obj);
		}

	array = eval(parent + ".layers");
	for(cnt = 0; cnt < array.length; cnt++)
		{
		obj = array[cnt][obj_name];
		if (typeof(obj) != "undefined")
			return(obj);
		parent_new = array[cnt].document;
		if (typeof(parent_new) != "undefined")
			{
			obj = hdl_obj_find_ns4(parent + ".layers[" + cnt + "].document", obj_name);
			if (obj)
				return(obj);
			}
		}

	return(null);		
	}

function hdl_obj_init(objs, types)
	{
	var cnt_o;
	var cnt_t;
	var obj;
	var objs_array;
	var types_array;

	if (!objs)
		return;

	objs_array = objs.split(",");
	types_array = types.split(",");

	for(cnt_o = 0; cnt_o < objs_array.length; cnt_o++)
		{
		obj = hdl_obj_find(objs_array[cnt_o]);
		if (!obj)
			continue;

		obj.hdl = new Object();
		obj.hdl.id = objs_array[cnt_o];

		for(cnt_t = 0; cnt_t < types_array.length; cnt_t++)
			eval(types_array[cnt_t] + "_init(obj)");
		}
	}

function hdl_obj_method(obj_name, method, params)
	{
	var obj;
	var type;

	obj = hdl_obj_find(obj_name);
	if (!obj)
		return(null);

	type = obj.hdl[method];
	value = eval(type + "_method(obj, method, params)");
	return(value);
	}

function hdl_obj_property(obj_name, property, value)
	{
	var obj;
	var type;
	try{
	obj = hdl_obj_find(obj_name);

	if (typeof(obj) == "undefined")
		return(obj);
	
	type = obj.hdl[property];
	value = eval(type + "_property(obj, property, value)");
	}catch(e){
		return(value);
	}
	return(value);
	}

function hdl_property_map_default(obj, element, value)
	{
	if (value != null)
		obj[element] = value;

	value = obj[element];
	
	return(value);
	}

var lib = new Object();

lib.content = new Object();
lib.content.all = "win_ie6";
lib.content.mac_ns4 = "win_ns4";
lib.content.win_ns4 = "win_ns4";

lib.cookie = new Object();
lib.cookie.all = "win_ie6";

lib.flash = new Object();
lib.flash.all = "win_ns4";
lib.flash.win_ie4 = "win_ie4";
lib.flash.win_ie5 = "win_ie5";
lib.flash.win_ie6 = "win_ie5";

lib.image = new Object();
lib.image.all = "win_ie6";
lib.image.win_ns4 = "win_ns4";
lib.image.win_ns5 = "win_ns5";

lib.position = new Object();
lib.position.all = "win_ie6";
lib.position.mac_ie5 = "win_ie5";
lib.position.mac_ns4 = "win_ns4";
lib.position.win_ie4 = "win_ie4";
lib.position.win_ie5 = "win_ie5";
lib.position.win_ns4 = "win_ns4";
lib.position.win_ns5 = "win_ns5";

lib.style = new Object();
lib.style.all = "win_ie6";
lib.style.mac_ns4 = "win_ns4";
lib.style.win_ns4 = "win_ns4";

lib.validate = new Object();
lib.validate.all = "win_ie6";

var hdl = new hdl_class();

