// Author: Desquared - thinkdesquared.com

$(document).ready(function() {


	// Image Linking to article the W3 proper way
	$("div.entry img.thumbnail").css("cursor", "pointer");
	$("div.entry img.thumbnail").hover(
		function() {
			$(this).parent().find(".title a").addClass("hover");
		} ,
		function() {
			$(this).parent().find(".title a").removeClass("hover");
	});
	$("div.entry img.thumbnail").click(
		function() {
			var link = $(this).parent().find(".title a").attr('href');
			window.location = link;
	});


	// Main Menu effects
	$(function () {
		$('#navigation li')
			.removeClass('no-js')
			.find('a')
			.append('<span class="hover" />').each(function () {
				var $span = $('> span.hover', this).css('opacity', 0);
				$(this).hover(function (){
					$span.stop().fadeTo(300, 1);
				}, function () {
					$span.stop().fadeTo(600, 0);
				});
			});
	});


	// Come On in effects
	$(function () {
		$('a.come-in')
			.removeClass('no-js')
			.append('<span class="hover" />').each(function () {
				var $span = $('> span.hover', this).css('opacity', 0);
				$(this).hover(function (){
					$span.stop().fadeTo(150, 1);
				}, function () {
					$span.stop().fadeTo(450, 0);
				});
			});
	});


	// Voting effects
	$(function () {
		$('a.wk_vote')
			.append('<span class="hover" />').each(function () {
				var $span = $('> span.hover', this).css('opacity', 0);
				$(this).hover(function (){
					$span.stop().fadeTo(250, 1);
				}, function () {
					$span.stop().fadeTo(500, 0);
				});
			});
	});
	
	$("body.add-text textarea#post_content").click(function(){
		var text = $(this).text();
		if(text == 'Στη βιδώνει να εκφράζεσαι γράφοντας; Γράψε το κείμενό σου εδώ'){
			$(this).text('');
		}
	});
	
});
