//var r
$(document).ready(function(){
//	$('.pun').append('<div id="rcontainer" class="blockform" style="display:none;position:absolute;width:40px;height:40px;overflow:hidden"><h2><span></span></h2><div class="box"><textarea id="repedit" class="infieldset" style="width:334px; height:200px;margin:0 auto;"></textarea><input type=button value="ok" onclick="updaterep()" id="updaterep"> <input type=button onclick="cancelrep()" value="cancel" id="notok"></div></div>')
	$('.arep a').click(function(){
		$('#icnt').empty().append(helper.modal.txt+helper.modal.btnok+helper.modal.btncan);
		$('#updaterep').click(updaterep);
		$('#ibtncan').click(helper.modal.cancel);
		helper.unserialize(this.href);
		if(typeof(helper.r.method)=='undefined')return true;
		u=$('#p'+helper.r.pid+' dt a').text();
		if(helper.r.method==2){$('#rcontainer h2 span').text(titleminus+' '+u)}
		else{$('#rcontainer h2 span').text(titleplus+' '+u)}
		s=$(this).offset()
		if(self.pageYOffset){y=self.pageYOffset}else if(document.documentElement && document.documentElement.scrollTop){y=document.documentElement.scrollTop}else if(document.body){y=document.body.scrollTop}
		$('#rcontainer').css({left:s.left,top:s.top,opacity:0}).show().animate({left:s.left+100,top:s.top,opacity:0.4},{duration:100,complete:function(){o=s.top-y;w=$(window).height();if(o+145>w){t=s.top-((o+145)-w)-104}else if(o<99){t=s.top-(o)+2}else{t=s.top-100}$(this).animate({left:s.left+20,width:340,height:290,top:t,opacity:1},{duration:100})}})
		return false
	});

})
function updaterep(){
	helper.r.message=$('#repedit').attr('value');
	if(helper.r.message=='')return false;
	$.ajax({type:'post',url:'ajax.server.php',data:helper.r,dataType:'xml',success:
		function(x){
			e=$('error',x).text();de=$('dberror',x).text();helper.modal.cancel();
			if (e)
				alert(e)
			else if (de)
				alert(de)
			else
				$('.u'+$('userid',x).text()).text($('plus',x).text()+' | '+$('minus', x).text())
			return false;
		}	
	})
}
//function cancelrep(){$('#rcontainer').hide().css({width:60,height:60});$('#repedit').attr({'value':''})}
//function unserialize(p){p=p.substring(p.indexOf('?')+1,p.length);p=p.split('&');var r=new Object;for(i in p){s=p[i].split('=');r[s[0]]=s[1];}return r;}