jQuery.fn.exists = function(){return jQuery(this).length>0;}

function bodyHeight(){
	var winHeight = $(window).height();	
	$('#body, .gallery-attachment').css({
		'height': 	(winHeight)
	})
}

function resizer() {
	bodyHeight()
}

function winResizeUpdate(){
	clearTimeout(timer);
	timer = setTimeout('resizer()', 300);
}

//var timer = setTimeout(null, 0);
//$(window).resize(winResizeUpdate);



$(document).ready(function() {
	bodyHeight();
	
	if($('#clipping-scroller').exists()){
		$('#clipping-scroller').tinyscrollbar({sizethumb: 40});
	}
});


$(function() {
	//SLIDESHOW
	$('#slideshow').cycle({ 
		fx:     'fade',
		delay: 	-5000, 
		next:   '#slide-next', 
		prev:   '#slide-prev' 
	});
	
	
	
	$('#slideshow-home') 
	.before('<div id="slideshow-nav">') 
	.cycle({ 
		fx:     'fade', 
		delay: 	-4000,
		speed: 	300,
		pager:  '#slideshow-nav' 
	});
	
	
	//ADICIONA CLASSES AO PAGINADOR DO SLIDESHOW
	
	
	
	//APARENCIA DO MENU
	$(".menu-item a").prepend("<span>.</span>");
	$(".menu-item li a span").remove();
	
	
	//LISTAGEM DE CLIPPING
	$('ul.lista-clipping li').hover(function() {
	  $(this).addClass('hover');
	  $(this).fadeTo('fast', .8);
	}, function() {
	  $(this).removeClass('hover');
	  $(this).fadeTo('fast', 1);
	});

});

