function randomString() {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 10;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	document.randform.randomfield.value = randomstring;
}

function AJAX() {
	var Obj = new Object();
	Obj.load = AJAX_load;
	Obj.onload = function() { };
	try { Obj.request=new XMLHttpRequest(); }
	catch (e) {	try { Obj.request=new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) {	try { Obj.request=new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (e) {	alert("Your browser does not support AJAX!"); }
		}
	}
	
	Obj.request.onreadystatechange = function() {
		if (Obj.request.readyState == 4) {
			if (Obj.request.status == 200) {
				Obj.responseText = Obj.request.responseText;
				Obj.responseXML = Obj.request.responseXML;
				Obj.onload();
			}
		}
	}
	
	return Obj;
}

function AJAX_load(url,parameters) {
	if (parameters == null) {
		this.request.open('GET',url,true);
		this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		this.request.setRequestHeader("Pragma", "no-cache");
		this.request.setRequestHeader("If-Modified-Since", "1");
		this.request.setRequestHeader("Cache-Control", "no-cache");
		this.request.setRequestHeader("Connection", "close");
		this.request.send(null);
	} else {
		this.request.open('POST',url,true);
		this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		this.request.setRequestHeader("Pragma", "no-cache");
		this.request.setRequestHeader("Cache-Control", "no-cache");
		this.request.setRequestHeader("If-Modified-Since", "1");
		this.request.setRequestHeader("Content-length", parameters.length);
		this.request.setRequestHeader("Connection", "close");
		this.request.send(parameters);
	}
}

function loadCombo(combos,url) {
	var XML = new AJAX();
	XML.onload = function() {
		for (var i=0;i<combos.length;i++) {
			
			var combo_tag = this.responseXML.getElementsByTagName(combos[i].attributes['combo'].value);
			combos[i].length = 0;
			for (var n=0;n<combo_tag.length;n++) {
				var item = combo_tag[n].attributes;
				combos[i].options[combos[i].options.length] = new Option(item.getNamedItem('string').value,item.getNamedItem('value').value);
			}
			combos[i].disabled = false;
			//Selecting default
			if (typeof combos[i].attributes['default'] != 'undefined') {
				combos[i].value = combos[i].attributes['default'].value;
				if (combos[i].value == '') combos[i].selectedIndex = 0;
			}
		}
	}
	XML.load(url);
}