function form_input_classes(){ $('input[type="text"]').addClass('text'); $('input[type="password"]').addClass('text'); $('input[type="checkbox"]').addClass('checkbox'); $('input[type="radio"]').addClass('radiobutton'); $('input[type="submit"]').addClass('submit'); $('input[type="image"]').addClass('buttonImage'); } function form_swap_values(){ swapValues = []; $(".swap_value").each(function(i){ swapValues[i] = $(this).val(); $(this).focus(function(){ if ($(this).val() == swapValues[i]) {$(this).val("");} }).blur(function(){ if ($.trim($(this).val()) == "") {$(this).val(swapValues[i]);} }); }); } function ga_outgoing_links(){ $('a').each(function() { var $a = $(this); var href = $a.attr('href'); // strip the host name down, removing subdomains or www var host = window.location.host.replace(/^(([^\/]+?\.)*)([^\.]{4,})((\.[a-z]{1,4})*)$/, '$3$4'); // see if the link is external // location.host method if ( (href.match(/^http/)) && (! href.match(host)) ) { // doc.domain method // if ( (href.match(/^http/)) && (! href.match(document.domain)) ) { // if so, add the GA tracking code $a.click(function() { pageTracker._trackPageview('/outgoing/' + href); }); } }); } function assign_fitted(){ $('#contentDump .entry').fitted(); } $(document).ready(function() { form_swap_values(); form_input_classes(); ga_outgoing_links(); assign_fitted(); });