  $(function() {
    /* set global variable for boxy window */
    var contactBoxy = null;
    /* what to do when click on contact us link */
    $('.contact_us').click(function(){
        var boxy_content;
        boxy_content += "<div style=\"width:450px; height:430px\"><form id=\"feedback\">";
        boxy_content += "<p>Subject<br /><input type=\"text\" name=\"subject\" id=\"subject\" size=\"50\" /></p><p>Your name:<br /><input type=\"text\" name=\"your_name\" size=\"50\" /></p><p>Your email (optional):<br /><input type=\"text\" name=\"your_email\" size=\"50\" /></p><p>Comment:<br /><textarea name=\"comment\" id=\"comment\" cols=\"50\" rows=\"12\"></textarea></p><br /><input type=\"submit\" name=\"submit\" value=\"Leave a reply\" />";
        boxy_content += "</form></div>";
        contactBoxy = new Boxy(boxy_content, {
            title: "Leave a reply",
            draggable: false,
            modal: true,
            behaviours: function(c) {
                c.find('#feedback').submit(function() {
                    Boxy.get(this).setContent("<div style=\"width: 450px; height: 430px\">Sending...</div>");
                    // submit form by ajax using post and send 3 values: subject, your_email, comment
                    $.post("ajax-feedback.php", { subject: c.find("input[name='subject']").val(), your_name: c.find("input[name='your_name']").val(), your_email: c.find("input[name='your_email']").val(), comment: c.find("#comment").val()},
                    function(data){
                        /*set boxy content to data from ajax call back*/
                        contactBoxy.setContent("<div style=\"width: 450px; height: 430px\">"+data+"</div>");
                    });
                    return false;
                });
            } 
        });
        return false;
    });
  });