function vote_up(link_id, rootdir){
	//alert(link_id);
	vote(link_id, 10, rootdir);
}

function vote_down(link_id, rootdir){
	//alert(link_id);
	vote(link_id, 0, rootdir);
}

function vote(link_id, value , rootdir) {
  try {
    // Moz supports XMLHttpRequest. IE uses ActiveX. 
    // browser detction is bad. object detection works for any browser
    xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
    xmlhttp.open('GET', rootdir + '_application/provider/link_vote/index.php?link_id=' + link_id + '&value=' + value, false);
		// alert( rootdir + '_application/provider/link_vote/index.php?link_id=' + link_id + '&value=' + value );
		
		// xmlhttp.onreadystatechange=function(){
			// if (xmlhttp.readyState == 4){	//value 4 - meaning the load is complete
				// if (xmlhttp.status==200){	//200 means success, 404 means failure
					//alert('load is success');
					// s=unescape(xmlhttp.responseText);
					// alert( xmlhttp.readyState );
					// alert( xmlhttp.status );
					// alert( 'Az eredmény: ' + s );
				// }
				// else {
					// alert('xmlhttp.readyState: ' + xmlhttp.readyState + ', load failure');
				// }
			// }
		// }
		
		xmlhttp.send(null);
		if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
		  s=unescape(xmlhttp.responseText);
			// alert( xmlhttp.readyState );
			// alert( xmlhttp.status );
			//alert( 'Result: ' + s );
			if( s != 'semmi' ){
				document.getElementsByName(link_id+'_link_down')[0].alt = s;
				document.getElementsByName(link_id+'_link_down')[0].title = s;
				document.getElementsByName(link_id+'_link_up')[0].alt = s;
				document.getElementsByName(link_id+'_link_up')[0].title = s;
				document.getElementsByName(link_id+'_divdown')[0].style.visibility = "hidden";
				document.getElementsByName(link_id+'_divup')[0].style.visibility = "hidden";
				//alert(document.getElementsByName(link_id+'_link')[0].alt + ',' + document.getElementsByName(link_id+'_link')[0].title);
			}
		}
  } catch (e) {
    alert(e.name+': '+e.message);
  }
}