function DelCheck(form, text) {
	check = confirm(text);
	if (check == false) return false;
}

function ButtonDisable(form) {
	if (document.all || document.getElementById) {
		for (i = 0; i < form.length; i++) {
			var tempobj = form.elements[i]
			if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset") {
				tempobj.disabled = true
			}
		}
	}
}

function OpenWindow(url, title, x, y) {
	window.open (url, title, "toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=1, copyhistory=0, width="+x+", height="+y+"");
}

AJAX = new Object;

AJAX.READY_STATE_UNINITIALIZED=0;
AJAX.READY_STATE_LOADING=1;
AJAX.READY_STATE_LOADED=2;
AJAX.READY_STATE_INTERACTIVE=3;
AJAX.READY_STATE_COMPLETE=4;

AJAX = function () {
	//this.error = null;
}

AJAX.prototype.init = function () {
	try
	{
		this.req = new XMLHttpRequest();
		return (this.req.setRequestHeader ? true : false);
	}
	catch(e)
	{
		try
		{
			this.req = new ActiveXObject("Msxml2.XMLHTTP");
			return true;
		}
		catch(e)
		{
			try
			{
				this.req = new ActiveXObject("Microsoft.XMLHTTP");
				return true;
			}
			catch(e)
			{
				return false;
			}
		}
	}
}

AJAX.prototype.send = function (url, method, params, content) {
	if (!this.req)
	{
		if (!this.init())
		{
			return false;
		}
	}
	if (url) {
		this.url = url;
		this.params = (params) ? params : '';
			
		this.method = (method) ? method : '';
		if (!method) this.method = "GET";
		
		this.content = content;
		
		if (!this.content && this.method == "POST")
		{
			this.content = "application/x-www-form-urlencoded";
		}
	
		//if (execute_now) return (this.exec());
	} else {
		return false;
	}
}

AJAX.prototype.exec = function () {
	if (!this.req)
	{
		if (!this.init())
		{
			return false;
		}
	}
	if (!this.not_ready())
	{
		this.req.open (this.method, this.url, true);
		
		if (this.content) this.req.setRequestHeader('Content-Type', this.content);
		
		this.req.send(this.params);
	
		if (this.req.readyState == AJAX.READY_STATE_COMPLETE && this.req.status == 200) {
			return true;
		}
	}
	return false;
}

AJAX.prototype.not_ready = function()
{
	return (this.req.readyState && (this.req.readyState < 4));
}

AJAX.prototype.onReadyStateChange = function (func) {
	if (!this.req)
	{
		if (!this.init())
		{
			return false;
		}
	}
	if (typeof func ==  'function')
	{
		this.req.onreadystatechange = func;
		return true;
	}
	return false;
	
}


	function fetch_tags(parentobj, tag)
	{
		if (parentobj == null)
		{
			return new Array();
		}
		else if (typeof parentobj.getElementsByTagName != 'undefined')
		{
			return parentobj.getElementsByTagName(tag);
		}
		else if (parentobj.all && parentobj.all.tags)
		{
			return parentobj.all.tags(tag);
		}
		else
		{
			return new Array();
		}
	}
	
	function fetch_tag_count (parentobj, tag)
	{
		return fetch_tags(parentobj, tag).length;
	}
	
	function fetch_data (xml_node)
	{
		if (xml_node && xml_node.firstChild && xml_node.firstChild.nodeValue)
		{
			return xml_node.firstChild.nodeValue;
		}
		else
		{
			return '';
		}
	}
	
function unescape_cdata (str)
{
	var r1 = /<\=\!\=\[\=C\=D\=A\=T\=A\=\[/g;
	var r2 = /\]\=\]\=>/g;

	return str.replace(r1, '<![CDATA[').replace(r2, ']]>');
}

function urlencode (text) {

	text = escape(text.toString()).replace(/\+/g, "%2B");

	var matches = text.match(/(%([0-9A-F]{2}))/gi);
	if (matches)
	{
		for (var matchid = 0; matchid < matches.length; matchid++)
		{
			var code = matches[matchid].substring(1,3);
			if (parseInt(code, 16) >= 128)
			{
				text = text.replace(matches[matchid], '%u00' + code);
			}
		}
	}
	
	text = text.replace('%25', '%u0025');

	return text;
}

function eHandle (obj, event)
{
	var ch = (event.charCode) ? event.charCode : ((event.keyCode) ? event.keyCode : false) ;
	if (ch)
	{
		if (ch == 13) return false;
	}
}