/*
	Javascript file for Veodesign
	(C) 2011 Veodesign 
	http: //veodesign.com
*/

$(document).ready(function($){  
	
	// fade in/out Portfolio
	$('.work .box').mouseenter(function() {
		$(this).children('.innerBox').stop(true,true).fadeIn();
	}).mouseleave(function() {
		$(this).children('.innerBox').stop(true,true).fadeOut();
	});
	
		
	// Fancybox
	$('a[id^="big-"]').click(function() {
		/* a $(this) holder is needed to work within $.fancybox */
		var _this = $(this);
		
		$.fancybox({
			'href':_this.attr('href')
		})
		_this.closest('.innerBox').mouseleave();
		
		return false;
	});
	
	// Toggle Author info
	$('#the-author').mouseover(function() {
		$('.about-quote').fadeToggle('fast','linear');
	}).mouseout(function() {
		$('.about-quote').fadeToggle('fast','linear');
	});
	
	// Leave message
	$('#respond h3').click(function() {
		var c_form = $(this).siblings('form');
		if(c_form.css('display') == 'block') {
			c_form.fadeOut();
		} else {
			c_form.fadeIn();
		}
	});
	
	// AddThis
	$('.addthis_button').mouseover(function() {
		return false;
	}).click(function() {
		$(this).click();
	});
	
	// hover in archives
	$('.archive .hentry h3 a').mouseover(function() {
		var thumb_img = $(this).parent().parent().children('.wp-post-image').fadeIn();
	}).mouseout(function() {
		var thumb_img = $(this).parent().parent().children('.wp-post-image').fadeOut();
	});
	
	// category menu
	$('#category-navigation ul li').mouseenter(function() {
		$(this).stop(true,true).animate({ left: '0px' });
	}).mouseleave(function() {
		$(this).stop(true,false).animate({ left: '102px' });	
	});
	
	/* Contact Form routines */
		/*var field_names = [ "author", "email", "url", "comment" ];
		var field_txten = [ "Your name", "Your email", "Your website", "Your comment..." ];
		var field_txtfr = [ "Votre nom", "Votre email", "Votre site web", "Votre commentaire..." ];
		
		jQuery.each(field_names,function() {
			
			$(this).attr('value','');
		});*/
	/* */
	
	$('#author').focus(function() {
		if($(this).val() == 'Your name' || $(this).val() == 'Votre nom') {
			$(this).attr('value','');
		}
	}).blur(function() {
		if($(this).val() == '') {
			if( $(this).hasClass('lang-en') ) {
				$(this).attr('value','Your name');
			}
			else if( $(this).hasClass('lang-fr') ) {
				$(this).attr('value','Votre nom');
			}
		}
	});
	
	$('#email').focus(function() {
		if($(this).val() == 'Your email' || $(this).val() == 'Votre email') {
			$(this).attr('value','');
		}
	}).blur(function() {
		if($(this).val() == '') {
			if( $(this).hasClass('lang-en') ) {
				$(this).attr('value','Your email');
			}
			else if( $(this).hasClass('lang-fr') ) {
				$(this).attr('value','Votre email');
			}
		}
	});
	
	$('#url').focus(function() {
		if($(this).val() == 'Your website' || $(this).val() == 'Votre site web') {
			$(this).attr('value','');
		}
	}).blur(function() {
		if($(this).val() == '') {
			if( $(this).hasClass('lang-en') ) {
				$(this).attr('value','Your website');
			}
			else if( $(this).hasClass('lang-fr') ) {
				$(this).attr('value','Votre site web');
			}
		}
	});
	$('#comment').focus(function() {
		if($(this).val() == 'Your comment...' || $(this).val() == 'Votre commentaire...') {
			$(this).attr('value','');
		}
	}).blur(function() {
		if($(this).val() == '') {
			if( $(this).hasClass('lang-en') ) {
				$(this).attr('value','Your comment...');
			}
			else if( $(this).hasClass('lang-fr') ) {
				$(this).attr('value','Votre commentaire...');
			}
		}
	});
	
	$('cite.fn').children('a').attr('target','_blank');
	
	// AddThis Init
	var initAddThis = function() {
		addthis.init();
	};

	initAddThis();
});
