// AJAX Functions

var AJAX =
{	
	createXMLHttpRequest: function() {
		var xmlHttp = null;	// Mozilla, Opera, Safari und IE 7
		if (typeof XMLHttpRequest != 'undefined') {
			xmlHttp = new XMLHttpRequest();
		}
		if (!xmlHttp) { 		// ältere IE
			try {
				xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
		    		xmlHttp  = new	ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
	   			xmlHttp  = null;
				}
			}
		}
		return xmlHttp;
	}
}


function Kabc(e) {
	var what = e.firstChild.data.toLowerCase();
	if (what=='0-9') what = '0';
	if (e.blur) e.blur();
	if (typeof abcActive == 'undefined') {
		abcActive = document.getElementById('abcinit');
	}
	
	abcActive.className = (abcActive.className.match(/h$/))?'h':'a';
	abcActive = e;
	abcActive.className = (abcActive.className.match(/h$/))?'activeh':'active';

	// document.getElementById('ajaxPlaceNews').scrollTop = 0;
	// document.getElementById('ajaxPlaceNews').innerHTML = '<p><img src="g/loading.gif" alt="Daten werden geladen."/></p>';
	var AReq = AJAX.createXMLHttpRequest();
	try { AReq.open("GET","/magazin/kino/galerie/"+what+"/index.htm", false); } catch (e) { window.status='Ajax Request Error'; return 0; }
	AReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	try { AReq.send(null); } catch(e) { }
	if ((AReq.readyState == 4) && (AReq.status == 200)) document.getElementById('filmliste').innerHTML = AReq.responseText;
	return false;
}
	

function LoadContentAsync(id,file,method) {		// NICHT BENUTZT
	var AReq = AJAX.createXMLHttpRequest();
	if (!method) method='GET';
	try { AReq.open(method,file,true); } catch (e) { window.status='ajax request error'; return 0; }
	AReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	AReq.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT'); AReq.setRequestHeader('Cache-Control','no-cache'); 

	AReq.onreadystatechange = function() {
		if ((AReq.readyState == 4) && (AReq.status == 200)) {
			if (typeof id == 'object') {
				id.value=AReq.responseText
			} else {
				document.getElementById(id).innerHTML = AReq.responseText
			}
		}
	}

	try { AReq.send(null); } catch(e) { window.status='ajax send error' }
	return false
}


function LoadContent(id,file,method) {
	var AReq = AJAX.createXMLHttpRequest();
	if (!method) method='GET';
	try { AReq.open(method,file,false); } catch (e) { window.status='ajax request error'; return 0; }
	AReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	AReq.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT'); AReq.setRequestHeader('Cache-Control','no-cache'); 
	try { AReq.send(null); } catch(e) { window.status='ajax send error'; return -1 }
	document.getElementById(id).innerHTML = (AReq.status == 200) ? AReq.responseText	: 'Fehler '+ AReq.status.toString()+': '+AReq.statusText;
	return AReq.status
}

