var addRCnt = addRCnt || 1;
var sRUpDouwn = 0;
var tRID = 0;
jQuery(document).ready(function() {
								
	jQuery('.golos_conteiner').bind("mouseenter",function(){
		jQuery(this).find("a.golos_sum").fadeOut(100);
	}).bind("mouseleave",function(){
		jQuery(this).find("a.golos_sum").fadeIn(1);
	});
	
	jQuery('a.golos_up, a.golos_down').click( function() {
		thisObj = jQuery(this);
		if( thisObj.css("cursor") != "default" ) {
			
			sRUpDouwn = ( strpos(this.className, "up") ? addRCnt : -addRCnt );
			data = this.className.split(' ');
			tRID = data[1];
			
			jQuery('#'+tRID+' a.golos_up, #' + tRID +' a.golos_down').css("cursor","default");
			
			jQuery.get("/igolos.php",{rid:tRID, cnt:sRUpDouwn},function(data){
				if( data == "add" ) {
					golos = jQuery('#'+tRID+' .golos_sum');
					html  = parseInt(golos.html()) + (sRUpDouwn);
					html += "<span class='golos_"+(sRUpDouwn > 0?"up":"down")+"_tchk'>&bull;</span>";		
					golos.html( html ).addClass((sRUpDouwn>0?"golos_sum_up":""));
					
					ch = thisObj.find("span");
					ch.html( parseInt(ch.html()) + addRCnt );
					
					jQuery('div#'+tRID).append("<div class='golos_add'><script>setTimeout(function(){jQuery('div#"+tRID+" .golos_add').fadeOut(500);},10000);</script></div>");
					jQuery('div#'+tRID+' .golos_add').fadeIn(1100);
				}
			});
		}
		return false;
	});
});
