$("div#mybathroom_base").mouseover(function () { clearTimeout(timeout) }); $('a#close_temp').click(function(e) { $('div#mybathroom_base').fadeOut('fast'); e.preventDefault(); }); $('a#close_perm').click(function(e) { $.get("./widgets/mybathroom/main.php", { ajax: '1', mbpermhide: 'true' }, function () { $('div#mybathroom_base').fadeOut('fast'); } ); e.preventDefault(); }); $(document).ready(function() { $("a.emailfriend").fancybox({ 'zoomOpacity' : true, 'overlayShow' : true, 'zoomSpeedIn' : 500, 'zoomSpeedOut' : 500, 'hideOnContentClick': false, 'padding' : 10, 'frameWidth' : 500, 'frameHeight' : 415, 'overlayOpacity' : 0.75 }); }); $('a.emailfriend').attr('href', './widgets/mybathroom/emailfriend.php'); $('input.send').click(function() { // Prepare values var yname = $("input#yourname").val(); var yemail = $("input#youremail").val(); var tname = $("input#theirname").val(); var temail = $("input#theiremail").val(); var datastring = 'yourname='+yname+'&youremail='+yemail+'&theirname='+tname+'&theiremail='+temail+'ajax=1'; $.ajax({ type: "POST", url: "./widgets/mybathroom/send_form.php", data: datastring, success: function(okay) { // Check if the result was okay, if not display the error message, otherwise display as sent if ('ok' == okay) { $('div.email').html("

Thank you

A link to your bathroom selection has been sent to '"+temail+"'

"); } else { $('div.error').fadeIn('fast'); $('div.error').html("

There was a problem...

There was a problem with your submission:

"+okay+"

"); } } }); });