$(document).ready(function() {   
    $('#main_navigation li.dropable').mouseenter(function(){
        $(this).addClass('selected');
        $(this).children('.dropdown').show();        
        $(this).children('.dropdown').stop().animate({
            'opacity': 1,
        }, 500);
    });
    
    $('#main_navigation li.dropable').mouseleave(function(){
        $(this).removeClass('selected');       
        $(this).children('.dropdown').stop().animate({
            'opacity': 0,
        }, 500,function(){
            $(this).hide();
        });         
    });
    
    $('#frmsubscribe-email').attr('value', 'Your email');
    $('#frmsubscribe-email').focus(function(){
        if($(this).attr('value') == 'Your email'){
            $(this).attr('value', '');
        }
    });
    $('#frmsubscribe-email').focusout(function(){
        if($(this).attr('value') == ''){
            $(this).attr('value', 'Your email')
        }
    });
    
    $('#frmsubscribe-send').hide().after('<span id="subscribe_button">').next('span#subscribe_button').text($('#frmsubscribe-send').val()).click(function(){
        $(this).prev('input#frmsubscribe-send').click();
    });
    $('.form input.button').hide().after('<span class="form_button">').next('span.form_button').text($('.form input.button').val()).click(function(){
        $(this).prev('.form input.button').click();
    });     
    
    if($('div.flash').length>0) {
        alert($('.flash').text());
    };
    
    
    if($('#filter').length == 0){
        $('#show_filter').hide();    
    }else{
        $('#frm-filter').hide(); 
        $('#hide_filter').hide();     
    }
    
    $('#show_filter').click(function(){
        $('#frm-filter').show();  
        $(this).hide();
        $('#hide_filter').show();      
    }); 
    $('#hide_filter').click(function(){
        $('#frm-filter').hide();  
        $(this).hide();
        $('#show_filter').show();      
    });         
});


