var url_chatindikator = "chat/chatindikator.php";


function InitChatindikator() {
    try {
        if(window.XMLHttpRequest) {
			chatindi_request_obj = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
			chatindi_request_obj = new ActiveXObject("Microsoft.XMLHTTP");
        }
		HoleChatIndikator();
    } catch(e) {
        return false;
    }
}

function HoleChatIndikator() {
	chatindi_request_obj.open("POST", url_chatindikator, true);
    chatindi_request_obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    chatindi_request_obj.setRequestHeader("Connection","close");
    chatindi_request_obj.onreadystatechange=function() {
		if (chatindi_request_obj.readyState == 4) {
			var xmlDocument = chatindi_request_obj.responseXML;
			var chat_on_off = xmlDocument.getElementsByTagName('chat_on_off')[0].firstChild.nodeValue;
			if( chat_on_off == 'on' ){
				document.getElementById( 'chat_indikator' ).style.display = '';
			}else{
				document.getElementById( 'chat_indikator' ).style.display = 'none';
			}

			setTimeout( 'HoleChatIndikator()', 3000 );
		}
	}
	chatindi_request_obj.send('');
}




function setValue( id, val ){
	try{
		document.getElementById(id).value = val;
	}catch(exception){
		// Do nothing, ignore it.
	}
}


function reload (url) {
	var location=(url);
	this.location.href = location;
}

function redirect( formularname, neueaktion ){
	document.getElementById(formularname).action = neueaktion;
	document.getElementById(formularname).submit();
}


function aufklappIdOhneIcon( id ){
	var status;

	status = document.getElementById( id ).style.display;

	if( status == 'none' ){
		document.getElementById( id ).style.display = '';
	}else{
		document.getElementById( id ).style.display = 'none';
	}
}

function start_mp3(filename) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="20" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" >');
    document.write('<param name="movie" value="mp3player/mp3player.swf" />');
    document.write('<param name="flashvars" value="file=data/' + filename + '&autostart=true" />');
    document.write('<embed src="mp3player/mp3player.swf" width="300" height="20" flashvars="file=data/' + filename + '&autostart=true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


