$(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', hideflash: true});
	
	$('#mycarousel').jcarousel({
	 	easing		: 'backin',
    	animation 	: 'slow',
	   	scroll 		: 1
    });
	
	$('input[name=telefone]').mask('(99) 9999-9999', {placeholder:' '});
	
	$('input[type=radio]').rer();
	
	setTimeout(function(){
		$('.jta-tweet-list-item').eq(-1).css({background:'none',marginBottom:0});
	}, 1500);
	
	setTimeout(function(){
		$('.jta-tweet-list-item').eq(-1).css({background:'none',marginBottom:0});
	}, 2500);
	
	setTimeout(function(){
		$('.jta-tweet-list-item').eq(-1).css({background:'none',marginBottom:0});
	}, 3500);
	
	$('#topo li a').each(function(){
		$(this).bind('click', function(){
			$('#topo li a.selected').removeClass('selected');
			$('#iframe').attr('src', $(this).attr('href'));
			$(this).addClass('selected');
			window.location.hash = $(this).attr('rel');
			document.title = 'Glauco Zulo - ' + $(this).attr('title');
			return false;
		});
	})
	
	$('.footer-links li a').each(function(){
		$(this).bind('click', function(){
			parent.updateIframe($(this).attr('rel'));
			return false;
		});
	})
	
});

function updateIframe(rel, url)
{
	var $e = $('#topo li a[rel=' + rel + ']');
	if ($e.length)
	{
		$('#topo li a.selected').removeClass('selected');
		if (typeof(url) === 'undefined')
		{
			url = $e.attr('href');
		}
		$('#iframe').attr('src', url);
		$e.addClass('selected');
		window.location.hash = $e.attr('rel');
		document.title = 'Glauco Zulo - ' + $e.attr('title');
	}
}
