/* Author: Oliver Chank

*/

jQuery(document).ready(function($) {

	$("#sidebar input[type='text']").each(function() {
		var label = $(this).siblings('label').text();
		$(this).attr("placeholder",label);
		$(this).siblings('label').hide();
	});	

	
	$(".gform_wrapper input[type='text'], .gform_wrapper textarea").each(function() {
		var label = $(this).closest('li').text();
		$(this).attr("placeholder",label);
		$(this).closest('li').children('label').hide();
	});	
	
	$('[placeholder]').focus(function() {
		var input = $(this);
		if (input.val() == input.attr('placeholder')) {
			input.val('');
			input.removeClass('placeholder');
		}
	}).blur(function() {
		var input = $(this);
		if (input.val() == '' || input.val() == input.attr('placeholder')) {
			input.addClass('placeholder');
			input.val(input.attr('placeholder'));
		}
	}).blur();


	$(".post-content a img").each(function() {
		var label = $(this).parent('a').attr('href');
		$(this).parent('a').append('<div class="img-link"><div class="link">' + label + '</div><div class="picto">]');
	});


	// best follow sidebar script
	var $sidebar   = $("#sidebar"),
        $window    = $(window),
        offset     = $sidebar.offset(),
        topPadding = 30;

    $window.scroll(function() {
        if ($window.scrollTop() > offset.top) {
            $sidebar.stop().animate({
                marginTop: $window.scrollTop() - offset.top + topPadding
            }, 300);
        } else {
            $sidebar.stop().animate({
                marginTop: 0
            }, 300);
        }
    });




});























