jQuery(document).ready(function($) {

    if(window.location.hash) {
        if($(window.location.hash).hasClass('tabbedContent')) {
            var target = $(window.location.hash).parent().offset();
        } else {
            var target = $(window.location.hash).offset();
        }
        if (target != null){
	        $('html,body').animate({'scrollTop': target.top - 20}, 500);        
        }
    }
	
    $('.tipdownContent').hide(); // hide all tipdown content blocks
    $('.tipdownTrigger').live('click', function(e) {
        e.preventDefault();
        var target = '#' + $(this).attr('target');
        $(target).toggle();
    });

    $('.hastooltip').live('mouseenter', function() {
        $(this).children('.tooltip').fadeIn(300); 
    });
    $('.hastooltip').live('mouseleave', function() {
        $(this).children('.tooltip').fadeOut(50); 
    });

    $('.notice a.close, .error a.close').live('click', function(e) {
        e.preventDefault();
        $(this).parent('div').fadeOut(500);
    });

    if(jQuery.isFunction($.fn.fancybox)) {
        // zoomable images
        $('a.zoomable').fancybox({
            'transitionIn'	:	'elastic',
            'transitionOut'	:	'elastic',
            'speedIn'		:	600, 
            'speedOut'		:	200     
        });
    }
    
    
    $('.box-info').mouseenter(function(){
    	boxExplain = $(this).find('.box-explain');
    	boxExplain.fadeIn('fast');
    }).mouseleave(function(){
    	boxExplain.fadeOut('fast');
    });

});

