$(document).ready(function() {
  
  $(".obf").each(function(){  
    var self = $(this);
    var email = this.tagName.toLowerCase() == 'a' ? self.attr('href') : self.html();
    email = email.replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);});
    if(this.tagName.toLowerCase() == 'a'){
      if(self.html() == self.attr('href')){
        self.html(email);
      }
      self.attr('href','mailto:'+email);
    }else{
      self.html(email)
    }
  });
  
  
	if($.browser.msie){
	  $('#nav').children().hover(function(e){
	    $(this).addClass('hover');
	  }, function(e){
	    $(this).removeClass('hover');
	  })
	  
		$('.rounded, #left-nav li').append('<span class="tl"></span><span class="tr"></span><span class="bl"></span><span class="br"></span>');
	}

  $('input[type="text"][title]').focus(function(e){
    $(this).filter('.empty').val('').removeClass('empty');
  }).blur(function(e){
    $(this).filter(function(){return this.value == ''}).val($(this).attr('title')).addClass('empty');
  }).blur();
  
  
  
  $('#quick-links-trigger').toggle(function(e){
    e.preventDefault()
    $('#quick-links').show()
    
    //$('html, body').animate({ scrollTop: $('#quick-links').offset().top   }, 1500);
    $($.browser.webkit ? 'body' : 'html').animate({ scrollTop: $(document).height()   }, 1500);
    //$('body').animate({ scrollTop: $(document).height()   }, 1500);
    $(this).addClass('opened')
  }, function(e){
    $('#quick-links').slideUp(500)
    $(this).removeClass('opened')
  })
  
  $('#quick-links').hide()
  
});

