var xmlHttp

function moderateAd(id,flag)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("A böngészője nem támogatja az AJAX-ot!");
  		return;
  	} 
	var url="moderate.php";
	url=url+"?hid="+id+"&modflag="+flag;
	xmlHttp.onreadystatechange=function(){ 
		if (xmlHttp.readyState==4)
		{ 
			document.getElementById("mod"+id).innerHTML=xmlHttp.responseText;
			document.getElementById("mod"+id).className='modinfo mf'+flag;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function toggleModf(id)
{
	var button=document.getElementById('modi'+id);
	var modf=document.getElementById('modf'+id);
	if(modf.style.display=='none') {
		modf.style.display='';
		button.className='mf4';
		document.getElementById('rea'+id).focus();
	} else {
		modf.style.display='none';
		button.className='';
	}
}

function modRequest(id)
{
	var reason=document.getElementById('rea'+id).value;
	if(reason=="") {
		alert("Kérjük adjon meg egy rövid leírást a hibáról!");
		return false;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("A böngészője nem támogatja az AJAX-ot!");
  		return;
  	} 
	var url="modrequest.php";
	url=url+"?hid="+id+"&r="+Base64.encode(reason);
	xmlHttp.onreadystatechange=function(){ 
		if (xmlHttp.readyState==4)
		{
			if (xmlHttp.responseText=='0') window.location.replace(window.location.href);
			else {
				document.getElementById("modreq"+id).innerHTML='';
			}
			hideHelp('modf'+id);
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
  	{
  	// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
  	// Internet Explorer
  		try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  		catch (e)
    		{
    			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    		}
  	}
	return xmlHttp;
}