<!--

	var _uname_;
	var xfer_user;

	var last;
	function set_last(id, my_type, type){
		last = document.getElementById(id);
		last.className = 'select';
		
		if(type != undefined){
			button_disable(my_type, type);
		}
	}
	
	function o2v_select(item, id, name, callback) {                                                                                                                                                                        
		if(last == item) return;

		item.className = 'select';

		if(last) {
			last.className = 'no_highlight';
		}
			
		document.getElementById(name + '_selected_id').value = id;
		_uname_ = id;

		last = item;
		
		if(callback) {
			callback(item, id, name);
		}
	}

	function tree_select(item, id, name) {                                                                                                                                                                        
		//if(last == item) return;

		//item.Style.BackgroundColor = '#cccccc';
		//alert(item.style.backgroundColor);
		//if(last) {
		//	last.style.backgroundColor = '#ffffff';
		//}
		
	    //alert("clicked on " + itemIid);
		item.activateItem(id);
        	
		document.getElementById(name + '_selected_id').value = id;
		_uname_ = id;
		
		last = item;
	}

	function unselect() {
		if(last) {
			last.className = 'no_highlight';
		}

		last = 0;
	}

	function o2v_highlight(item, id) {
		if(last != item) {
			item.className = 'highlight';
		}
	}

	function o2v_no_highlight(item) {
		if(last != item) {
			item.className = 'no_highlight';
		}
	}

	// This function sets a hidden form field
	// The sorting is actually implemented by an AJAX observer watching the field
	function sortlist(field, name) {
		if($(name + '_sort').value == field ) {
			$(name + '_sort').value = field + "_reverse";
		} else {
			$(name + '_sort').value = field;
		}
	}

	function button_disable(my_type, location_type) {      
		if((my_type == 'AREA' && location_type == 'SUBURB') || (my_type == 'REGION' && location_type == 'AREA')){
			if($('delete_location')) {
				$('delete_location').disabled = true;
				$('move_location').disabled = false;
			}
		}else if(my_type == location_type) {
			if($('delete_location')) {
				$('delete_location').disabled = false;
				$('move_location').disabled = true;
			}
		}else{
			if($('delete_location')) {
				$('delete_location').disabled = true;
				$('move_location').disabled = true;
			}
		}

	}
	
	function open_close(item, id, name){
		kids = document.getElementById(id + '_kids');
			
		if(item == last){
			item.className = 'no_highlight';
			document.getElementById(name + '_selected_id').value = '0';
			last = false;
			if(kids.className == 'unhidden'){
				kids.className = 'hidden';
			}else{
				kids.className = 'unhidden';
			}
		}else{
			kids.className = 'unhidden';
			item.className = 'select';
			document.getElementById(name + '_selected_id').value = id;
			if(last){
				last.className = 'no_highlight';
			}
			last = item;
		}
		_uname_ = id;
	}
	
	function my_replace(str, find, rep){
	    var res = str;
	    var i = 0;
	    i = res.indexOf(find, i)
	    while(i !== -1){
	        res = res.substr(0, i) + rep + res.substr(i + find.length);
	        i += rep.length;
	        i = res.indexOf(find, i);
	    }
	    return res;
	}
	
//-->