function toggle_text( field, text ){
	jQuery( field ).focus( function(){
		if ( jQuery( field ).val() == text )
			jQuery( field).val( '' );
	});
	
	jQuery( field ).blur(function(){
		if ( jQuery.trim( jQuery( field ).val() ) == '' )
			jQuery( field ).val( text );
	});
}

function toggle_type( input_name ) {
	if ( input_name.indexOf( 'ed_' ) >= 0 )
		input_in = input_name.replace( 'ed_', '' );
	else
		input_in = 'ed_' + input_name;

	jQuery( 'input[name="' + input_name + '"]' ).css( 'display', 'none' );
	jQuery( 'input[name="' + input_in + '"]' ).css( 'display', 'inline' );
	jQuery( 'input[name="' + input_in + '"]' ).focus();
	
	jQuery( 'input[name="' + input_in + '"]' ).blur( function(){
		if ( jQuery(this).val() == '' ) {
			jQuery(this).val( '' );
			jQuery( 'input[name="' + input_name + '"]' ).css( 'display', 'inline' );
			jQuery( 'input[name="' + input_in + '"]' ).css( 'display', 'none' );
		}	
	});
}

var url_ajax = 'http://www.escoladinheiro.com/wp-admin/admin-ajax.php';
// var url_ajax = 'http://localhost/escola-dinheiro/wp-admin/admin-ajax.php';
	
jQuery(document).ready(function($) {
	toggle_text( '.newsletter input[name="email"]', 'Assinar conteúdos Escola Dinheiro' );
	
	$( 'a[rel="nofollow"], .net a, #bt-schools a, .extern' ).attr( 'target', '_blank' );
	
	$( '.gotop' ).click( function() {
		$( 'html, body' ).animate({ scrollTop: $( '.header' ).offset().top }, 2000 );
	});	
	
	jQuery(document).data( 'tt', toggle_text );
	
	$( '.like' ).html( '<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fescoladinheiro&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>' );
	$( '.fans-avatar' ).html( '<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fescoladinheiro&amp;width=420&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:420px; height:258px;" allowTransparency="true"></iframe>' );
	
	$( '.lightbox' ).fancybox();
	$( '.clearbox' ).fancybox({
		'padding': 0,
		'margin': 0
	});
	$( 'a img' ).parent().css( 'border', '0' );
	
	if ( parseInt( $(window).width() ) >= 1200 )
		$( '.body-content' ).css( 'min-width', '1200px' );
});
