// HOVERS
$(document).ready(function(){
	$("div.small-posts ul.rating").hover(function(event){
		$(this).addClass("rating-hover");
   	},function(){
		$(this).removeClass("rating-hover");
	});
	$(".search li input.search-btn").hover(function(event){
		$(this).addClass("search-btn-hover");
	},function(){
		$(this).removeClass("search-btn-hover");
	});
	$(".right-column .search .input-text").focus(function(event){
		if ($(this).val() == 'whatcha looking for?') {
			$(this).attr({value: ''});
			$(this).addClass("orange");
		}
	});
	$("div.big-vote-now").hover(function(event){
		$(this).addClass("big-vote-now2");
	},function(){
		$(this).removeClass("big-vote-now2");
	});
	$("input.comment-submit").hover(function(event){
		$(this).addClass("comment-submit-hover");
	},function(){
		$(this).removeClass("comment-submit-hover");
	});
	$(".banner-g").hover(function(event){
		$(this).addClass("banner-g-hover");
	},function(){
		$(this).removeClass("banner-g-hover");
	});
});

// AJAX VOTE
$(document).ready(function(){
	$('.star').rating({
		callback: function(value, link){
			var eid = this.name.substr(7);
			jQuery.ajax({
			    url: '/ajax.php?function=vote',
			    type: 'get',
			    cache: false,
			    dataType: 'html',
			    data: 'eid='+eid+'&vote='+value,
			    error: function(){
			        alert('Communication error! Try refreshing the page.');
			    },
			    success: function(response){
			    	if (response != 'error') {
			        	$('#votetq-'+eid).html('Thank you!');
			        	$('#votes-'+eid).html(response);
			    	}
			    }
			});
		}
	});
});
