var QueryString = new Array();
QueryString_Parse();
//*********************************************************************************************
//***                                      Stylesheet                                       ***
//*********************************************************************************************
function changeStyle(node,value) {
	if(node.style.cssText != null && navigator.userAgent.indexOf("MSIE") != -1 && (navigator.userAgent.indexOf("6.") != -1 || navigator.userAgent.indexOf("7.") != -1)) {
	node.style.cssText = value;
	}
	else {
	node.setAttribute("style", value);
	}
}
//*********************************************************************************************
//***                                     Runde auf 2 Stellen                               ***
//*********************************************************************************************
function runde_2stellen(zahl) {
	return Math.round(parseFloat(zahl)/0.01)*0.01;
}
//*********************************************************************************************
//***                                     Runde auf 3 Stellen                               ***
//*********************************************************************************************
function runde_3stellen(zahl) {
	return Math.round(parseFloat(zahl)/0.001)*0.001;
}
//*********************************************************************************************
//***                                     Runde auf 4 Stellen                               ***
//*********************************************************************************************
function runde_4stellen(zahl) {
	return Math.round(parseFloat(zahl)/0.0001)*0.0001;
}
//*********************************************************************************************
//***                              Ausgabe 2 Stellen gerundet                               ***
//*********************************************************************************************
function create_de_output(output) {
	if(!output || output == 'undefined') {
	output = 0;
	}
	output = runde_2stellen(output);
	var full_dm = 0;
	var varteil_dm = '';
	var RegField = '';
	var vorzeichen = '';
	if(output < 0) {
	vorzeichen = "-";
	}
	else {
	vorzeichen = "";
	}
	output = runde_2stellen(output) + "";
	if(output.match(/\d.*\.\d.*/)) {
	RegField = /(\d.*)\.(\d.*)/;
	RegField.exec(output);
	full_dm = RegExp.$1;
	teil_dm = RegExp.$2;
	if(teil_dm.length < 2) {
		teil_dm = "," + teil_dm + "" + "0";
	}
	else {
		teil_dm = "," + teil_dm.substring(0,2);
	}
	}
	else {
	RegField = /(\d.*)/;
	RegField.exec(output);
	if(RegExp.$1) {
		full_dm = RegExp.$1;
	}
	teil_dm = ",00";
	}
	var i,offset,string;
	output = "";
	for(i = full_dm.length; i > 0; i -= 3) {
	offset = i-3;
	string = full_dm.substring(i,offset);
	output = string + "." + output;
	}

	output = vorzeichen + "" + output.substring(0,output.length-1) + teil_dm;
	return output;
}
//*********************************************************************************************
//***                                Eingabe in Zahl umwandeln                              ***
//*********************************************************************************************
function create_input(input) {
	input = input + "";
	input = input.replace(/\./g,"");
	input = input.replace(/,/g,".");
	input = input.replace(/[^0-9\.]/g,"");
	if(input == "") {
	input = 0;
	}
	input = parseFloat(input);
	return input;
}
//*********************************************************************************************
//***                                        URL Parsen                                     ***
//*********************************************************************************************
function QueryString_Parse() {
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	for (var i=0;i<pairs.length;i++) {
	var pos = pairs[i].indexOf('=');
	if (pos >= 1) {
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		QueryString[argname] = value;
	}
	}
}
//*********************************************************************************************
//***                                        Body Onload                                    ***
//*********************************************************************************************
function _body_onload(parse)  {
	try {
	LoadingOff();
	if(parse) {
		_parse_links();
	}
	}
	catch (e) {
	return false;
	}
}
//*********************************************************************************************
//***                                      Body Onunload                                    ***
//*********************************************************************************************
function _body_onunload()  {
	try {
	LoadingOn();
	}
	catch (e) {
	return false;
	}
}
//*********************************************************************************************
//***                                        Links Parseing                                 ***
//*********************************************************************************************
function _parse_links()  {
	if(document.getElementsByTagName && typeof(LoadingOn)=="function") {
	for(i=0;i<document.getElementsByTagName("a").length;i++) {
		node = document.getElementsByTagName("a")[i];
		link = node.getAttribute('href');
		onclick = node.getAttribute('onclick');
		target = node.getAttribute('target');
		if((onclick == null || onclick == '') && (target == null || target == '') && link.indexOf('#') == -1 && link.indexOf('javascript:') == -1) {
		node.onclick = function() {LoadingOnP();};
		}
	}
	for(i=0;i<document.getElementsByTagName("form").length;i++) {
		node = document.getElementsByTagName("form")[i];
		etarget = node.getAttribute('target');
		eonsubmit = node.getAttribute('onsubmit');
		if((etarget == null || etarget == '') && (eonsubmit == null || eonsubmit == '')) {
		node.onsubmit = function() {LoadingOnP(); node.submit();};
		}
	}
	}
}
//*********************************************************************************************
//***                                     Unloading On                                     ***
//*********************************************************************************************
function LoadingOnP()  {
	window.setTimeout('LoadingOff',9000);
	LoadingOn();
}
//*********************************************************************************************
//***                                     Unloading On                                     ***
//*********************************************************************************************
function LoadingOn(target)  {
	try {
	if(!target) {
		target = this;
	}
	if(target.document.getElementById("loaderDiv")) {
		target.document.getElementById("loaderDiv").style.display = "";
	}
	}
	catch (e) {
	return false;
	}
}
//*********************************************************************************************
//***                                     Unloading Off                                     ***
//*********************************************************************************************
function LoadingOff(target)  {
	try {
	if(!target) {
		target = this;
	}
	if(target.document.getElementById("loaderDiv")) {
		target.document.getElementById("loaderDiv").style.display = "none";
	}
	}
	catch (e) {
	return false;
	}
}
//*********************************************************************************************
//***                                     Popup Window                                      ***
//*********************************************************************************************
function Popup(url,height,width,name,popup,re,noscroll)  {
	Pop = false;
	if(typeof(noscroll) != 'string' && typeof(noscroll) != 'number' || parseInt(noscroll) == 0) {
	noscroll = 'yes';
	}
	else {
	noscroll = 'no';
	}
	if(typeof(url) != 'string') {
	url = "";
	}
	if(typeof(re) != 'string' && typeof(re) != 'number') {
	re = 0;
	}
	else {
	re = parseInt(re);
	}
	if(!popup) {
	popup = null;
	}
	else if(typeof(popup) != 'string' && typeof(popup) != 'number') {
	popup = 0;
	}
	else {
	popup = parseInt(popup);
	}
	if(typeof(name) != 'string') {
	name = "Pop";
	}
	if(typeof(height) != 'string' && typeof(height) != 'number') {
	height = 500;
	}
	else {
	height = parseInt(height);
	if(height < 50) {
		height = 500;
	}
	}
	if(typeof(width) != 'string' && typeof(width) != 'number') {
	width = 550;
	}
	else {
	width = parseInt(width);
	if(width < 200) {
		width = 550;
	}
	}
	try {
	if(popup == 0) {
		location.href = url;
		return;
	}
	else if(popup == 1) {
		if(Pop = window.open(url, name, "height=" + height +",width=" + width + ",location=no,scrollbars=" + noscroll + ",menubars=no,toolbars=no,resizable=" + noscroll )) {
		Pop.resizeTo(width,height);
		var nwl = (screen.width - width) / 2;
		var nwh = (screen.height - height) / 2;
		Pop.moveTo(nwl,nwh);
		Pop.focus();
		}
	}
	else if(Pop = window.open(url, name)) {
		Pop.focus();
	}
	}
	catch (e) {
	}
	if(re == 1) {
	return Pop;
	}
}
//*********************************************************************************************
//***                                      Get_Cookie                                       ***
//*********************************************************************************************
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
//*********************************************************************************************
//***                                       Element move                                       ***
//*********************************************************************************************
function elementmove(el,xPos,yPos) {
	last = 0;
	if(document.getElementById(el)) {
	var x,y;
	if (self.pageYOffset) { // all except Explorer
		x = self.pageXOffset;
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) {// all other Explorers
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	document.getElementById(el).style.position = "absolute";
	if(y > last) {
		for(i=last;last+i<y;i++) {
		i2 = i + last;
		document.getElementById(el).style.top = i2 + 'px';
		}
		last = y;
	}
	else if (last > y) {
		for(i=last;last-i>=y;i--) {
		i2 = last - i;
		document.getElementById(el).style.top = i2 + 'px';
		}
		last = y;
	}
	document.getElementById(el).style.left = x + 'px';
	document.getElementById(el).style.top = y + 'px';
	}
}
//*********************************************************************************************
//***                          Nemint Text-Scroller v1.1                                    ***
//***                 2004 Nemint, New Media Interactiv www.nemint.de                       ***
//***       Für private Nutzung kostenlos einsetzbar, solange dieser Kopfbereich            ***
//***                           unverändert erhalten bleibt                                 ***
//***     Für eine gewerbliche Nutzung setzen Sie sich bitte mit uns in Verbindung          ***
//*********************************************************************************************
var nemintScroller_objects = new Array();
//window.onresize = nemintScrollerGetPosition;
window.onload = nemintScrollerStart;

function nemintScrollerStart() {
for (i=0;i<nemintScroller_objects.length;i++) {
	if(nemintScroller_objects[i]) {
	obj = nemintScroller_objects[i]['name'];
	if(obj) {
		obj.update();
	}
	}
}
}

function nemintScrollerGetPosition() {
for (i=0;i<nemintScroller_objects.length;i++) {
	if(nemintScroller_objects[i]) {
	obj = nemintScroller_objects[i]['name'];
	if(obj) {
		obj.index = 0;
		obj.getPosition();
	}
	}
}
}

function nemintScroller() {
this.scrollLeft	= 1;
this.scrollingText= '';
this.scrollingSpeed= 10;
this.scrollingSpeedUp= 2;
this.scrollerObjName= '';
this.stopScrollingOnMouseover = 1;
this.heightTicker= 20;
this.widthTicker	= 400;
this.marginTop	= 0;
this.marginLeft	= 0;
this.stopScrollingOnMouseover = 1;

this.finetuningLeft= 0;
this.finetuningTop= 0;

this.bgcolor	= '';
this.border	= '';
this.bordercolor	= '';
this.borderstyle	= 'solid';

this.tmp	= '';
this.i	= 0;
this.i2	= 0;
this.i3	= 0;
this.index	= 0;
this.positionTop= 0;
this.positionLeft= 0;
this.positionTopTicker= 0;
this.positionLeftTicker= 0;

this.realTickerText	= '';

this.scrolling	= 1;
this.heightRealTicker= 20;
this.widthRealTicker= 400;
this.endMarkerTop= -50000;
this.endMarkerLeft= -50000;
var zeit = new Date();
var ms = Date.parse(zeit);
this.info	= "infobereich";
this.info2	= "infobereich2";
this.elTicker	= "ticker" + Math.random();
this.elTickerID	= "tickerID" + Math.random();
this.elTickerInnen	= "tickerInnen" + Math.random();
this.elTickerInnenText	= "tickerInnenText" + Math.random();
this.elTickerInnenEnde	= "tickerInnenEnde" + Math.random();
this.elTickerInnenAnfang= "tickerInnenAnfang" + Math.random();
this.elTicker	= this.elTicker.replace(/\W/ig,'');
this.elTickerInnen	= this.elTickerInnen.replace(/\W/ig,'');
this.elTickerInnenText	= this.elTickerInnenText.replace(/\W/ig,'');
this.elTickerInnenEnde	= this.elTickerInnenEnde.replace(/\W/ig,'');
this.elTickerInnenAnfang= this.elTickerInnenAnfang.replace(/\W/ig,'');
return this;
}

nemintScroller.prototype.Start = function(name) {
if(document.getElementById) {
	this.heightRealTicker = parseInt(this.heightTicker - (this.marginTop * 2));
	this.widthRealTicker  = parseInt(this.widthTicker - (this.marginLeft * 2));

	var tickerout = '';
	tickerout = tickerout + '<div id="' + this.elTicker + '" style=\"';
	if(this.border != '' && this.border != '0') {
	tickerout = tickerout + 'border: ' + this.border + 'px ' + this.borderstyle + '; ';
	if(this.bordercolor != '') {
		tickerout = tickerout + 'border-color: ' + this.bordercolor + '; ';
	}
	}
	if(this.bgcolor != '') {
	tickerout = tickerout + 'background-color: ' + this.bgcolor + '; ';
	}
	tickerout = tickerout + 'height:' + this.heightTicker + 'px; width: ' + this.widthTicker + 'px;">\n\n';

	tickerout = tickerout + '\n<div id="' + this.elTickerInnen + '" style="height:' + this.heightRealTicker + 'px; width: ' + this.widthRealTicker + 'px;">\n\n';

	if(this.scrollLeft == 1) {
	tickerout = tickerout + '<span style="white-space: nowrap;"><img src="/gfx/blank.gif" id="' + this.elTickerInnenAnfang + '" style="height: 1px; width: ' + this.widthTicker + 'px;" width="' + this.widthTicker + '" />' + this.scrollingText + '<span id="' + this.elTickerInnenEnde + '">&nbsp;</span></span>';
	}
	else {
	tickerout = tickerout + '<img src="/gfx/blank.gif" id="' + this.elTickerInnenAnfang + '" style="height: ' + this.heightTicker + 'px; width: 1px;" height="' + this.heightTicker + '" /><br />' + this.scrollingText + '<br /><span id="' + this.elTickerInnenEnde + '">&nbsp;</span>';
	}

	tickerout = tickerout + '\n</div>\n</div>';
	document.write(tickerout);
	document.write('<div style=\"height:' + this.heightTicker + 'px; width: ' + this.widthTicker + 'px;">\n\n</div>');

	this.positionTopTicker =  this.absTop(document.getElementById(this.elTicker));
	this.positionLeftTicker = this.absLeft(document.getElementById(this.elTicker));

	document.getElementById(this.elTicker).style.position = "absolute";
	document.getElementById(this.elTicker).style.overflow = "hidden";
	document.getElementById(this.elTickerInnen).style.position = "absolute";
	document.getElementById(this.elTicker).style.overflow = "hidden";
	document.getElementById(this.elTickerInnen).style.top = this.marginTop + "px";
	document.getElementById(this.elTickerInnen).style.left = this.marginLeft + "px";

	var obj = this;
	if(this.stopScrollingOnMouseover == 1) {
	document.getElementById(this.elTickerInnen).onmouseover = function() {
					obj.scrolling = 0;
					return false;
					};
	document.getElementById(this.elTickerInnen).onmouseout = function() {
					obj.scrolling = 1;
					return false;
					};
	}
	this.scrollerObjName= name;
	objCount = nemintScroller_objects.length;
	nemintScroller_objects[objCount] = new Array();
	nemintScroller_objects[objCount]['name'] = this;
	nemintScroller_objects[objCount]['realname'] = name;
	nemintScroller_objects[objCount]['speed'] = this.scrollingSpeed;
	nemintScroller_objects[objCount]['last'] = 0;
}
else {
	//todo for old browsers, perhaps ???
}
}


nemintScroller.prototype.update = function(newticker) {
if(this.scrollLeft != 0 && this.scrolling == 1) {
	this.scrollLeftFunc();
}
else if(this.scrolling == 1) {
	this.scrollTopFunc();
}
window.setTimeout(this.scrollerObjName + ".update()", this.scrollingSpeed);
}

nemintScroller.prototype.scrollLeftFunc = function() {
this.index = parseInt(this.index - 1 * this.scrollingSpeedUp);
this.i = this.index;

var endMarkerLeftTemp = this.endMarkerLeft + this.i;

if(endMarkerLeftTemp <= this.positionLeftTicker) {
	this.index = 0;
	this.index--;
	this.i = 0;
	this.i--;
	this.getPosition();
}

document.getElementById(this.elTickerInnen).style.left = this.i + "px";
}

nemintScroller.prototype.scrollTopFunc = function() {
this.index = parseInt(this.index - 1 * this.scrollingSpeedUp);
this.i = this.index;

var endMarkerTopTemp = this.endMarkerTop + this.i;

if(endMarkerTopTemp < this.positionTopTicker) {
	this.index = 0;
	this.index--;
	this.i = 0;
	this.i--;
	this.getPosition();
}

document.getElementById(this.elTickerInnen).style.top = this.i + "px";
}

nemintScroller.prototype.getPosition = function() {
this.positionTopTicker =  parseInt(this.absTop(document.getElementById(this.elTicker)));
this.positionLeftTicker = parseInt(this.absLeft(document.getElementById(this.elTicker)));
this.endMarkerTop  = this.absTop(document.getElementById(this.elTickerInnenEnde));
this.endMarkerLeft = this.absLeft(document.getElementById(this.elTickerInnenEnde));
}

nemintScroller.prototype.absLeft = function(el) {
if(el) {
	return (el.offsetParent)?
	el.offsetLeft+this.absLeft(el.offsetParent) : el.offsetLeft;
}
else return 0;
}

nemintScroller.prototype.absTop = function(el) {
if(el) {
	return (el.offsetParent)?
	el.offsetTop+this.absTop(el.offsetParent) : el.offsetTop;
}
else return 0;
}

//*********************************************************************************************
//***                                 Server Kommunikation                                  ***
//***                                  Nemint Ajax v1.0                                     ***
//***                 2006 Nemint, New Media Interactiv www.nemint.de                       ***
//*********************************************************************************************
function NemintAjax() {
var req = new Object();

// -------------------
// Instance properties
// -------------------

/**
 * Timeout period (in ms) until an async request will be aborted, and
 * the onTimeout function will be called
 */
req.timeout = null;

/**
 *Since some browsers cache GET requests via XMLHttpRequest, an
 * additional parameter called NemintAjaxUniqueId will be added to
 * the request URI with a unique numeric value appended so that the requested
 * URL will not be cached.
 */
req.generateUniqueUrl = true;

/**
 * The url that the request will be made to, which defaults to the current
 * url of the window
 */
req.url = window.location.href;

/**
 * The method of the request, either GET (default), POST, or HEAD
 */
req.method = "GET";

/**
 * Whether or not the request will be asynchronous. In general, synchronous
 * requests should not be used so this should rarely be changed from true
 */
req.async = true;

/**
 * The username used to access the URL
 */
req.username = null;

/**
 * The password used to access the URL
 */
req.password = null;

/**
 * The parameters is an object holding name/value pairs which will be
 * added to the url for a GET request or the request content for a POST request
 */
req.parameters = new Object();

/**
 * The sequential index number of this request, updated internally
 */
req.requestIndex = NemintAjax.numNemintAjaxs++;

/**
 * Indicates whether a response has been received yet from the server
 */
req.responseReceived = false;

/**
 * The name of the group that this request belongs to, for activity
 * monitoring purposes
 */
req.groupName = null;

/**
 * The query string to be added to the end of a GET request, in proper
 * URIEncoded format
 */
req.queryString = "";

/**
 * After a response has been received, this will hold the text contents of
 * the response - even in case of error
 */
req.responseText = null;

/**
 * After a response has been received, this will hold the XML content
 */
req.responseXML = null;

/**
 * After a response has been received, this will hold the status code of
 * the response as returned by the server.
 */
req.status = null;

/**
 * After a response has been received, this will hold the text description
 * of the response code
 */
req.statusText = null;

/**
 * An internal flag to indicate whether the request has been aborted
 */
req.aborted = false;

/**
 * The XMLHttpRequest object used internally
 */
req.xmlHttpRequest = null;

// --------------
// Event handlers
// --------------

/**
 * If a timeout period is set, and it is reached before a response is
 * received, a function reference assigned to onTimeout will be called
 */
req.onTimeout = null;

/**
 * A function reference assigned will be called when readyState=1
 */
req.onLoading = null;

/**
 * A function reference assigned will be called when readyState=2
 */
req.onLoaded = null;

/**
 * A function reference assigned will be called when readyState=3
 */
req.onInteractive = null;

/**
 * A function reference assigned will be called when readyState=4
 */
req.onComplete = null;

/**
 * A function reference assigned will be called after onComplete, if
 * the statusCode=200
 */
req.onSuccess = null;

/**
 * A function reference assigned will be called after onComplete, if
 * the statusCode != 200
 */
req.onError = null;

/**
 * If this request has a group name, this function reference will be called
 * and passed the group name if this is the first request in the group to
 * become active
 */
req.onGroupBegin = null;

/**
 * If this request has a group name, and this request is the last request
 * in the group to complete, this function reference will be called
 */
req.onGroupEnd = null;

req.getXmlHttpRequest = function() {
	if (window.XMLHttpRequest) {
	return new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
	// Based on http://jibbering.com/2002/4/httprequest.html
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
		return new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		return new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
		return null;
		}
	}
	@end @*/
	}
	else {
	return null;
	}
};

// Get the XMLHttpRequest object itself
req.xmlHttpRequest = req.getXmlHttpRequest();

req.importArraySearch  = new Array('\\<','\\>','\\&amp;');
req.importArrayReplace = new Array('<','>','&');

if (req.xmlHttpRequest==null) { return null; }

req.get = function() {
	req.method = "GET";
	req.doRequest();
};

req.post = function(args) {
	req.method = "POST";
	req.handleArguments(args);
	req.doRequest();
};

req.submit = function(theform) {
	req.queryString = req.serializeForm(theform);
	req.method = theform.method.toUpperCase();
	req.url = theform.action;
	req.process();
	return true;
};

req.doRequest = function() {
	req.process();
};

req.parseXML = function(node) {
	if(node.nodeType != 1) {
	return false;
	}
	var tmp = new Array();
	var text = '';
	var attrib = new Array();
	tmp['nodeName'] = node.nodeName;
	tmp['nodeType'] = node.nodeType;
	tmp['nodeChilds'] = new Array();
	if(node.attributes.length > 0) {
	for(var i3 = 0; i3 < node.attributes.length ; i3++ ) {
		attrib[node.attributes[i3].nodeName] = node.attributes[i3].nodeValue;
	}
	}
	tmp['nodeAttribs'] = attrib;
	var i2 = 0;
	for(var i = 0; i < node.childNodes.length ; i++ ) {
	if(node.childNodes[i].nodeType == 1) {
		if(tmp['nodeChilds'][i2] = req.parseXML(node.childNodes[i])) {
		i2++;
		}
	}
	else if(node.childNodes[i].nodeType == 3) {
		text = text + node.childNodes[i].nodeValue;
	}
	}
	if(typeof(tmp['nodeAttribs']['encoding']) != 'undefined' && tmp['nodeAttribs']['encoding'] == 'htmlstrip') {
	tmp['nodeData'] = req.replaceInputXML(text);
	}
	else {
	tmp['nodeData'] = text;
	}
	return tmp;
};

req.parseData = function(node) {
	var tmp = new Array();
	if(req.responseXML!=null) {
	for(var i = 0; i < req.responseXML.getElementsByTagName(node).length ; i++ ) {
		tmp[i] = new Array();
		tmp[i] = req.parseXML(req.responseXML.getElementsByTagName(node)[i]);
	}
	return tmp;
	}
	else if(node == 'script') {
	return tmp;
	}
	else {
	tmp['plainText'] = req.responseText;
	return tmp;
	}
};

req.replaceInputXML = function(text) {
	for(var i = 0; i < req.importArraySearch.length; i++) {
	var s = '/' + req.importArraySearch[i] +'/ig';
	text = text.replace(s,req.importArrayReplace[i]);
	}
	return text;
};

// -------------------------------------------------------
// Attach the event handlers for the XMLHttpRequest object
// -------------------------------------------------------
req.xmlHttpRequest.onreadystatechange =
function() {
	if (req==null || req.xmlHttpRequest==null || !req.xmlHttpRequest) { return; }
	if (req.xmlHttpRequest.readyState==1) { req.onLoadingInternal(req); }
	if (req.xmlHttpRequest.readyState==2) { req.onLoadedInternal(req); }
	if (req.xmlHttpRequest.readyState==3) { req.onInteractiveInternal(req); }
	if (req.xmlHttpRequest.readyState==4) { req.onCompleteInternal(req); }
};
// ---------------------------------------------------------------------------
// Internal event handlers that fire, and in turn fire the user event handlers
// ---------------------------------------------------------------------------
// Flags to keep track if each event has been handled, in case of
// multiple calls (some browsers may call the onreadystatechange
// multiple times for the same state)
req.onLoadingInternalHandled = false;
req.onLoadedInternalHandled = false;
req.onInteractiveInternalHandled = false;
req.onCompleteInternalHandled = false;
req.onLoadingInternal =
	function() {
	if (req.onLoadingInternalHandled) { return; }
	NemintAjax.numActiveNemintAjaxs++;
	if (NemintAjax.numActiveNemintAjaxs==1 && typeof(window['NemintAjaxBegin'])=="function") {
		NemintAjaxBegin();
	}
	if (req.groupName!=null) {
		if (typeof(NemintAjax.numActiveAjaxGroupRequests[req.groupName])=="undefined") {
		NemintAjax.numActiveAjaxGroupRequests[req.groupName] = 0;
		}
		NemintAjax.numActiveAjaxGroupRequests[req.groupName]++;
		if (NemintAjax.numActiveAjaxGroupRequests[req.groupName]==1 && typeof(req.onGroupBegin)=="function") {
		req.onGroupBegin(req.groupName);
		}
	}
	if (typeof(req.onLoading)=="function") {
		req.onLoading(req);
	}
	req.onLoadingInternalHandled = true;
	};
req.onLoadedInternal =
	function() {
	if (req.onLoadedInternalHandled) { return; }
	if (typeof(req.onLoaded)=="function") {
		req.onLoaded(req);
	}
	req.onLoadedInternalHandled = true;
	};
req.onInteractiveInternal =
	function() {
	if (req.onInteractiveInternalHandled) { return; }
	if (typeof(req.onInteractive)=="function") {
		req.onInteractive(req);
	}
	req.onInteractiveInternalHandled = true;
	};
req.onCompleteInternal =
	function() {
	if (req.onCompleteInternalHandled || req.aborted) { return; }
	req.onCompleteInternalHandled = true;
	NemintAjax.numActiveNemintAjaxs--;
	if (NemintAjax.numActiveNemintAjaxs==0 && typeof(window['NemintAjaxEnd'])=="function") {
		NemintAjaxEnd(req.groupName);
	}
	if (req.groupName!=null) {
		NemintAjax.numActiveAjaxGroupRequests[req.groupName]--;
		if (NemintAjax.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
		req.onGroupEnd(req.groupName);
		}
	}
	req.responseReceived = true;
	req.status = req.xmlHttpRequest.status;
	req.statusText = req.xmlHttpRequest.statusText;
	req.responseText = req.xmlHttpRequest.responseText;
	req.responseXML = req.xmlHttpRequest.responseXML;
	if (typeof(req.onComplete)=="function") {
		req.onComplete(req);
	}
	if (req.xmlHttpRequest.status==200 && typeof(req.onSuccess)=="function") {
		req.onSuccess(req);
	}
	else if (typeof(req.onError)=="function") {
		req.onError(req);
	}

	// Clean up
	req.xmlHttpRequest = null;
	};
req.onTimeoutInternal =
	function() {
	if (req!=null && req.xmlHttpRequest!=null && !req.onCompleteInternalHandled) {
		req.aborted = true;
		req.xmlHttpRequest.abort();
		NemintAjax.numActiveNemintAjaxs--;
		if (NemintAjax.numActiveNemintAjaxs==0 && typeof(window['NemintAjaxEnd'])=="function") {
		NemintAjaxEnd(req.groupName);
		}
		if (req.groupName!=null) {
		NemintAjax.numActiveAjaxGroupRequests[req.groupName]--;
		if (NemintAjax.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
			req.onGroupEnd(req.groupName);
		}
		}
		if (typeof(req.onTimeout)=="function") {
		req.onTimeout(req);
		}
		req.xmlHttpRequest = null;
	}
	};

// ----------------
// Instance methods
// ----------------
/**
 * The process method is called to actually make the request. It builds the
 * querystring for GET requests (the content for POST requests), sets the
 * appropriate headers if necessary, and calls the
 * XMLHttpRequest.send() method
*/
req.process =
	function() {
	if (req.xmlHttpRequest!=null) {
		// Some logic to get the real request URL
		if (req.generateUniqueUrl && req.method=="GET") {
		req.parameters["NemintAjaxUniqueId"] = new Date().getTime() + "" + req.requestIndex;
		}
		var content = null; // For POST requests, to hold query string
		for (var i in req.parameters) {
		if (req.queryString.length>0) { req.queryString += "&"; }
		req.queryString += encodeURIComponent(i) + "=" + encodeURIComponent(req.parameters[i]);
		}
		if (req.method=="GET") {
		if (req.queryString.length>0) {
			req.url += ((req.url.indexOf("?")>-1)?"&":"?") + req.queryString;
		}
		}
		req.xmlHttpRequest.open(req.method,req.url,req.async,req.username,req.password);
		if (req.method=="POST") {
		if (typeof(req.xmlHttpRequest.setRequestHeader)!="undefined") {
			req.xmlHttpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		}
		content = req.queryString;
		}
		if (req.timeout>0) {
		setTimeout(req.onTimeoutInternal,req.timeout);
		}
		req.xmlHttpRequest.send(content);
	}
	};

/**
 * An internal function to handle an Object argument, which may contain
 * either NemintAjax field values or parameter name/values
 */
req.handleArguments =
	function(args) {
	for (var i in args) {
		// If the NemintAjax object doesn't have a property which was passed, treat it as a url parameter
		if (typeof(req[i])=="undefined") {
		req.parameters[i] = args[i];
		}
		else {
		req[i] = args[i];
		}
	}
	};

/**
 * Returns the results of XMLHttpRequest.getAllResponseHeaders().
 * Only available after a response has been returned
 */
req.getAllResponseHeaders =
	function() {
	if (req.xmlHttpRequest!=null) {
		if (req.responseReceived) {
		return req.xmlHttpRequest.getAllResponseHeaders();
		}
		alert("Cannot getAllResponseHeaders because a response has not yet been received");
	}
	};

/**
 * Returns the the value of a response header as returned by
 * XMLHttpRequest,getResponseHeader().
 * Only available after a response has been returned
 */
req.getResponseHeader =
	function(headerName) {
	if (req.xmlHttpRequest!=null) {
		if (req.responseReceived) {
		return req.xmlHttpRequest.getResponseHeader(headerName);
		}
		alert("Cannot getResponseHeader because a response has not yet been received");
	}
	};

req.serializeForm = function(theform) {
	var els = theform.elements;
	var len = els.length;
	var queryString = "";
	req.addField =
	function(name,value) {
		if (queryString.length>0) {
		queryString += "&";
		}
		queryString += encodeURIComponent(name) + "=" + encodeURIComponent(value);
	};
	for (var i=0; i<len; i++) {
	var el = els[i];
	if (!el.disabled) {
		switch(el.type) {
		case 'text': case 'password': case 'hidden': case 'textarea':
			req.addField(el.name,el.value);
			break;
		case 'select-one':
			if (el.selectedIndex>=0) {
			req.addField(el.name,el.options[el.selectedIndex].value);
			}
			break;
		case 'select-multiple':
			for (var j=0; j<el.options.length; j++) {
			if (el.options[j].selected) {
				req.addField(el.name,el.options[j].value);
			}
			}
			break;
		case 'checkbox': case 'radio':
			if (el.checked) {
			req.addField(el.name,el.value);
			}
			break;
		}
	}
	}
	return queryString;
};
return req;
};

//*********************************************************************************************
//***                                  Nemint Ajax Static                                   ***
//*********************************************************************************************
NemintAjax.numActiveNemintAjaxs = 0;
NemintAjax.numActiveAjaxGroupRequests = new Object();
NemintAjax.numNemintAjaxs = 0;

NemintAjax.isActive = function() {
return (NemintAjax.numActiveNemintAjaxs>0);
};

NemintAjax.sendServerData = function(url,nextjob,method,args) {
var obj = new NemintAjax();
if(typeof(obj.xmlHttpRequest) != 'object') {
	return false;
}
if(typeof(url)=="string") {
	obj.url = url;
}
obj.onSuccess = function() {NemintAjax.goServerInput(obj,nextjob); };
if(typeof(url)!="undefined" && typeof(url)!="string" || typeof(method)=="string" && method.toLowerCase() == 'submit' && typeof(url)!="string") {
	obj.submit(url);
	return true;
}
else if(typeof(method)!="undefined" && typeof(args)!="undefined" && method.toLowerCase() == 'post') {
	obj.post(args);
	return true;
}
else if(typeof(url)!="undefined" && typeof(url)=="string") {
	obj.get();
	return true;
}
else {
	alert('error');
	return false;
}
};

NemintAjax.updateServerInput = function(obj) {
var tmp2 = new Array();
tmp2['script'] = obj.parseData('script');
for(i=0; i < tmp2['script'].length; i++) {
	if(typeof(tmp2['script'][i]['nodeAttribs']['do'])!='undefined' && tmp2['script'][i]['nodeAttribs']['do'] == 'direct') {
	try {
		eval(tmp2['script'][i]['nodeData']);
	}
	catch(e) {
	}
	}
}
for(i=tmp2['script'].length-1; i >= 0; i--) {
	if(typeof(tmp2['script'][i]['nodeAttribs']['do'])!='undefined' && tmp2['script'][i]['nodeAttribs']['do'] == 'direct') {
	delete tmp2['script'][i];
	}
}
tmp2['data'] = obj.parseData('data');
return tmp2;
};

NemintAjax.goServerInput = function(obj,nextjob) {
if(!obj) {
	alert("Server communication error!!!");
}
else if(!obj.responseXML || obj.responseXML == null) {
	if(obj.responseText!=null && typeof(obj.responseText) ==  "string" && typeof(nextjob)=="function") {
	nextjob(obj.responseText);
	}
	delete obj;
	return true;
}
else if(obj.responseXML) {
	var tmp = NemintAjax.updateServerInput(obj);
	if(typeof(nextjob)=="function") {
	nextjob(tmp);
	}
	else {
	for(i=0; i < tmp['data'].length; i++) {
		if(typeof(tmp['data'][i]['nodeAttribs']['name'])!='undefined' && document.getElementById(tmp['data'][i]['nodeAttribs']['name'])) {
		document.getElementById(tmp['data'][i]['nodeAttribs']['name']).innerHTML = tmp['data'][i]['nodeData'];
		}
	}
	}
	delete obj;
	return true;
}
if(obj) {
	delete obj;
}
return false;
};
//*********************************************************************************************



