$(document).ready(function(){
    ///Newsletter
   var  dialofNews=$('<div id="newsletter-dialog" title="Newsletter Status"></div>');
    dialofNews.dialog({
        autoOpen: false,
        modal: true,
        resizable: false,
        draggable: false,
        buttons: {
            "OK": function() {
                $( this ).dialog( "close" );
            }
        },
        minHeight: 150
    });

    var options = {
        beforeSubmit: function(formData, jqForm, options) {
            dialofNews.html('Sending Email...').show();
            dialofNews.dialog( "open" );
        },
        success:    function(responseText, statusText, xhr, $form)  {
            var result='';
            dialofNews.dialog( "open" );
            
            if(responseText=='OK'){
                result='Thank you for joining our E-Mail Exclusives mailing list.';
            }
            else{
                result=responseText;
            }
            dialofNews.html(result);
            
            $('.newsletterForm').clearForm();
        }
    };
    // pass options to ajaxForm
    $('.newsletterForm').ajaxForm(options);


    $('#header-menu li').mouseover(function(){
        var menu=$(this).find('div.dropdown-menu');
        if(menu.length==1){
            $('div.dropdown-menu:visible').hide();
            menu.show();
        }
    }).mouseout(function(){
        var menu=$(this).find('div.dropdown-menu').hide();
    });
});




