function MM_openBrWindow(theURL,winName,features){  
 	window.open(theURL,winName,features);
}
function scrollto(anc){  
     target = $(anc);  
     $('html, body').animate({  
         scrollTop: target.offset().top  
     }, 1000);  
};
(function(){var special=$.event.special,uid1='D'+(+new Date()),uid2='D'+(+new Date()+1);special.scrollstart={setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer){clearTimeout(timer)}else{evt.type='scrollstart';$.event.handle.apply(_self,_args)}timer=setTimeout(function(){timer=null},special.scrollstop.latency)};$(this).bind('scroll',handler).data(uid1, handler)},teardown:function(){$(this).unbind('scroll',$(this).data(uid1))}};special.scrollstop={latency:300,setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer){clearTimeout(timer)}timer=setTimeout(function(){timer=null;evt.type='scrollstop';$.event.handle.apply(_self, _args)},special.scrollstop.latency)};$(this).bind('scroll',handler).data(uid2,handler)},teardown:function(){$(this).unbind('scroll',jQuery(this).data(uid2))}}})()
$(function(){
   $('div.top>a').click(function(e){$('html,body').animate({scrollTop:'0px'},800);return false})
   $(window).scroll(function(){if($(this).scrollTop()>100){$('div.top').fadeIn()}else{$('div.top').fadeOut()}})
   init_events();
});
function init_events(){
	$('a.scrolltop').click(function(e){$('html,body').animate({scrollTop:'0px'},800);return false});
}
$(function(){
    $('.item').hover(
        // Over
        function(){
            var $ih = $(this);
            $ih.find('.overlay').stop(true,true).animate({opacity:1}, 400);
        },
        // Out
        function(){
            var $ih = $(this);
            $ih.find('.overlay').stop(true,true).animate({opacity:0}, 400);
        }
    ).find('.overlay').css('opacity',0);
});
$(window).bind('scroll', function () {
    if ($(window).scrollTop() > 150) {
        $('#header').addClass('smaller');
    } else {
        $('#header').removeClass('smaller');
    }
});