function commrate(userid, msgid, origin, rate, lng){
	
	document.getElementById('msg' + msgid).bgColor = '#fffcec';
		
	$.post("/ajax/commrate.php", { userid: userid, msgid: msgid, origin: origin, rate: rate, lng: lng }, function(data){
		
		if(data=="del"){
			
			$('#dmsg' + msgid).fadeOut();
			
		}else if(data!="ok"){
			
			alert(data);
			
		}
	 		 		
		document.getElementById('msg' + msgid).bgColor = '#ffffff';
		
	});				
}

function videorate(videoid, rate, lng){
			
	$.post("/ajax/videorate.php", { videoid: videoid, rate: rate, lng: lng }, function(data){
			 		
		if(data!="noch"){document.getElementById('vidr').innerHTML = data;}
		
	});				
}

function loginform(){
	
	//wheight = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight
	
	//wheight = wheight / 2 - 160;
	
	//if(wheight < 0){wheight = 0;}
	
	wheight = 200;
	
	$("#facebox").overlay({
	
		top: wheight,
	
		mask: {
	
			color: '#fff',
	
			loadSpeed: 200,
	
			opacity: 0.5
		},
	
		closeOnClick: false,
	
		load: true
			
	});
	
	document.getElementById('lgn').focus();
}

function postcomment(origin, originid, language){

	if(document.getElementById('cmf').value.length < 5){

		alert("Ââåäèòå áîëåå ñîäåðæàòåëüíîå ñîîáùåíèå.");
		
	}else{

		cont = document.getElementById('cmf').value;

		document.getElementById('cmf').disabled = true;
		document.getElementById('csbm').disabled = true;

		$.post("/ajax/postcomment.php", { content: cont, origin: origin, originid: originid, lng: language },
			function(data){

				document.getElementById('cmf').value = "";
				
				document.getElementById('commentsblock').innerHTML = data;

				document.getElementById('cmf').disabled = false;
				document.getElementById('csbm').disabled = false;

				$('#cshowall').show();
				$('#commentsblockall').hide();
				
		});		
	}	
}


function commentsall(origin, originid, language){
	
	$.post("/ajax/postcomment.php", { origin: origin, originid: originid, lng: language },
		function(data){
			
			document.getElementById('commentsblockall').innerHTML = data;
			$('#cshowall').hide();
			$('#commentsblockall').show();
				
		});		
}	


function getBodyScrollTop(){
	
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
  
}


function showcomments(elemid){
	
	$('#hidecomintro').hide();
	
	document.getElementById(elemid).className = "shnc";
		
	$.post("/ajax/unhide_comments.php");
	
}


function hidecomments(elemid){
	
	$('#hidecomintro').show();
	
	document.getElementById(elemid).className = "hdnc";
		
	$.post("/ajax/unhide_comments.php", { hide: 1 });
	
}


function livehide(sportorgroup, id){
		
	if(sportorgroup=="sport"){
		
		$('#sl' + id).hide('slow');
			
	}else{
			
		$('#g' + id).hide('slow');
				
	}	
	
	$.post("/ajax/livefilter.php", { sportorgroup: sportorgroup, id: id });
	
}


function livereload(language, my){
	
	$('#rl_1').hide();
	$('#rl_2').fadeIn('slow');

	$.post("/ajax/livereload.php", { lng: language, my: my },
		function(data){
			
			document.getElementById('wholelive').innerHTML = data;
			
			auit = 91;
							
		});
}


function getlsdata(id, language){
	
	document.getElementById('lsinfodiv').innerHTML = "";
	
	document.getElementById('lsinfodiv').style.left = tempX + "px";
	document.getElementById('lsinfodiv').style.top = tempY + "px";
	
	$.post("/ajax/getlsdata.php", { id: id, lng: language },
		function(data){
			
			document.getElementById('lsinfodiv').innerHTML = data;
			
			$('#lsinfodiv').show();			
							
		});	
}


function showhiddenlive(type, language){

	document.getElementById('lsinfodiv').innerHTML = "";
	
	document.getElementById('lsinfodiv').style.left = tempX + "px";
	document.getElementById('lsinfodiv').style.top = tempY + "px";
	
	$.post("/ajax/showhiddenlive.php", { type: type, lng: language },
		function(data){
			
			document.getElementById('lsinfodiv').innerHTML = data;
			
			$('#lsinfodiv').show();			
							
		});	
}


function showlsadds(id, language){
	
	document.getElementById('lsinfodiv').innerHTML = "";
		
	document.getElementById('lsinfodiv').style.left = (tempX - 300) + "px";
	document.getElementById('lsinfodiv').style.top = (tempY - 5) + "px";
	
	$.post("/ajax/showlsadds.php", { id: id, lng: language },
		function(data){
			
			document.getElementById('lsinfodiv').innerHTML = data;
			
			$('#lsinfodiv').show();			
							
		});	
}


function addlsmygame(id){
		
	$.post("/ajax/addlsmygame.php", { id: id },
		function(data){
			
			document.getElementById('mgcc').innerHTML = data;
			
			$('#lsinfodiv').fadeOut('slow');
							
		});	
}


function mygameremove(id, language){
		
	$.post("/ajax/mygameremove.php", { lng: language, id: id },
		function(data){
				
			$.post("/ajax/livereload.php", { lng: language, my: 1 },
				function(data){
					
					document.getElementById('wholelive').innerHTML = data;
														
				});							
		});
}

