<!--
var Timeout = 1000;
var ServerDocument;
var rootpath = "";
var timerID = 0;

function ShowText(txt)
{
	var msg = document.getElementById("ajax_output");
	if(msg == null) return;
	msg.innerHTML = msg.innerHTML + txt + "<BR>";
}

function FeedDocument(xmlHttp)
{
	var Tag;
	var Id;
	var xmlResponse;
	var Response;
	var EList;
	var Element;
	var EChild;
	var Value;
	
	xmlResponse = xmlHttp.responseXML;	
	if(xmlResponse == null) {
		ShowText("XML Response not defined.");
		return 0;
	} 
	Response = xmlResponse.documentElement;
	if(Response == null) {
		ShowText("XML Response documentElement not defined.");
		return 0;
	}

	Tag = document.getElementsByTagName("div");
	for(e = 0; Tag && e < Tag.length; e++) {
		Id = Tag[e].id;
		if(Id != 0) {
			EList = Response.getElementsByTagName(Id);
			if(EList != null) {
				Element = EList[0];
				if(Element != null) {
					EChild = Element.firstChild;
					if(EChild != null) {
						Tag[e].innerHTML = EChild.data;
					} else {
						Tag[e].innerHTML = "&nbsp;";
					}
				}
			}
		}
	}

	Tag = document.getElementsByTagName("img");
	if(Tag == null) return;
	for(e = 0; Tag && e < Tag.length; e++) {
		Id = Tag[e].id;
		if(Id != 0) {
			EList = Response.getElementsByTagName(Id);
			if(EList != null) {
				Element = EList[0];
				if(Element != null) {
					EChild = Element.firstChild;
					if(EChild != null) {
						Tag[e].src = rootpath + "images/" + EChild.data + ".png";
						Tag[e].alt = EChild.data;
					}
				}
			}
		}
	}

	Tag = document.getElementsByTagName("td");
	if(Tag == null) return;
	for(e = 0; Tag && e < Tag.length; e++) {
		Id = Tag[e].id;
		if(Id != 0) {
			EList = Response.getElementsByTagName(Id);
			if(EList != null) {
				Element = EList[0];
				if(Element != null) {
					EChild = Element.firstChild;
					if(EChild != null && EChild.data == "1") {
						Tag[e].style.backgroundColor = "#FECDCD";
					} else {
						Tag[e].style.backgroundColor = "";
					} 
				}
			}
		}
	}

	return 1;
}

function DataLoaded(xmlHttp)
{
	if (xmlHttp.readyState == 4) {
		try {
			if (xmlHttp.status == 200) {
				if(!FeedDocument(xmlHttp)) ShowText(xmlHttp.responseText);
			} else {
				ShowText("No Info available");
			}
		} catch (e) {
			ShowText("Problem on Ajax return call: " + e.description);
		}
	}
}

function EmitRequest()
{
	var xmlHttp = null;
	try {
		xmlHttp = new XMLHttpRequest();
	} catch (e) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	if(xmlHttp == null) {
		ShowText("Can not create Request");
	} else {
		xmlHttp.onreadystatechange = function() { DataLoaded(xmlHttp); };
		xmlHttp.open("get", ServerDocument, true);
		xmlHttp.send(null);

		var requestTimer = setTimeout(function() {
       		xmlHttp.abort();
	     }, 2000);
	}
}




function UpdateTimer() 
{
	if(timerID) clearTimeout(timerID);
	EmitRequest();
	timerID = setTimeout("UpdateTimer()", Timeout);
}

function Start(doc, path, time) 
{
	if(doc != null) {
		ServerDocument = doc;
	}

	if(path != null) {
		rootpath = path;
	}

	if(time != null) {
		Timeout = time * 1000;
	}

	timerID = setTimeout("UpdateTimer()", 500);
	ShowText("Ajax");
}

function Stop() {

	if(timerID) {
		clearTimeout(timerID);
		timerID = 0;
	}
}

function confirmLink(theLink, message)
{
    var is_confirmed = confirm( message );
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
}

//-->

