$(document).ready(function() { // match active page with a nav link pattern = /^p-(.*)$/; // anything in a string after 'p-' activePage = $('body').attr('id').match(pattern)[1]; // grab the body's id attribute, strip 'p-' located at beginning of line (e.g p-products becomes products) activeLink = $('ul#nav').find('a#nav-' + activePage); // find a matching link item (p-products, find nav-products) $(activeLink).addClass('active'); // add '.active' class to nav link /*email protect*/ $("span.safemail").each(function(){ exp = $(this).text().search(/\((.*?)\)/) != -1 ? new RegExp(/(.*?) \((.*?)\)/) : new RegExp(/.*/); match = exp.exec($(this).text()); addr = match[1] ? match[1].replace(/ at /,"@").replace(/ dot /g,".") : match[0].replace(/ at /,"@").replace(/ dot /g,"."); link = match[2] ? match[2] : addr; subject = $(this).attr('title') ? "?subject="+$(this).attr('title').replace(/ /g,"%20") : ""; $(this).after(''+ link + ''); $(this).remove(); }); // on focus for input boxes*/  $.fn.resetValue = function() {   return this.focus(function() {if( this.value == this.defaultValue ) {this.value = "";}})   .blur(function() {if( !this.value.length ) {this.value = this.defaultValue;}});  }; // $('.search-form input').resetValue(); // Open links in new window when rel="external" is applyed to a tag $('a[rel="external"]').click(function(){ this.target = "_blank"; }); //hide email and add the hidden email_To on submit $("#contact-form").submit(function() { var s1 = 'mike'; var s2 = '@'; var s3 = 'mkdsilva.com.au'; $(this).append(''); }); $('a.enlarge').colorbox(); $('.baseform').validate(); $("#footer .links a:first").addClass('first'); $("#slide-jump").click(function(){ $('.anythingSlider').anythingSlider(6); }); $("#design-jump").click(function(){ $('.anythingSlider').anythingSlider(4); }); $("#dev-jump").click(function(){ $('.anythingSlider').anythingSlider(2); }); $("#flash-jump").click(function(){ $('.anythingSlider').anythingSlider(3); }); });