function em_link( linktext, emsubject ) {
  if (emsubject.length > 0 ) {
    var subject = "?subject="+emsubject;
  } else {
    var subject = "";
  } 
  var pref = '&#109;a' + 'i&#108;' + '&#116;o:'; 
  var first = '%69%6E%66%6F';
  var at = '%40'; 
  var last = '&#x69;&#x74;&#x72;&#x61;&#x76;&#x69;&#x78;&#x2E;&#x63;&#x68;';
  var last = '&#112;&#105;&#103;&#100;&#114;&#101;&#97;&#109;&#115;&#46;&#99;&#104;';
  var em = first + at + last; 
  var first2 = '&#x69;&#x6E;&#x66;&#x6F;'; 
  var at2 = '&#x40;'; 
  var last2 = '&#112;&#105;&#103;&#100;&#114;&#101;&#97;&#109;&#115;&#46;&#99;&#104;';
  var em2 = first2 + at2 + last2; 
  if (linktext.length > 0 ) {
    var em2 = linktext; 
  } 
  document.write( '<a href=' + '\'' + pref + em + subject + '\'>'+em2+'<\/a>' ); 
}


function AjaxHTTPInit()
{
    var HttpReq = null;
	/* Create a new XMLHttpRequest object to talk to the Web server */
	/*@cc_on @*/
	try {
		HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
		AjaxRequestType = "Msxml2.XMLHTTP";
	} catch (e) {
		try {
			HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
			AjaxRequestType = "Microsoft.XMLHTTP";
		} catch (e2) {
			HttpReq = null;
		}
	}
	
  if (!HttpReq && typeof XMLHttpRequest != 'undefined') {
		HttpReq = new XMLHttpRequest();
		AjaxRequestType = "XMLHttpRequest";
	}

	if (!HttpReq) {
		AjaxRequestType = "";
		alert("AjaxHTTPInit() Your browser does not support AJAX!");
		return null;
	}
	
	return HttpReq;
}

function AjaxPost(url, param, post_param, on_handler)
{
	if (param != "" ) {
	  var CurrentAjaxRequest = "url:"+url+"|param:"+param+"|post_param:"+post_param+"|";
		if ( CurrentAjaxRequest != LastAjaxRequest ) {
			LastAjaxRequest = CurrentAjaxRequest;
		  var HttpRequest = AjaxHTTPInit();
		
		  if (HttpRequest != null) {
		  	// Open an HTTP POST connection 
		  	HttpRequest.open("POST", url+param, true);
		  	// Setup a function for the server to run when it's done
		  	HttpRequest.onreadystatechange = function(){ on_handler(HttpRequest, url, param); };
		  	// Specify that the body of the request contains form data
		    HttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		  	// Send form encoded data
		  	// if ( post_param != "" ) {alert( "AjaxPost: post_param="+post_param );}
		  	HttpRequest.send(post_param);
		  	if (DEBUG ) {
		  		document.getElementById('innerbottom_left_msg').innerHTML = "POST: "+url+param;
		  	}
		  } else {
		    alert( "AjaxPost: Unable to open HttpRequest Object in function AjaxPost");
		  }
		}
	}
}


function AjaxGet(url, param, on_handler )
{
  var HttpRequest = AjaxHTTPInit();

  if (HttpRequest != null) {
    // alert(url);    
    // alert(parameters);    
  	// Open a connection to the server
  	HttpRequest.open("GET", url+param, true);
  	// Setup a function for the server to run when it's done
  	HttpRequest.onreadystatechange = function(){ on_handler(HttpRequest, url, param); };
  	// Send the request
  	HttpRequest.send(null);
  } else {
    alert( "AjaxGet: Unable to open HttpRequest Object in function AjaxGet");
  }
}

function ShowAjaxPage( req, url, param ) {
	
  var status=["0: Uninitialized", "1: Open", "2: Sent", "3: Receiving", "4: Loaded"];
	if (req.readyState >= 1 && req.readyState <= 3) {
  	document.getElementById('AjaxContent').innerHTML = "readyState "+status[req.readyState];
	} else if(req.readyState == 4 && req.status == 200 ) {

		if (req.responseText.indexOf("Parse error") != -1) {
			alert( "ShowAjaxPage: Status: "+ req.status +" "+req.responseText );
		}
    // alert( req.responseText);
   	document.getElementById('AjaxContent').innerHTML = req.responseText;

  } else {
  	alert ("ShowAjaxPage: Ajax-Daten k&ouml;nnen nicht empfangen werden - readyState: "+req.readyState+" status"+req.status);
  }    
}

