$(document).ready(function() { 
    $('#submit').click(function() { 
        $.ajax({
            type: "POST",
            url: "bin/sendemail.php",
            data: $('#tellmemore').serialize(),
            success: function() {
                alert("Thank you!  A representative will be contacting you shortly.");
                $("form")[0].reset();
            }
        }); 
        return false;
    });

    $('#slideshow').cycle({
        fx: 'fade'
    });

    $('#machine-slideshow').cycle({
        fx: 'fade'
    });

    $('#reset').click(function() {
        $("form")[0].reset();
        return false;
    });

    $('.inner-container').ready(function() {
        var $child_containers = $('.inner-container > div').get();
        for (div_index in $child_containers) {
            var drawer = $child_containers[div_index];
            var drawer_content = $(drawer).children('.content');
            var drawer_status = $(drawer).children('.header').children('.drawer-status')
            if ($(drawer_status).text() == "+") {
                $(drawer_content).hide()
            }
        }
    });

    $('.inner-container > div > .header').click(function() {
        show_drawer = $(this).parent('div');
        var $child_containers = $('.inner-container > div').get();
        for (div_index in $child_containers) {
            var drawer = $child_containers[div_index];
            var drawer_status = $(drawer).children('.header').children('.drawer-status')
            if ($(drawer).attr('id') == $(show_drawer).attr('id')) {
                $(drawer_status).html('&ndash;');
                $(drawer).children('.content').show('fast');
            } else {
                $(drawer_status).html('+');
                $(drawer).children('.content').hide('fast');
            }
        }
        return false;
    });

}); 
