$(document).ready(function() {

    $('.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);
    });

	// Add placeholder support
    $('[placeholder]').focus(function() {
    	  var input = $(this);
    	  if (input.val() == input.attr('placeholder')) {
    	    input.val('');
    	    input.removeClass('placeholder');
    	  }
    	}).blur(function() {
    	  var input = $(this);
    	  if (input.val() == '' || input.val() == input.attr('placeholder')) {
    	    input.addClass('placeholder');
    	    input.val(input.attr('placeholder'));
    	  }
    	}).blur().parents('form').submit(function() {
    	  $(this).find('[placeholder]').each(function() {
    	    var input = $(this);
    	    if (input.val() == input.attr('placeholder')) {
    	      input.val('');
    	    }
    	  })
    	});

    if($.isFunction($.fn.fancybox)) {
        // zoomable images
        $('a.zoomable').fancybox({
            'transitionIn'	:	'elastic',
            'transitionOut'	:	'elastic',
            'speedIn'		:	600,
            'speedOut'		:	200
        });
    }

});

