function changeLikeBtn(p_this,p_website_url,p_rootdir,p_link_id,p_vote_hidden_id){
	if(document.getElementById(p_vote_hidden_id).value==0){
		//alert(p_website_url+', '+p_rootdir+', '+p_link_id+', '+p_vote_hidden_id);
		p_this.innerHTML = '<iframe src="'+p_rootdir+'link_header/iface.php?website_url='+p_website_url+'&link_id='+p_link_id+'" id="proba_frame" frameborder="0"></iframe>';
		document.getElementById(p_vote_hidden_id).value=1;
	}
	//document.getElementById("proba_frame").contentWindow.location.reload(true);
}

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.getElementById('link_down_' + link_id).alt = s;
				document.getElementById('link_down_' + link_id).title = s;
				document.getElementById('link_up_' + link_id).alt = s;
				document.getElementById('link_up_' + link_id).title = s;
				document.getElementById('divdown_' + link_id).style.visibility = "hidden";
				document.getElementById('divup_' + link_id).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);
  }
}
