function bookmark(str) {

	var url = "http://modtissimo.com/"; // url of the site
	var title = "Modtissimo"; // title/description

	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if (window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href', url);
		elem.setAttribute('title', title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	} else if (document.all)// ie
		window.external.AddFavorite(url, title);
	else
		alert(str);
}

function fbs_click() {
	u = location.href;
	t = document.title;
	window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u)
			+ '&t=' + encodeURIComponent(t), 'sharer',
			'toolbar=0,status=0,width=626,height=436');
	return false;
}
function show_hide(element) {
	$('#'+element).toggle("slow");	
	if (element=='cat_online')
		borderParent(element);
}
function borderParent(element) {
//	$('#'+element).parents("fieldset").css("border","0px groove threedface")
	$('#'+element).parents("fieldset").toggleClass("fieldselected");
}
$(document).ready(function(){
	var divw=0;
	var maxheight=0;
	$('.destaque').each(function() {
	      divw=divw+($(this).width())+20;
	});

	$('#scrollbar2 .areaDestaques').width(divw);
	//Example 2
	var oScroll2 = $('#scrollbar2');
	if(oScroll2.length > 0){
		oScroll2.tinyscrollbar({ axis: 'x' });
	}
	
	$("#lupa").click(function() {
        $(".pesquisaInput").toggle();
        $(".pesquisaInput input:first").focus();
	});
	$("#menu").click(function() {
		$("#menuDropDown").toggle();
	});
	$("#login").click(function() {
       	$("#loginDropDown").toggle();
	});

	backgroundimg();  
	
	$('.lerMais').each(function() {
		 if (($(this).offset().top)>maxheight){
	      	maxheight=($(this).offset().top);
		 }
	});
	
	$('.lerMais').each(function() {
		$(this).offset({top:maxheight});
	});
	
});
function backgroundimg() {    
	$("#mainImage img").first().appendTo('#mainImage').fadeOut(5000);
	$("#mainImage img").first().fadeIn(3000);
	setTimeout(backgroundimg, 10000);
}
//Funções Newsletter
function updateTextArea() {         
	var allVals = [];
    $('[name=check]').each(function() {
      allVals.push($(this).val());
    });
    $('#t').val(allVals)
    return allVals;
    } $(function() {
    $('#news_grupos input').click(updateTextArea);   updateTextArea(); });

function valida_e_insere(){
    var checked = updateTextArea();
    if ( $('[name=nome]').val() != "Nome:" && $('[name=nome]').val() != "" && $('[name=email]').val() != "E-mail:" && $('[name=email]').val() != "" )
    	window.location="/newsletter/?email="+$('[name=email]').val();        
}

