function bindGiftForm() {
    $('#email_form').ajaxForm({
        target: '#InnerModal'
    });
}

$(document).ready(function(){
	// TOOLTIPS
    $('.toggleTooltip').hover( function() { 
        $(this).parent().children(".tooltipWrapper").show();
    }, function() {
        $(this).parent().children(".tooltipWrapper").hide();  
    });

	// FLASH MESSAGE
    if ($('.flash').length != 0) {
        message = $('.flash').html();
        $('body').append('<div id="Flash">' + message + ' <a href="#" class="closeFlash">close</a></div>');
        $('.closeFlash').click(function() {
            $(this).parent().fadeOut(500);
            return false;
        });
        $('#Flash').animate({
            bottom: '+=35'
            }, 2000);
    }
    
	// update URL for Edit Author if selection changes
	$('#Login').click(function() {
	    $('#LoginForm').toggle();
		return false;
	});

    $('#Menu uli').mouseenter( function () {
            $('.subMenu').hide();
            id = '#' + $(this).attr('rel');
            $(id).show();
        });
	$('.addLoader').click(function() {
        $(this).parent().append('<img class="loader" src="/static/images/loading.gif" />');
	});

    //Submit form AJAX loader
    $("form.ajaxLoader").submit(function() {
        $('body').append($('<div id="LoaderOverlay"></div>'));
        $('#LoaderOverlay').fadeTo(100, 0.4);  
    });

    $('a.gift').click(function(e) {
        e.preventDefault();
        $.vodomodal(610, 430, $(this).attr('href'), function() {
        });
    });

    $('#email_form').live('submit', function(e) {
        e.preventDefault();
        var data = $(this).serialize();
        var url = '/ppv/send_email';
        $.post(url, data, function(data) {
          $('#InnerModal').html(data);
        });
    });

});


