// PLACEHOLDER
var placeholder = function(selector, value) {
	$(selector).focus(function()
	{
		if ($(this).val() == value) {
			$(this).val('');
		}
	})
	.blur(function()
	{
		if ($(this).val().length == 0) {
			$(this).val(value);
		}
	});
},

runScript = function() {
	$("#twitter").getTwitter({
		userName: "revistadestaque",
		numTweets: 4,
		loaderText: "Loading tweets...",
		slideIn: true,
		slideDuration: 750,
		showHeading: true,
		headingText: "Siga-nos no Twitter",
		showProfileLink: true,
		showTimestamp: true
	});

	if ($('#newsletters').length > 0) {
		placeholder($('#newsNome'), 'seu nome:');
		placeholder($('#newsEmail'), 'e-mail:');
	}

	$("#nav li a").hover(function() {
		$(this).stop(true, false).animate({
			paddingLeft : 60
		}, 250);
	}, function(){
		$(this).stop(true, false).animate({
			paddingLeft : 20
		}, 250);
	});

	// SLIDER
	$('#runCycle')
		.cycle({
			fx:     'fade', 
			speed:  'fast', 
			timeout: 5000
		}
	);

	$('#anuncios div.content')
		.cycle({
			fx:     'fade', 
			speed:  'fast', 
			timeout: 5000,
			after:	function() {
				var height = $(this).height();
				$('#anuncios div.content').height(height);
				$('#anuncios .shadow').height(height+62);
			}
		}
	);

	$("a[rel=homeGroup]").fancybox();
};

$(document).ready(runScript);
