$(function() {

	// Set as default values.  replace when php script displays link items	  
  //document.getElementById("555").innerHTML = '500';
  //document.getElementById("666").innerHTML = '1000';
  
  
  
  
  
	$(".vote_up")
 		.css("cursor","pointer")
 		.attr("title","Up-Vote up to 5 times")
		.click(function() {
		var $vote_up = $(this);
		var link_id = $(this).attr('id'); 

		// Call link_count script where users ab
		$.ajax({
	    url: 'link_count.php',
	    type: 'POST',
	    dataType: 'data',
	    data: "link_id=" + link_id, 
	    timeout: 1000,
	    success: function(data){
				//alert(data);
    		if (data === '1') {

    			
    			var oldValue = document.getElementById(link_id).innerHTML;	
	  			var newVal = parseFloat(oldValue) + 1;
	  			document.getElementById(link_id).innerHTML = newVal;		
    			
    			
    		}
	    }
		}); 

	});
  
});