var xmlhttp;
var divID;

function GetXmlHttpObject() {
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------szavazás
function newVote(id,point) {
	var rb=document.getElementById("votein");
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		rb.innerHTML="A böngésződ nem alkalmas szavazásra, sajnos.";
	return;
	}
	var url="vote.php";
	var votevars="id="+id+"&point="+point;
	divID=id
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("POST",url,true);
	//Send the proper header information along with the request
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
	xmlhttp.setRequestHeader("Content-length", votevars.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(votevars);
}

function stateChanged() {
	if (xmlhttp.readyState==4 && xmlhttp.status == 200) {
		var rb=document.getElementById("votediv_"+divID);
		var vb=document.getElementById("voteonsize_"+divID);
		//var retArr=xmlhttp.responseText.split("¤");
		var votes=xmlhttp.responseText.split("¤")[0];
		var atlagnum=xmlhttp.responseText.split("¤")[1];
		var atlag=xmlhttp.responseText.split("¤")[2];
		//rb.innerHTML=count($votes)." szavazat alapján: ".$atlagnum." pont";
		rb.innerHTML = "<span style='font-weight:bold; font-size:12px'> "+atlagnum+"</span> / "+votes+" szavazat";
		vb.style.width=atlag+"px";
	}
}


//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------keresés
function searchtxt() {
	var sstring;
	var rb=document.getElementById("searchpanel");
	var si=document.getElementById("searchinput");
	sstring=si.value;
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		rb.innerHTML="A böngésződ nem támogatja a keresési funkciót ezen az oldalon, sajnos.";
	return;
	}
	var url="search.php";
	var searchvars="sstring="+sstring;
	xmlhttp.onreadystatechange=searchResult;
	xmlhttp.open("POST",url,true);
	//Send the proper header information along with the request
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
	xmlhttp.setRequestHeader("Content-length", searchvars.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(searchvars);
}

function searchResult() {
	if (xmlhttp.readyState==4 && xmlhttp.status == 200) {
		var rb=document.getElementById("lista");
		var listContent=xmlhttp.responseText;
		rb.innerHTML = listContent;
	}
}

//---------------------------------------------------------------------------------------------------------------------------------------home mouseOver change
function homeOver(id) {
	document.getElementById("box_"+id).style.visibility = "visible";
	document.getElementById("box_"+id).style.cursor='pointer';	
}
function homeOut(id) {
	document.getElementById("box_"+id).style.visibility = "hidden";	
}



	
	
	
	
	
	
	
	
	

