$(function () {
    $('#content .data .search input[type=text]').example();
    $('#content .menu a.more').click(function () {
        if ( ( ! $(this).is('.active') ) && $('#content .menu a.more.active').length > 0 ) $('#content .menu a.more.active').click();
        var ul = $(this).parent().find('ul.more');

        if ( ! $(this).is('.active') ) {
            $(this).addClass('active').find('span').html('Menos');

            var height = ul.stop().show().data('oHeight') ? ul.data('oHeight') : ul.data('oHeight', ul.height()).data('oHeight');

            ul.css('height', 0).animate({'height': height});
        } else {
            $(this).removeClass('active').find('span').html('Mais');
            ul.stop().animate({'height': 0}, function () { $(this).attr('style', '').hide(); });
        }
    });
    $('#content .slideshow ul li').each(function () {
        if ( $(this).is(':first') ) $(this).parent().show();

        var legend = $(this).find('.legend');
        legend.css('margin-top', -legend.outerHeight());

        if ( ! $(this).is(':first') ) $(this).hide();
    });
    $('#content .thumbLine .legend').each(function () {
        $(this).css('margin-top', -$(this).outerHeight());
    });
    if ( $().easySlider ) $("#content .slideshow").easySlider({
        auto: true,
        continuous: true,
        pause: 3000
    });
    $('#content .data .specialDates .container.right a.month').click(function () {
        if ( $(this).is('.selected') ) return;

        $(this).parent().find('.selected').removeClass('selected');
        $(this).parent().parent().find('.left .month:visible').fadeOut();

        $(this).parent().parent().find('.left [class="'+$(this).attr('class')+'"]').fadeIn();
        $(this).addClass('selected');
    });
    if ( $('#content .data .specialDates .container.right a.month').length > 0 ) {
        var month = new Date();
        $($('#content .data .specialDates .container.right a.month').get(parseInt(month.getMonth()))).click();
    }
    $('#content .data .internalContent .demais .block').each(function () {
        $(this).find('h3:first').addClass('first');
    });
});



$(document).ready(function() {
	$("span.twitter,span.facebook,span.orkut").click(function() {
		var titulo = $(this).prevAll("h3:first").text();
		var texto = $.trim($(this).nextAll('p:first').text());
		var onde = $(this).html();
		var str = window.location.pathname;
		var pagina = str;
		//var pagina = str.slice(str.lastIndexOf("/")+1);

		var url='';
		switch (onde){
			case 'twitter':
				url='http://twitter.com/?status='+encodeURIComponent(texto.substring(0,117))+'... http://www.mensagenscomamor.com'+pagina;
				break;
			case 'orkut':
				url='http://promote.orkut.com/preview?nt=orkut.com&tt='+encodeURIComponent(titulo)+'&du=http://www.mensagenscomamor.com'+pagina+'&cn='+encodeURIComponent(texto.substring(0,120)+'...');
				break;
			case 'facebook':
				url='http://www.facebook.com/sharer.php?u=http://www.mensagenscomamor.com'+pagina+'&t='+encodeURIComponent(texto);
				break;
		}
		window.open(url,'_blank');
		//alert(titulo+" ## "+texto+" ## "+onde);
		return false;
	});
});


