


var forums_mousedown = false
var forums_mousedown_autodown = 60

var forums_update = 0
var forums_update_speed = { 0:[10,6],
                            3:[20,6],
                            6:[60,4],
                           15:[120,3]
                          }

var forums_running = 0
var forums_update_bit = 0
var forums_q = ''
var forums_updateinterval = null
var forums_idleinterval = null
var forums_idleinterval_interval = 500

var forums_autorefresh_cookie = 'autoupdate';
var forums_threadsperpage_cookie = 'tps';


var forums_postlist_timestamp = 0

var forums_threads_updated = null
var forums_posts_updated = null

var forums_postview = false
var forums_postview_nulledout = false
var forums_threadview = false
var forums_forumview = false

var forums_have_focus = false
var forums_have_mouseover = false
var forums_last_mousemove = false
var forums_last_useraction = new Date().getTime()

var forums_unreadposts = []

var updatelog = ''
var forums_afterload = false

var forums_composing =false
var forums_composing_focus = false

var forums_wideview = false

var forums_posts = new Object();

var forums_postview_previous = false


var forums_upload_maxfiles = 3

var forums_size_title = [1,128]
var forums_size_post  = [1,40096]


var forums_wideview_toggling = true



img_uploading = new Image;
img_uploading.src = 'img/uploading.gif'

function setPostData(id,parentid,branchlevel,html_header,html_post,js_bonuses){
	
	var p 
	
	p = new Object();
	p.id = id
	p.parentid = parentid
	p.branchlevel = branchlevel
	p.html_header = jsdecode(html_header)
	p.html_post = jsdecode(html_post)
	p.js_bonuses = jsdecode(js_bonuses)
	
	forums_posts['p'+id]=p
}

function showHighlight(id,id0){
	var k,p0,p,e
	p0=id0===false?false:forums_posts['p'+id0]
	p1=forums_posts['p'+id]
	
	for(k in forums_posts){
		p = forums_posts[k]
		h=-1 // -1 no change,0-normal,1-rootpost,2-responses to same root post,3-reactions to this post
		
		if (p0){
			if (p.parentid==p0.parentid ||
			    p.id==p0.parentid ||
			    p.parentid==p0.id
			) h=0
		}
		
		if (p.id==p1.parentid) h=1
		if (p.parentid==p1.parentid) h=2
		if (p.parentid==p1.id) h=3
		
		if (h==-1||p.id==id) continue
		e=byId('postlist'+p.id)
		if (e.className=='postlistline_selected' || e.className=='postlistline_unread') continue
		e.className='postlistline_highlight'+h
	}	
	
}



function updateUnreadPostCount(){
	
	var e,c
	e=byId('postlistunreadcount')
	c=forums_unreadposts.length
	if (c==0){hideDiv('postlistunreadcount');return;}
	if (e.style.display!='inline') e.style.display='inline';
	e.innerHTML = c
}

function addUnreadPost(id){
	var i
	for (i=0;i<forums_unreadposts.length;i++) if (id==forums_unreadposts[i]) return
	forums_unreadposts[forums_unreadposts.length]=id
}

function newPost()
{
	forums_composing='p'
	poppageclosecode[0]='forums_composing=false;'
	x=myPopHeader('newpost',t_forums_post[0],0)
	popPage(0,null,400,225,forums_newposthtml,[false,forums_boxpositions[0][0],forums_boxpositions[0][1]],x);	
}


function newThread()
{
	var x
	
	forums_composing='t'
	poppageclosecode[0]='forums_composing=false;'
	x=myPopHeader('newthread',t_forums_post[1],0)
	popPage(0,null,400,260,forums_newthreadhtml,[false,forums_boxpositions[1][0],forums_boxpositions[1][1]],x);	
}




function postNew(formname,url)
{
	
	 var f,title,post,url,i,e,havefiles;
	 
	 if (is_safari){
		 // safari upload bug fix
		 e=byId('poppage0')
		 e.style.overflow='hidden'
		 e.style.height='1px'
				 
		 showDiv('attachblock')
		 showDiv('postblock')
		
	 }
	 f = document.forms[formname];

	 havefiles = false
	 for (i=0;i<forums_upload_maxfiles;i++){
		 e=byName('file'+i)
		 if (e===false) continue
		 if (e.value.length > 0) {havefiles=true;break;}
	 }
	 

	 if (f.elements.posttitle != undefined && (f.elements.posttitle.value.length<forums_size_title[0] || f.elements.posttitle.value.length>forums_size_title[1])) {alert(t_forums_posterrors[0]);return false;}
	 if (f.elements.postbody.value.length<forums_size_post[0] || f.elements.postbody.value.length>forums_size_post[1]) {alert(t_forums_posterrors[1]);return false;}

	 //alert('have'+havefiles);
	 
	 if (havefiles){
		 
		 if (!is_safari) hideDiv('poppage0');
		 
		 popPage(9,null,150,40,'<img src="img/uploading.gif" border="0" />',[false,false],false);
		 
		 f.action='?'
		 f.elements.replyto.value = forums_postview
		
		 return true
	 }
	 
	 f.action=''
	 
	 url='?'
	 
	 title=''
	 if (f.elements.posttitle != undefined) title=f.elements.posttitle.value
	 
	 post = 'form_id='+encodeURIComponent(formname)+'&postbody='+encodeURIComponent(f.elements.postbody.value)+'&posttitle='+encodeURIComponent(title)
	 if (forums_postview != false) post += '&replyto='+encodeURIComponent(forums_postview)
	 
	 post += getForumState();
	 
	 byId('postsubmitbutton').disabled=true
	 
	 ajaxRequest('POST',url,post);
	 
	 return false
}




function formatUpdateTime(x)
{
	var d,x;
	var now = new Date();
	
	d = (now.getTime() - x)/1000
	
	// d = d-d%5
	
	if (d < 60)
	{
		return d.toFixed(0)+t_forums_updatetime[0];
	}
	else
	if (d < 3600)
	{
		d /= 60
		return d.toFixed(0)+t_forums_updatetime[1];
	}
	
	return t_forums_updatetime[2];
}


function preloadimages(){
	// bonus images
}

function forumsLoad()
{
	var updatebutton
	
	// ie fix
	fixIE();
	
	
	autosize();

	preloadimages();
	
	ajaxInitBusyIcon('img/ajaxbusy3_2.gif');
	
	updatebutton = document.getElementById('UpdateButton');
	
	
	if (updatebutton !== null)
	{
		if (get_cookie(forums_autorefresh_cookie)=='0') 
			StopForums();
		else
			StartForums();
	}
	
	
	forumsBoxPositionsLoad();
	mouse_mousemoved = forumsMouseMove
	
	forums_idleinterval	= window.setInterval("idleInterval();",forums_idleinterval_interval);
	
	if (forums_afterload != false) eval(forums_afterload+'();')
	
}

function idleInterval()
{
	var x;
			
	dynamicUpdateSpeed();
	
	
	// 
	if (forums_threads_updated != null) div ('threadupdated',formatUpdateTime(forums_threads_updated))
	if (forums_posts_updated != null) div ('postsupdated',formatUpdateTime(forums_posts_updated))
	
	if (forums_mousedown != false)
	{
		
		x = (new Date()).getTime() - forums_mousedown
		x/=1000
		
		if (x>forums_mousedown_autodown)
		{
			forums_mousedown = false
			forums_control_down = false
		}
		
	}
	
	dostatusbar();
}

function StartForums()
{
	var now
	
	if (byId('UpdateButton')==null) return
	
	document.getElementById('UpdateButton').value = t_forums_autorefreshbutton[0];
	
	if (forums_updateinterval != null) return
	
	forums_update_bit = 0
	
	forums_updateinterval = window.setInterval ("autoRefreshForums();",forums_update_speed[forums_update][0]*1000);
	
	now = new Date();
	expires = new Date(now.getTime() + 86400*365*1*1000);
	set_cookie ( forums_autorefresh_cookie, '1', expires, '/', null, null);
	forums_running = 1
}

function StopForums()
{
	var now
	
	if (byId('UpdateButton')==null) return
	
	document.getElementById('UpdateButton').value = t_forums_autorefreshbutton[1];
	if (forums_updateinterval == null) return
	
	window.clearInterval(forums_updateinterval)
	forums_updateinterval = null
	
	now = new Date();
	expires = new Date(now.getTime() + 86400*365*1*1000);
	
	set_cookie ( forums_autorefresh_cookie, '0', expires, '/', null, null);
	forums_running = 0
}


function getForumScrolls()
{
	var x = '&scrolls=';
	
	if (undefined!=(e=document.getElementById('threadlist'))) 
	{
		x+=''+encodeURIComponent(e.scrollTop)
		x+=','+encodeURIComponent(e.scrollLeft)
	} else x+='0,0'
	
	if (undefined!=(e=document.getElementById('postlist')))
	{
		x+=','+encodeURIComponent(e.scrollTop)
		x+=','+encodeURIComponent(e.scrollLeft)
	} else x+=',0,0'
	
	if (undefined!=(e=document.getElementsByName('viewpost')[0]))
	{
		x+=','+encodeURIComponent(e.scrollTop)
		x+=','+encodeURIComponent(e.scrollLeft)
	} else x+=',0,0'

	// ty,tx,ply,plx,py,px
	return x	
	
}


function getForumState() {
	return getForumScrolls () + '&showpost='+encodeURIComponent(forums_postview) + ',' + encodeURIComponent(forums_postview_nulledout?1:0) + '&postlistafter='+encodeURIComponent(forums_postlist_timestamp)
	
	
}

function autoRefreshForums()
{
	if (forums_mousedown != false) return
	
	updateForums(null);
		
}



function updateForums(force)
{
	var e,full,post,bit_max;
	
	forums_update_bit += 1
	bit_max = forums_update_speed[forums_update][1]
	
	//1-postlist
	//2-threadlist
	//4-menu
	
	if (force!=null){
		full=force
	} else {
			
		full = 0
		
		if (forums_threadview != false) full = full | 1
		if (forums_forumview != false && (forums_update_bit % 2) == 1) full = full | 2
		if ((forums_update_bit % bit_max) == bit_max-1) full = full | 4
		
	}	
	
	if (full == 0) return
	
	post = "action=Update&full="+full+getForumState()
	ajaxRequest('POST','?'+forums_q,post);
	
}


function switchAutoRefresh()
{
	if (forums_running)
	{
		StopForums()
	}
	else
	{
		StartForums()
	}
	
	
}



function stickyThread(threadid,x){
	var post
	
	post = 'action=StickyThread&threadid='+encodeURIComponent(threadid)+'&x='+encodeURIComponent(x)+getForumState();
	ajaxRequest('POST','?'+forums_q,post)
}

function deleteThread(threadid,x){
	
	var reason
	
	reason=prompt(t_forums_deletethread[0],'')
	if (reason==null) return
	
	ajaxRequest('POST','?'+forums_q,'action=DeleteThread&threadid='+encodeURIComponent(threadid)+'&x='+encodeURIComponent(x)+'&reason='+encodeURIComponent(reason))	
}

function lockThread(threadid,x){
	ajaxRequest('POST','?'+forums_q,'action=LockThread&threadid='+encodeURIComponent(threadid)+'&x='+encodeURIComponent(x)+getForumState())
}

function reportPost(postid,x){
	var a
	
	a=confirm(t_forums_reportpost[0]);
	if (a!=true) return
	ajaxRequest('POST','?'+forums_q,'action=ReportPost&postid='+encodeURIComponent(postid)+'&x='+encodeURIComponent(x)+getForumState())
}

function deletePost(postid,x){
	var reason
	
	reason=prompt(t_forums_deletepost[0],'')
	if (reason==null) return
	
	ajaxRequest('POST','?'+forums_q,'action=DeletePost&postid='+encodeURIComponent(postid)+'&x='+encodeURIComponent(x)+'&reason='+encodeURIComponent(reason)+getForumState())
}





function setThreadsPerPage(x,q)
{
	var now,expires
	now = new Date();
	expires = new Date(now.getTime() + 86400*365*1*1000);
	set_cookie ( forums_threadsperpage_cookie, x, expires, '/', null, null);	

	forums_q = q	
	location.reload();
}



function changeLayout(x)
{
	var now,expires
	x = parseInt(x)
	now = new Date();
	expires = new Date(now.getTime() + 86400*365*1*1000);
	set_cookie ( 'pl', x, expires)
	location.reload();
	
	
}

function readPost(id){
	
	var i
	for(i=0;i<forums_unreadposts.length;i++){
		if (forums_unreadposts[i]==id){
			forums_unreadposts.splice(i,1)
			return
		}
	}
	
}






function movePost(x){
	var id,id1,p,e,e1
	id = forums_postview
	if (id===false) return
	
	e=byId('postdiv'+id)
	
	if (x==-1) e1=e.previousSibling
		  else e1=e.nextSibling
		  
	if (e1===null) return
	
	id1=String(e1.id).substr(7)
	showPost(id1)
}

function nextUnreadPost(){
	
	var e,id
	if (forums_unreadposts.length==0) return
	id=forums_unreadposts[0]
	
	showPost(id)
}

function changeRootPost(id){
	
	p = forums_posts['p'+id]
	
	if (forums_postview_previous == false)
	{
		if (forums_posts['p'+p.parentid]===undefined) return
		
		showPost(p.parentid)
		forums_postview_previous = id
	}
	else
	{
		showPost(forums_postview_previous)
		forums_postview_previous = false
	}
	
}

function showPost(id,scrollit){
	
	var e,p,id0
	
	
	forums_postview_previous=false
	
	id0=forums_postview
	
	if (forums_posts['p'+id]==undefined) return
	
	p = forums_posts['p'+id]
	
	if (forums_postview != false && false!=(e=divExist('postlist'+forums_postview))){
		e.className = 'postlistline';
	}
	
	forums_postview = id
	
	byId('postlist'+id).className = 'postlistline_selected';
	
	byName('viewpost').innerHTML = p.html_post
	byId('viewpostheader').innerHTML = p.html_header
	if (id0!=id) forums_postview_nulledout=false
	
	eval(p.js_bonuses);
	
	readPost(id)
	updateUnreadPostCount()
	
	showHighlight(id,id0)
	
	if (scrollit==null||scrollit!==false) byId('postdiv'+id).scrollIntoView(false);
	
	
}


function forumsMouseUp(e)
{
	var ds,e,x,y,valid,save
	
	if (mouse_movingdiv!=false){
		
		// save position of newthread & newpost boxes
		ds=docSize()
		e=byId(mouse_movingdiv)
		x=parseInt(e.style.left)
		y=parseInt(e.style.top)
		
		if (x>=0 && y>=0 && x<ds[0]-50 && y<ds[1]-50) valid=true
												else valid=false
		save=false
		if (mouse_movingbox == 'newpost') {save=true;forums_boxpositions[0][0]=x;forums_boxpositions[0][1]=y;}
		if (mouse_movingbox == 'newthread') {save=true;forums_boxpositions[1][0]=x;forums_boxpositions[1][1]=y;}
		if (mouse_movingbox == 'newpm') {save=true;forums_boxpositions[2][0]=x;forums_boxpositions[2][1]=y;}
		
		if (save){
			
			forumsBoxPositionsSave();
			
		}
		
		byId('fadeaway').style.zIndex=2;
		
		showDiv('poppageiframe0')
		showDiv('poppageiframe1')
		
	}
	
	// poppage code
	if (mouse_movingdiv==false){
		bodyMouseUp(0);
	}
	forums_mousedown = false
	mouse_movingdiv=false
	lastuseraction();
	dostatusbar();
	return true
}

function forumsMouseDown(e)
{
	forums_mousedown = new Date();
	lastuseraction();
	dostatusbar();
	
	if (mouse_movingdiv != false){
	  return false
  	}
  
	return true
}



function forumsMouseMove(e){
	
	forums_last_mousemove = (new Date()).getTime();
	lastuseraction();
	
	return true
}


function forumsBlur()
{
	forums_have_focus = false
	
	forums_control_down = false
	forums_mousedown = false
	
	lastuseraction();
	dostatusbar();
}

function forumsFocus()
{
	
	forums_have_focus = true
	
	lastuseraction();
	dostatusbar();
	
}

function forumsMouseOver()
{
	forums_have_mouseover = true
	lastuseraction();
	dostatusbar();
}

function forumsMouseOut()
{
	forums_have_mouseover = false
	dostatusbar();
	lastuseraction();
}


function checkCrawler(){
	
	var x
	
	x = get_cookie('pl');
	if (x==null) return
	
	if (x=='-1'){
		window.location.reload();		
	}
	
	return;
}




function dostatusbar(){	
}



function lastuseraction(){

	forums_last_useraction = (new Date()).getTime();	
}


function bookmarkThread(id,b){
	var post
	
	post="action=BookmarkThread&threadid="+id+'&x='+b+''+getForumState();
	
	ajaxRequest('POST','?'+forums_q,post)	
}


function dynamicUpdateSpeed(){

	var now,last,x,prev

	prev = forums_update
	
	now = (new Date()).getTime();
	
	last = 0
	
	for (x in forums_update_speed){
		if (now/1000-forums_last_useraction/1000 < x*60) break
		last=x
	}
		
	forums_update = last
	
	if (forums_update != prev && forums_running){
		
		// update speed changed, install new interval
		
		if (forums_updateinterval!=null) window.clearInterval(forums_updateinterval)
		forums_updateinterval = window.setInterval ("autoRefreshForums();",forums_update_speed[forums_update][0]*1000);
		forums_update_bit = 0
	}
}



function forumsKeyPress(ev){
	
}


var forums_control_down = false

function forumsKeyDown(ev){
	
	var e,r

	if (ev.altKey===false && ev.ctrlKey===false && ev.keyCode==9 && forums_composing_focus===false && forums_wideview_toggling===true){
		wideview(-1);
		return false
	}
		
	if ((ev.keyCode==224 && navigator.platform.toLowerCase().indexOf('mac')!=-1)
	    ||
	    (ev.keyCode==17 && navigator.platform.toLowerCase().indexOf('win32')!=-1)
	   ) forums_control_down = true
	    
	// MAC send new thread/post
	if (forums_composing!=false && ev.keyCode==13 && forums_control_down)
	{
		e=byId('postform');
		r = e.onsubmit();
		if (r==true) {
			e.submit();
			
		}
		forums_control_down=false
	}
	
	if (forums_composing===false){
		if (ev.keyCode==37 && !ev.ctrlKey) {changeRootPost(forums_postview);return false;}
		if (ev.keyCode==38 && !ev.ctrlKey) {movePost(-1);return false;}
		if (ev.keyCode==40 && !ev.ctrlKey) {movePost(1);return false;}
		
		if (ev.keyCode==39 && !ev.ctrlKey) {nextUnreadPost();return false;}
		
	}	
	return true
	
}

function forumsKeyUp(ev){
	
	if ((ev.keyCode==224 && navigator.platform.toLowerCase().indexOf('mac')!=-1)
	    ||
	    (ev.keyCode==17 && navigator.platform.toLowerCase().indexOf('win32')!=-1)
	   ) forums_control_down = false
	    
}


function forumsResize(){

	autosize();	
}

function autosize(){ 
	
	var ds,dw,dh,u,s,sc,e,ver,pc_width
	ds=docSize();
	dw=ds[0]
	dh=ds[1]
	
	if (dw < 1024) dw=1024
	if (dh < 570) dh=570
	
	ver = 0.01
	
	page_width = dw - 100
	page_height = dh - 70
	page_margin_left = -parseInt(page_width/2)-10
	page_margin_top = -parseInt(page_height/2)-10
	
	if (ds[0]/2+page_margin_left < 0) page_margin_left = -parseInt(ds[0]/2)
	if (ds[1]/2+page_margin_top < 0) page_margin_top = -parseInt(ds[1]/2)
	
	u = page_width - 40
	postcontainer_width = parseInt(0.55*u)
	threadscontainer_width = parseInt(0.45*u)
	container_height = parseInt(page_height-200)
	
	postlist_height = parseInt(0.5*container_height)
	postlistpost_height = container_height-postlist_height-1
	postlist_unreadcount_top = postlist_height+10
	post_height = postlistpost_height-33
	
	s=ver+';'+page_width+';'+page_height+';'+page_margin_left+';'+page_margin_top+';'+postcontainer_width+';'+threadscontainer_width+';'+container_height+';'+postlist_height+';'+postlistpost_height+';'+postlist_unreadcount_top+';'+post_height+';'
	
	sc=get_cookie('layout')
	if (sc==s) return // same layout
	
	e=new Date()
	e.setTime(e.getTime()+86400*30)
	set_cookie('layout',s,e);
	
	// set layout
	
	pc_width = forums_wideview?(postcontainer_width+threadscontainer_width+25):postcontainer_width
	
	setIdStyle('page','width',page_width+'px')
	setIdStyle('page','height',page_height+'px')
	setIdStyle('page','marginLeft',page_margin_left+'px')
	setIdStyle('page','marginTop',page_margin_top+'px')
	
	
	setIdStyle('postlistcontainer','width',pc_width+'px')
	setIdStyle('threadlistcontainer','width',threadscontainer_width+'px')
	
	setIdStyle('threadlistthreads','height',container_height+'px')
	setIdStyle('postlist1','height',container_height+'px')
	setIdStyle('postlist2','height',postlist_height+'px')
	setIdStyle('postlist2post','height',postlistpost_height+'px')
	
	setViewPostWidth(pc_width)
	
	setIdStyle('viewpost','height', post_height+'px')
	
	setIdStyle('viewpostdeleted','height', post_height+'px')
	
	setIdStyle('postlistunreadcount','top',postlist_unreadcount_top+'px')
	
	setIdStyle('memberindexcontainer','width',(postcontainer_width+threadscontainer_width+25)+'px');
	setIdStyle('memberindexcontainer','height',(page_height-120)+'px');

}

function setViewPostWidth(x)
{
	setIdStyle('viewpost','width', x+'px')
	setIdStyle('viewpostdeleted','width', x+'px')
}

	
function bonusVote(bonus){
	
	var url,post
	
	if (forums_postview==false) return
	if (forums_bonusvotes===false) return
	if (forums_bonusvotes===0){
		
		alert(t_bonuses[0]);
		
		return
	}

	if (true!==(r=confirm(t_bonuses[1]))) return;
		
	url = '?'
	
	post="action=BonusVote&postid="+encodeURIComponent(forums_postview)+'&bonus='+encodeURIComponent(bonus)
	post+=getForumState();
	
	 ajaxRequest('POST',url,post);	
	
	
}



forums_postbonuses = [false,false,false,false,false,false,false,false,false]
forums_bonusvotes = false

function postbonusSet(bonus,cntadd){
	
	var cnt,s
	if (forums_postbonuses[bonus]===false) return
	
	cnt = forums_postbonuses[bonus][0]
	cnt += cntadd
	
	byId('bonusimg'+bonus).src='img/bonus'+(cnt?'':'bw')+'/'+bonus+'.gif';
	byId('bonuscnt'+bonus).className='color'+(cnt?(forums_postbonuses[bonus][1]==true?2:1):5);
	byId('bonuscnt'+bonus).innerHTML=(cnt?cnt:'&nbsp')
	
}



function warningPost(postid,x){
	
	if (x==-1){
		
		dialogOpen('warningselect','',['eval','warningPost('+postid+',%value%)']);
		return;
	}
		
	url = '?'
	
	post="action=WarningPost&postid="+encodeURIComponent(postid)+'&x='+encodeURIComponent(x)
	post+=getForumState();
	
	 ajaxRequest('POST',url,post);	
	
}

function moveThread(threadid,x){
	
	if (x===-1){
		
		dialogOpen('movethread','',['eval','moveThread('+threadid+',"%value%")']);
		return;
	}

	url = '?'
	
	post="action=MoveThread&threadid="+encodeURIComponent(threadid)+'&x='+encodeURIComponent(x)
	post+=getForumState();
	
	 ajaxRequest('POST',url,post);	
	
}


function postSwitchWarning(){
	hideDiv('postwarning');
	showDiv('actualpost');
	forums_postview_nulledout=true
}


forums_wideview_basewidth = false

function wideview(force){
	
	var pc,tc,x
	
	if (force==-1)	forums_wideview=!forums_wideview
			   else forums_wideview=force
	
	tc=byId('threadlistcontainer')
	pc=byId('postlistcontainer')
	if (pc===false) return 
	if (forums_wideview_basewidth==false) forums_wideview_basewidth=parseInt(pc.style.width)
	
	switch(forums_wideview){
		
		case true:
			
			x=forums_wideview_basewidth+parseInt(tc.style.width)+25
			tc.style.display='none'
			pc.style.width=x+'px'
			setViewPostWidth(x)
		break;
		
		case false:
			
			tc.style.display='block'
			pc.style.width=(forums_wideview_basewidth)+'px'
			setViewPostWidth(forums_wideview_basewidth)
			
		break;
	}
	
	
	
}


function markAllRead(forumid){
	
	 var post,url;
	 
	 url='?'
	 
	 post='action=MarkAllRead&forumid='+encodeURIComponent(forumid)
	 
	 ajaxRequest('POST',url,post);
	
}



function miLoadOnlineList(x){
	
	 var post,url;
	 
	 url='?'
	 
	 post='action=MemberIndexLoadOnlineList&x='+encodeURIComponent(x)
	 
	 ajaxRequest('POST',url,post);
}



function miLoadNews(x){
	
	 var post,url;
	 
	 url='?'
	 
	 post='action=MemberIndexLoadNews&x='+encodeURIComponent(x)
	 
	 ajaxRequest('POST',url,post);
}


function miNewPoll(id){

	dialogOpen('newpoll','id='+id,['eval','']);
	
}
function miEditLinkOfADay(){

	dialogOpen('linkofaday','',['eval','']);
	
}


function miLoadPoll(id,results){
 	
	 var post,url;
	 url='?'
	 post='action=MemberIndexLoadPoll&id='+id+'&results='+results
	 ajaxRequest('POST',url,post);
}


function miDeletePoll(id,results){
 	
	 var post,url;
	 url='?'
	 x=confirm('Really delete?');
	 if (x!==true) return
	 
	 post='action=MemberIndexDeletePoll&id='+id+'&results='+results
	 ajaxRequest('POST',url,post);
}

function miPollVote(id,vote){
	 var post,url;
	 url='?'
	 post='action=MemberIndexPollVote&id='+id+'&vote='+vote
	 ajaxRequest('POST',url,post);
}


function miDenyBuddy(id){
	 ajaxRequest('POST','?','action=MemberIndexDenyBuddy&friendid='+id);
}
function miAddBuddy(id){
	 ajaxRequest('POST','?','action=MemberIndexAddBuddy&friendid='+encodeURIComponent(id));
}

function miEventRemove(id,did){
	 if (did===null) did=''
	 ajaxRequest('POST','?','action=MemberIndexEventRemove&eventid='+encodeURIComponent(id)+'&divid='+encodeURIComponent(did));
}


function miLoadEvents(){
	 ajaxRequest('POST','?','action=MemberIndexLoadEvents');
}

function miHideEvent(id){hideDiv('myevent'+id);}




