var chk_timeout_1 = 0;
var chk_timeout_2 = 0;
var chk_timeout_3 = 0;
var chk_timeout_4 = 0;
var chk_timeout_5 = 0;

var group99 = null;

function sort_evs(a, b)
{
	return b.ID - a.ID
}

function sort_evs_back(a, b)
{
	return a.ID - b.ID
}

function Event_ev(id,ti,ty,uid,suid,mty,xid)
{
	var self=this;
	this.ID= id;
	this.TI= ti;
	this.TY= ty;
	this.UID= uid;
	this.SUID= suid;
	this.MTY= mty;
	this.XID= xid;
}

function Event_us(uid,ma1,ma2,ma3,ma4,ma5,sx,ol,un,ih,ip)
{
	this.UID=uid;
	this.MA1=ma1;
	this.MA2=ma2;
	this.MA3=ma3;
	this.MA4=ma4;
	this.MA5=ma5;
	this.SX=sx;
	this.OL=ol;
	this.UN=un;
	this.IH=ih;
	this.IP=ip;
}

function open_n(val)
{
	ncfenster=window.open(PPATH+'nachrichten_neu.html?NAME='+val,'nachrichten','resizable=yes,width=750,height=560');
	ncfenster.focus(); 
	return false;
}


//	'<div class="event" id="usm_:ID:"><div class="user-info"><h4>:UN:</h4><div class="image-container"><a href=":UP:"><div class="gradient"></div><img src=":IM:" width="98" height="98" class="user-img" /></a></div><div class="nav-box" onmouseover="obj_opacity (this,100)" onmouseout="obj_opacity (this,60)"><a href="javascript://" onclick="return open_n(\':UN:\')" class="sendmail" title="Diesem User eine Nachricht schicken" alt="Diesem User eine Nachricht schicken">&nbsp;</a><a href=":UP:" class="idcard" title="Das Profil dieses Users ansehen" alt="Das Profil dieses Users ansehen">&nbsp;</a><div class="match" title="Wie gut passen dieser User und du zusammen?" alt="Wie gut passen dieser User und du zusammen?">:MA:%</div><div class="clear"></div></div></div>',
var ev_uex = new Array
( 
	'<div class="event" id="usm_:ID:"><div class="user-info"><h4>:UN:</h4><div class="image-container"><a href=":UP:"><div class="gradient"></div><img src=":IM:" width="98" height="98" class="user-img" /></a></div><div class="nav-box" onmouseover="obj_opacity (this,100)" onmouseout="obj_opacity (this,60)"><a href="javascript://" onclick="return open_n(\':UN:\')" class="sendmail" title="Diesem User eine Nachricht schicken" alt="Diesem User eine Nachricht schicken">&nbsp;</a><a href=":UP:" class="idcard" title="Das Profil dieses Users ansehen" alt="Das Profil dieses Users ansehen">&nbsp;</a><div class="clear"></div></div></div>',
	'',
	'',
	'',
	''
)


var ev_ta = new Array
( 
	'',
	':UX1:hat gerade die Community betreten.</div>',
	':UX1:hat gerade die Community verlassen.</div>',
	':UX1:hat eine Blogseite besucht.</div>',
	':UX1:hat eine ID-Card besucht.</div>',
	':UX1:hat einen Kalender besucht.</div>',
	':UX1:hat eine Fotoübersicht besucht.</div>',
	':UX1:hat eine Fotoseite besucht.</div>',
	'','',
	':UX1:hat eine Blogübersicht besucht.</div>',
	':UX1:hat eine Kleinanzeige besucht.</div>',
	':UX1:hat eine Kleinanzeigenübersicht besucht.</div>',
	':UX1:hat ein Gästebuch besucht.</div>',
	':UX1:hat eine Bookmarkübersicht besucht.</div>',
	':UX1:hat eine Videoseite besucht.</div>',
	':UX1:hat eine Videoübersicht besucht.</div>',
	':UX1:hat eine Pin-It-Seite besucht.</div>',
	':UX1:hat eine Musikseite besucht.</div>',
	':UX1:hat eine Musikübersichtseite besucht.</div>',
	':UX1:hat einen Blog geschrieben.</div>',
	':UX1:hat einen Kommentar verfaßt.</div>',
	':UX1:hat ein neues Foto eingestellt.</div>',
	':UX1:hat eine Kleinanzeige aufgegeben.</div>',
	':UX1:hat ein Gästebucheintrag erstellt.</div>',
	':UX1:hat im Forum ein Thema erstellt.</div>',
	':UX1:hat im Forum einen Beitrag erstellt.</div>',
	':UX1:hat sein Pin-It geändert.</div>',
	':UX1:hat ein Post-It erstellt.</div>',
	':UX1:hat einen Musiktitel eingestellt.</div>',
	':UX1:hat eine Nachricht verfaßt.</div>',
	'','','','','','','','','','',
	':UX1:hat eine Flaschenpost verschickt.</div>'
	
)

var ev_tp = new Array
( 
	'', '', '',
	':UX1:hat eine Deiner Blogseiten besucht.</div>',
	':UX1:hat Deine ID-Card besucht.</div>',
	':UX1:hat Deinen Kalender besucht.</div>',
	':UX1:hat Deine Fotoübersicht besucht.</div>',
	':UX1:hat eine Deiner Fotoseiten besucht.</div>',
	'','',
	':UX1:hat Deine Blogübersicht besucht.</div>',
	':UX1:hat eine Deiner Kleinanzeigen besucht.</div>',
	':UX1:hat Deine Kleinanzeigenübersicht besucht.</div>',
	':UX1:hat eine Deiner Bookamrks besucht.</div>',
	':UX1:hat Dein Gästebuch besucht.</div>',
	':UX1:hat Deine Videoseite besucht.</div>',
	':UX1:hat Deine Videoübersicht besucht.</div>',
	':UX1:hat Deine Pin-It-Seite besucht.</div>',
	':UX1:hat eine Deiner Musikseiten besucht.</div>',
	':UX1:hat Deine Musikübersichtseite besucht.</div>',
	'',
	':UX1:hat bei Deinen Inhalten einen Kommentar verfaßt.</div>',
	'', '', '', '',
	':UX1:hat ein Antwort auf Dein Thema geschrieben.</div>',
	'', '', '',
	':UX1:hat Dir eine Nachricht gesendet.</div>',
	':UX1:hat Dich zum Chat eingeladen.</div>',
	':UX1:hat Deinen Chat angenommen.</div>',
	':UX1:hat Deinen Chat abgelehnt.</div>',
	':UX1:hat den Chat verlassen.</div>',
	'','','','','','',
	':UX1:hat Dir eine Flaschenpost geschickt.</div>'
)

parent.top.o2ochat_tool_open=0;
var Event =
{
	ev_uid: 0, ev_ma1: 5, ev_ma2: 5, ev_ma3: 5, ev_ma4: 5, ev_ma5: 5,
	ev_ev_last: 0,
	ev_ev_ar: new Array(),
	ev_us_ar: new Array(),
	ev_ne_ar: new Array(),
	ev_msgc: 0,
	ev_polling: false, // true = Blockversion - false = Steamversion
	ev_aktive: false,
	ev_div: '',
	ev_lastid: 0,
	ev_path: 'http://www.youmeu.com/event/index.html',
	ev_ppath: 'http://www.youmeu.com/de/',
	ev_ipath: 'http://img.youmeu.com/userfiles/',
	ev_first_cycle: 15000,
	ev_cycle: 45000,
	ev_move_height: 200,
	ev_min_time: 2,
	ev_max_time: 10,
	evo: '',
	opos: 0,
	opTime: 0,
	Timer: '',
	duration: 400,
	onMoveComplete: '',
	moving: false,
	next_block: 0,
	first_call: true,
	outspool: false,

	el: '',
	onOnComplete: '',
	onOffComplete: '',
	onFlushComplete: '',

	// init
	init: function (div)
	{
		var obj=this;
		this.ev_div=div;
		if(this.ev_polling==true && this.ev_aktive==false)
		{
			event_timeout_1 = window.setTimeout(function(){obj.get();}, obj.ev_first_cycle);
			chk_timeout_1 = 1;
			this.ev_aktive==true;
		}
		//this.get();
		this.isloaded();
	},

	// ERSETZEN
	get: function ()
	{
		if(this.ev_polling==true)
		{
			var obj=this;
			new ajax(obj.ev_path, {onComplete:function(transport){
				obj.isloaded(transport);
			},evalObj:'Event.evo'});
			event_timeout_2 = window.setTimeout(function(){obj.get();}, obj.ev_cycle);
			chk_timeout_2 = 1;
		}
	},

	url_encode_link: function (val)
	{
		var res='';
		var hex='0123456789ABCDEF';
		for(i=0;i<val.length;i++)
		{
			var c=val.charAt(i);
			if((c>='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z'))
			{
				res+=c;
			}
			else if(c==' ')
			{
				res+='-';
			}
			else
			{
				var a=c.charCodeAt(0);
				res+=':';
				res+=hex.charAt((a>>4)%16);
				res+=hex.charAt(a%16);
				res+=':';
			}
		}
		return res;
	},

	do_disp: function ()
	{
		var din;
		// sort eventlist
		this.ev_ne_ar.sort(sort_evs_back);
		if( this.ev_ne_ar.length>0 && (din=this.get_evsn(this.ev_ne_ar[0].ID))>=0)
		{
			this.write_udiv(din,'db');
			this.ev_ne_ar.splice(0, 1);
			if(this.ev_ne_ar.length>0)
			{
				var obj=this;
				var vt=parseInt(Math.random()*(this.ev_max_time-this.ev_min_time));
				vt+=this.ev_min_time;
				this.outspool=true;
				event_timeout_3 = window.setTimeout(function(){obj.do_disp();}, vt*1000);
				chk_timeout_3 = 1;
			}
			else
			{
				this.outspool=false;
			}
		}
	},

	do_disp_stream: function ()
	{
		var din;
		if( this.ev_ne_ar.length>0 && (din=this.get_evsn(this.ev_ne_ar[0].ID))>=0)
		{
			this.write_udiv(din,'stream');
			this.ev_ne_ar.splice(0, 1);
			var obj=this;
			this.outspool=true;
			if (chk_timeout_4 == 1)
			{
				window.clearTimeout(event_timeout_4);
			}
			event_timeout_4 = window.setTimeout(function(){obj.do_disp_stream();}, 1800);
			chk_timeout_4 = 1;
		}
		else
		{
			if (chk_timeout_4 == 1)
			{
				window.clearTimeout(event_timeout_4);
				chk_timeout_4 = 0;
			}
		}
	},
/*
	do_disp_stream: function ()
	{
		var din;
		if( this.ev_ne_ar.length>0 && (din=this.get_evsn(this.ev_ne_ar[0].ID))>=0)
		{
			//alert(this.ev_ne_ar[0].ID);
			this.write_udiv(din,'stream');
			this.ev_ne_ar.splice(0, 1);
			var obj=this;
			this.outspool=true;
			event_timeout_4 = window.setTimeout(function(){obj.do_disp_stream();}, 1800);
			chk_timeout_4 = 1;
		}
	},
*/
	copy_udiv: function (src,dest)
	{
		setInnerHTML('evub_'+dest,$('evub_'+src).innerHTML);
		var div = Element.find($('evub_'+dest), 'nextSibling');
	},

	set_var: function (msg,evu,evv)
	{
		var ma='';
		var imli = 'de/grafiken/user-info/user_default_m-small.jpg';
		var olc ='user_image-offline';

		if(evu.IH=='')
		{
			if(evu.SX==1)
			{
				imli='de/grafiken/user-info/user_default_f-small.jpg';
			}
		}
		else
		{
			imli=this.ev_ipath+evu.IP+'/'+evu.IH+'.jpg';
		}
		if(evu.OL==1)
		{
			olc ='user_image-online';
		}
		msg = msg.replace(/:UX1:/g,ev_uex[0]);
		msg = msg.replace(/:UX2:/g,ev_uex[1]);
		msg = msg.replace(/:UX3:/g,ev_uex[2]);
		msg = msg.replace(/:UX4:/g,ev_uex[3]);
		msg = msg.replace(/:UX5:/g,ev_uex[4]);
		msg = msg.replace(/:UN:/g,evu.UN);
		msg = msg.replace(/:IM:/g,imli);
		msg = msg.replace(/:OL:/g,olc);
		msg = msg.replace(/:IH:/g,evu.IH);
		msg = msg.replace(/:IP:/g,evu.IP);
		msg = msg.replace(/:PP:/g,this.ev_ppath);
		msg = msg.replace(/:IPP:/g,this.ev_ipath);
		msg = msg.replace(/:UP:/g,this.ev_ppath+'id/'+this.url_encode_link(evu.UN)+'.html');
		msg = msg.replace(/:UID:/g,''+evu.UID);
		msg = msg.replace(/:ID:/g,''+evv.ID);
		msg = msg.replace(/:UNE:/g,this.url_encode_link(evu.UN));

		if(this.ev_uid!=evv.UID && this.ev_uid > 0)
		{
			ma=(50-(Math.abs(evu.MA1-this.ev_ma1) + Math.abs(evu.MA2-this.ev_ma2) +Math.abs(evu.MA3-this.ev_ma3) +Math.abs(evu.MA4-this.ev_ma4) +Math.abs(evu.MA5-this.ev_ma5)))*2;
		}
		msg = msg.replace(/:MA:/g,ma);
		return msg;
	},

	write_udiv: function (ev_num,source)
	{
		var evu;
		var evv;
		var evsu;
		var ma;
		var evmsg;
		
		if(ev_num<0 || ev_num>this.ev_ev_ar.length)
		{
			return false;
		}
		evv=this.ev_ev_ar[ev_num];
		evmsg='';
		if(ev_ta[evv.TY]!='')
		{
			evmsg=ev_ta[evv.TY];
		}

		if(evv.TY==35 && this.ev_lastid < evv.ID && evv.SUID == this.ev_uid)
		{
			this.ev_msgc = evv.XID;
			setInnerHTML('ev_msgc',''+this.ev_msgc);
			setClass('ev_msgc','count red');
		}

		if(evv.SUID>0 && evv.SUID==this.ev_uid && (evsu=this.get_us(evv.UID))!=null)
		{
			if(ev_tp[evv.TY]!='')
			{
				evmsg=ev_tp[evv.TY];
			}
		}

		this.ev_lastid = evv.ID;

		if(evmsg=='')
		{
			return false;
		}

		evu=this.get_us(evv.UID);
		if(evu==null)
		{
			return false;
		}
		if(this.next_block>5)
		{
			//Verschieben der Daten!!
			this.copy_udiv(3,0);
			this.copy_udiv(4,1);
			this.copy_udiv(5,2);
			this.opos=0;
			this.move_margin(this.opos);
			this.next_block=3;
		}

		tl=this.set_var(evmsg,evu,evv);
		if(this.ev_uid!=evv.UID && this.ev_uid > 0)
		{
			if (evu.OL==1)
			{
				if(evv.TY==31)
				{
					if (source == 'stream') playmovie('chatanfrage');
					new ajax(PAJAX+'o2ochat_list.html', {postBody:'',update: 'o2ochat',onComplete: function(){o2o_chat_status();}})
					if (source == 'stream') { ToolTip.get('chat_light',this,false,''); parent.top.o2ochat_tool_open=1;}
				}
				else
				{
					if(evv.TY==34) new ajax(PAJAX+'o2ochat_list.html', {postBody:'',update: 'o2ochat',onComplete: function(){o2o_chat_status();}})
				}
			}
		}
		setInnerHTML('evub_'+this.next_block,tl);
		if(this.next_block>2)
		{
			var toflush = 0;
			// post an mich
			if(evv.SUID>0 && evv.SUID==this.ev_uid)
			{
				toflush = evv.ID;
				if(evv.TY==30)
				{
					this.ev_msgc++;
					setInnerHTML('ev_msgc',''+this.ev_msgc);
					setClass('ev_msgc','count red');
				}
			}
			this.move_top(toflush);
		}
		this.next_block++;
		return true;
	},

	get_us: function (uid)
	{
		var i;
		var j=this.ev_us_ar.length;
		for (i=0;i<j;i++)
		{
			if(uid==this.ev_us_ar[i].UID)
			{
				return this.ev_us_ar[i];
			}
		}
		return null;
	},

	get_evsn: function (id)
	{
		var i;
		var j=this.ev_ev_ar.length;
		for (i=0;i<j;i++)
		{
			if(id==this.ev_ev_ar[i].ID)
			{
				return i;
			}
		}
		return -1;
	},

	ins_ev: function (id,ti,ty,uid,suid,mty,xid)
	{
		if(id <=this.ev_ev_last)
		{
			return false;
		}
		this.ev_ev_ar.push(new Event_ev(id,ti,ty,uid,suid,mty,xid));
		return true;
	},

	ins_us: function (uid,ma1,ma2,ma3,ma4,ma5,sx,ol,un,ih,ip)
	{
		var i;
		var j=this.ev_us_ar.length;
		for (i=0;i<j;i++)
		{
			if(uid==this.ev_us_ar[i].UID)
			{
				// update online-flag
				this.ev_us_ar[i].OL=ol;
				return;
			}
		}
		this.ev_us_ar.push(new Event_us(uid,ma1,ma2,ma3,ma4,ma5,sx,ol,un,ih,ip));
	},

	isloaded: function (transport)
	{
		var i;
		var evo=this.evo;
		var j=evo.EUN;
		for (i=0;i<j;i++)
		{
			if(evo.UUID[i]==this.ev_uid)
			{
				this.ev_ma1=evo.MA1[i];
				this.ev_ma2=evo.MA2[i];
				this.ev_ma3=evo.MA3[i];
				this.ev_ma4=evo.MA4[i];
				this.ev_ma5=evo.MA5[i];
			}
			this.ins_us(evo.UUID[i],evo.MA1[i],evo.MA2[i],evo.MA3[i],evo.MA4[i],evo.MA5[i],evo.SX[i],evo.OL[i],evo.UN[i],evo.IH[i],evo.IP[i]);
		}

		var gr=0;
		j=evo.EVN;
		for (i=0;i<j;i++)
		{
			if(gr<evo.ID[i])
			{
				gr=evo.ID[i];
			}
			if(this.ins_ev(evo.ID[i],evo.TI[i],evo.TY[i],evo.UID[i],evo.SUID[i],evo.MTY[i],evo.XID[i])==false)
			{
				break;
			}
		}
		this.ev_ev_ar.sort(sort_evs);
		if(this.first_call==true)
		{
			// erste abfrage der daten... ausgabe der ersten 3
			this.first_call=false;
			var x=0;
			for(i=0;i<j;i++)
			{
				this.next_block=2-x;
				if(this.write_udiv(i)==true) x+=1;
				if(x>2) break;
			}
			this.next_block=3;
		}
		else if(this.ev_ev_last<gr)
		{
			// es sind neue events da; diese ausgeben
			j=this.ev_ev_ar.length;
			for(i=0;i<j;i++)
			{
				if(this.ev_ev_ar[i].ID>this.ev_ev_last)
				{
					if(this.ev_ev_ar[i].UID==this.ev_uid && this.ev_ev_ar[i].TY>2)
					{
						continue;
					}
					this.ev_ne_ar.push(this.ev_ev_ar[i]);
				}
				else
				{
					break;
				}
			}
			if(this.outspool==false && this.ev_ne_ar.length>0)
			{
				var obj=this;
				event_timeout_5 = window.setTimeout(function(){obj.do_disp();}, 10);
				chk_timeout_5 = 1;
			}
		}

		// store last managed event
		if(gr>this.ev_ev_last) this.ev_ev_last=gr;
	},

	move_top: function (toflush)
	{
		var obj=this;
		if(this.div!='' && this.moving==false)
		{
			var div_obj=$(this.div);
			this.opTime=(new Date).getTime();
			this.Timer = setInterval (function(){obj.move_time(toflush);}, 15);
			this.moving=true;
		}
	},

	move_margin: function(val)
	{
		$(this.ev_div).style.marginTop='-'+val+'px';
	},

	move_time: function(toflush)
	{
		if(this.Timer)
		{
			var time  = (new Date).getTime();
			if(time>=this.opTime+this.duration)
			{
				clearInterval(this.Timer);
				this.Timer=null;
				this.opos+=this.ev_move_height;
				this.move_margin(this.opos);
				if(toflush>0)
				{
					PlugIn.flush('usm_'+toflush,'#23982b');
				}
				if(this.onMoveComplete)
				{
					this.onMoveComplete();
				}
				this.moving=false;
			}
			else
			{
				var mh=(time - this.opTime) / this.duration *this.ev_move_height;
				this.move_margin(mh+this.opos);
			}
		}
	},

	move_end: function()
	{
	}
}

function extractIFrameBody(iFrameEl) 
{
	var doc = null;
	if (iFrameEl.contentDocument)
	{ // For NS6
		doc = iFrameEl.contentDocument; 
	} 
	else if (iFrameEl.contentWindow) 
	{ // For IE5.5 and IE6
		doc = iFrameEl.contentWindow.document;
	} 
	else if (iFrameEl.document) 
	{ // For IE5
		doc = iFrameEl.document;
	} 
	else 
	{
		alert("Error: could not find sumiFrame document");
		return null;
	}
	return doc.body;
}

var actual_stream_id = 0;

// VERTEILER
function controller()
{
	verteiler_timeout = window.setTimeout(function()
	{
		if(window.ActiveXObject)
		{
			com_stream = extractIFrameBody($('bb')).innerHTML;
		}
		
		temp = com_stream;
		if(temp.length>0 && temp.length == com_stream.length)
		{
			com_stream='';
		}
		
		temp = temp.replace(/\n/g,"");
		var str_len = temp.lastIndexOf("|||");
		
		if (str_len > 0)
		{
			var checkarray = new Array();
			var strarray = temp.split('|||');
			for (i=0; i<strarray.length; i++){
	
				if (strarray[i].substr(0,4) == '<br>' || strarray[i].substr(0,4) == '<BR>')
				{
					strarray[i] = strarray[i].substr(4);
				}
				var zuweiser = strarray[i].substr(0,1);
				strarraysplit = strarray[i].split(" ");
				
				if (actual_stream_id < (strarraysplit[1]*1))
				{
				
					/*$('stream_auswertung').innerHTML = strarray[i]+'<br />'+$('stream_auswertung').innerHTML;*/
					actual_stream_id = strarraysplit[1]*1;
		
					if (zuweiser == 'C')
					{
						
						if (opengroups.inArray(strarraysplit[2]))
						{
							eval((strarraysplit[2])+".chat_splitter(strarray[i])");
						}
						
					}
					else if (zuweiser == 'E')
					{
						strarraysplit = strarray[i].split(" ");					
						checkarray[3] = strarray[i].substr(2,1);
			
						UUID = strarraysplit[2]; // User-ID
						MA1 = strarraysplit[11]; // Match1
						MA2 = strarraysplit[12]; // Match2
						MA3 = strarraysplit[13]; // Match3
						MA4 = strarraysplit[14]; // Match4
						MA5 = strarraysplit[15]; // Match5
						SX = strarraysplit[8]; // Geschlecht
						OL = ((checkarray[3] == 'O')?'1':'0'); // Onlinestatus
						UN = strarraysplit[3]; // Username
						IH = strarraysplit[9]; // Bild
						IP = strarraysplit[10]; // Pfad
						ID = strarraysplit[16]; // fortlaufende ID
						TI = strarraysplit[2]; // Timestamp - MSG-ID
						TY = strarraysplit[5]; // Eventtyp
						UID = strarraysplit[2]; // User-ID
						SUID = strarraysplit[4]; // User-ID des Events
						MTY = strarraysplit[6]; // Medientyp
						XID = strarraysplit[7]; // Medienid
						
						Event.ins_us(UUID,MA1,MA2,MA3,MA4,MA5,SX,OL,UN,IH,IP);
						Event.ins_ev(ID,TI,TY,UID,SUID,MTY,XID);
						var this_last_id = Event.ev_ev_ar.length-1;
						var ev_last_id = Event.ev_ne_ar.length;
						//if (UID == 41) alert(ID + '-' + Event.ev_ev_ar[0].ID + '-' + SUID + '-' + UID + '-' + TY);
						if (Event.ev_ev_ar[0].ID != null && ID > Event.ev_ev_ar[0].ID && UID != Event.ev_uid)
						{
							Event.ev_ne_ar[ev_last_id] = (Event.ev_ev_ar[this_last_id]);
							
							if (chk_timeout_4 == 0)
							{
								Event.do_disp_stream();
							}
						}
					}
				}
			}
		}

		controller();
	},5000);
}
controller();

var com_stream = '';
var stream_request = false;

function getComStream(URL,POST)
{
	stream_request = false;
	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		stream_request = new XMLHttpRequest();
		if (stream_request.overrideMimeType)
		{
			stream_request.overrideMimeType('text/xml');
		}
	}

	stream_request.onreadystatechange = setComStreamVars;
	stream_request.open('GET', URL, true);
	stream_request.send(POST);

	/*setTimeout('stream_timeout(URL,POST);', 10000);*/

}

function setComStreamVars()
{
	com_stream = stream_request.responseText;
}

function stream_timeout(URL,POST)
{
	stream_request.abort();
	com_stream = '';
	getComStream(URL,POST);
}

function set_stream(URL)
{
	if(window.ActiveXObject)
	{
		$('bb').src=URL+':8005/com_out.html?x='+Math.random();
		//$('bb').src=URL+'/com/com_out.html?x='+Math.random();
	}
	else
	{
		getComStream(URL+'/com/com_out.html','x='+Math.random());
	}
}

addunLoadEvent(function()
{
	window.clearTimeout(verteiler_timeout);
	if (chk_timeout_1 == 1) window.clearTimeout(event_timeout_1);
	if (chk_timeout_2 == 1) window.clearTimeout(event_timeout_2);
	if (chk_timeout_3 == 1) window.clearTimeout(event_timeout_3);
	if (chk_timeout_4 == 1) window.clearTimeout(event_timeout_4);
	if (chk_timeout_5 == 1) window.clearTimeout(event_timeout_5);
	
});

function chk(g)
{
	if (!opengroups.inArray(g))
	{
		//if (eval('!'+g)) eval(g + " = window.open('','"+g+"','width=345,height=308,status=0')");
		opengroups.push(g);
		eval(g + " = window.open('','"+g+"','width=345,height=308,status=0')");
	}
}

function unchk(g)
{
	if (opengroups.inArray(g))
	{
		opengroups = new Array();
	}
}

function o2o_chat_popup(s,d,m)
{
	g = 'o2o_'+s+'_'+d;
	gpop = 'o2o-'+s+'-'+d;
	eval(g + " = window.open('"+PPATH+"co2opopup_redirect.html?CON="+gpop+((m==1)?'&REVERSE='+s:'&DEST='+d)+"','"+g+"','width=345,height=308,status=0')");
	chk(g);
	eval(g + ".focus()");
	return false;
}

function o2o_del(evu_uid,evu_duid,mode)
{
	new ajax (PAJAX+'o2o_chat_del.html', {postBody: 'EVU_UID='+evu_uid+'&EVU_DUID='+evu_duid+'&MODE='+mode,onComplete: function(){new ajax(PAJAX+'o2ochat_list.html', {postBody:'',update: 'o2ochat',onComplete: function(){o2o_chat_status();}})}});
}

function o2o_denied(evu_uid,mode)
{
	new ajax (PAJAX+'o2o_chat_denied.html', {postBody: 'EVU_UID='+evu_uid+'&MODE='+mode,onComplete: function(){}});
}

function o2o_chat_status()
{
	new ajax (PAJAX+'o2o_chat_status.html', {postBody: '',update: 'headline_o2ochat_'});
}

o2o_chat_status();


function randomcode ()
{
	var code='<!--_UNAME-->';
	var str='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	for (x=0;x<20;x++)
	{
		code += str.charAt (Math.round (Math.random ()*1000)%36);
	}
	return code;
}

function memdel(inp)
{
	new ajax(PAJAX+'mem_del.html', {postBody:'xid='+inp,update: 'memorypoints'});
}

function thisMovie(movieName)
{
	// IE and Netscape refer to the movie object differently.
	// This function returns the appropriate syntax depending on the browser.
	if (navigator.appName.indexOf ("Microsoft") !=-1) 
	{
		return window[movieName]
	}
	else 
	{
		return document[movieName]
	}
}

function set_el_def(bn,onoff)
{
	if(onoff==0)
	{
		var_ev_last&=~bn;
	}
	else
	{
		var_ev_last|=bn;
	}
	new ajax (PAJAX+'setvar.html', {postBody: 'VN=_VAR_LASTEV&TYP=0&VAL='+var_ev_last});
}

