// EXPERIMENTAL - we need this for xajax to work
var a = this.location;
//var xajaxRequestUri=a.protocol + '//' + a.host + a.pathname + '?id=doc_cats';//"http://localhost/sams/admin.php?id=doc_cats";
var xajaxRequestUri = this.location.href;
// gives data to the xajax object for ajax stuff
function process_xajax_functions(id) {
	// if there is such element
	if (th = document.getElementById(id)) {
		// if we can find according form
		var formid = get_form(th.id);
		if (formid != '') {
			ajax_get_selectbox(xajax.getFormValues(formid), th.id);
		}
	}
}
//finds form, which is parent for the given element
function get_form(id) {
	var exit = false;
	var counter = 0;
	var formid = "";
	// if there is such element
	if (elem = document.getElementById(id)) {
		while (exit == false) {
			// going up in tree parent by parent
			var elem = elem.parentNode;
			counter++;
			// until we find form element
			if (elem.tagName == "FORM" || elem.tagName == "form") {
				formid = elem.getAttribute('id');
				exit = true;
			}
			if (counter > 100) {
				exit = true;
			}
		}
	}
	return formid;
}

