
/****************************************************************
 * Most Simple Ajax Chat Script (www.linuxuser.at)		*
 * Version: 3.1							*
 * 								*
 * Author: Chris (chris[at]linuxuser.at)			*
 * Contributors: Derek, BlueScreenJunky (http://forums.linuxuser.at/viewtopic.php?f=6&t=17)
 *								*
 * Licence: GPLv2						*
 ****************************************************************/
var innerHTML = '';
var intUpdate = '';
var waittime=9000;
var zeit = '';
var url = 'http://www.lubovnenavist.ru/chat.php';

/* Request for Reading the Chat Content */
function ajax_read(url) {
	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/html');
		}
	} else if(window.ActiveXObject){
		try{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){
			}
		}
	}


	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState==4) {
	
		document.getElementById("chatwindow").innerHTML = xmlhttp.responseText;

		zeit = new Date();
		ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
		intUpdate = setTimeout("ajax_read('http://www.lubovnenavist.ru/chat.php')", waittime)

		}
	}

	xmlhttp.open('GET',url,true);
	xmlhttp.send();
}

/* Request for Writing the Message */
function ajax_write(url){
	if(window.XMLHttpRequest){
		xmlhttp2=new XMLHttpRequest();
		if(xmlhttp2.overrideMimeType){
			xmlhttp2.overrideMimeType('text/html');
		}
	} else if(window.ActiveXObject){
		try{
			xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){
			}
		}
	}

	if(!xmlhttp2) {

		return false;
	}

	xmlhttp2.open('GET',url,true);
	xmlhttp2.send();
}




intUpdate = setTimeout("ajax_read('http://www.lubovnenavist.ru/chat.php')", waittime);