/* * jQuery autoResize (textarea auto-resizer) * @copyright James Padolsey http://james.padolsey.com * @version 1.04 */ (function(a){a.fn.autoResize=function(j){var b=a.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},j);this.filter('textarea').each(function(){var c=a(this).css({resize:'none','overflow-y':'hidden'}),k=c.height(),f=(function(){var l=['height','width','lineHeight','textDecoration','letterSpacing'],h={};a.each(l,function(d,e){h[e]=c.css(e)});return c.clone().removeAttr('id').removeAttr('name').css({position:'absolute',top:0,left:-9999}).css(h).attr('tabIndex','-1').insertBefore(c)})(),i=null,g=function(){f.height(0).val(a(this).val()).scrollTop(10000);var d=Math.max(f.scrollTop(),k)+b.extraSpace,e=a(this).add(f);if(i===d){return}i=d;if(d>=b.limit){a(this).css('overflow-y','');return}b.onResize.call(this);b.animate&&c.css('display')==='block'?e.stop().animate({height:d},b.animateDuration,b.animateCallback):e.height(d)};c.unbind('.dynSiz').bind('keyup.dynSiz',g).bind('keydown.dynSiz',g).bind('change.dynSiz',g)});return this}})(jQuery); $(document).ready(function(){ idabout = $('#about'); idcontact = $('#contact'); idabout.hide(); idcontact.hide(); $('hr').wrap("
"); $('#name a, #a-about').click(function() { idcontact.slideUp(); idabout.slideToggle(); return false; }); $('#a-contact').click(function() { idabout.slideUp(); idcontact.slideToggle(); return false; }); $('input, textarea').each(function() { jthis = $(this); if (jthis.attr('value') == '') { jthis.attr('value', jthis.parent().find('label').text().toUpperCase()); } }); $('#contact label').hide(); $('input, textarea').focus(function() { jthis = $(this); if (jthis.attr('value') == jthis.parent().find('label').text().toUpperCase()) { jthis.attr('value', ''); } }); $('input, textarea').blur(function() { jthis = $(this); if (jthis.attr('value') == '') { jthis.attr('value', jthis.parent().find('label').text().toUpperCase()); } }); if (navigator.onLine != 'undefined' && navigator.onLine === false) { $('input[type="submit"]').click(function() { if (!confirm("It looks like you are browsing in offline mode.\nTrying to mail me while offline won't do any good.\n\nAre you sure you will try to email me?")) { return false; } }); } $('#form_msg').css({'height': '44px', 'width': '290.6px'}).autoResize({ animateDuration: 300, extraSpace: 30 }); var jform = $('form', '#contact'); $('input[type="submit"]').click(function() { $.ajax({ type: 'POST', dataType: 'json', url: 'contact.php', data: jform.serialize()+'&json=true', success: function(data) { console.log(data); if (data.res === true) { jform.slideUp('slow').next().html(data.msg).fadeIn(); } else { jform.next().html(data.error.join('