$(function() {
  Cufon.replace('.sharedfeaturesh3', { fontFamily: 'MetaPro-Bold' });
  Cufon.replace('.resellerfeaturesh3', { fontFamily: 'MetaPro-Bold' });
  Cufon.replace('#content-bottom h1', { fontFamily: 'MetaPro-Bold' });
  Cufon.replace('.fcsubcontentleft h3', { fontFamily: 'MetaPro-Bold' });
  Cufon.replace('.sharedplan h1', { fontFamily: 'MetaPro-Medium' });
  Cufon.replace('.resellerplan h1', { fontFamily: 'MetaPro-Bold' });
  
  $('#content_shared').show();
  $('#contenttopnav_shared li a').addClass("activetab");
  $('#content_reseller').hide();
  $('#contenttopnav_reseller li a').addClass("inactivetab");

  $('#moretestimonialsbutton').click(function() {
    window.location='about.html#/testimonials';
  });  
  
  $('#gmailmoreinfobutton').click(function() {
    if (confirm("Leave lithiumhosting.com?")) {
      window.open('http://www.google.com/apps/intl/en/group/index.html');
    } else {
      return false;
    }
  });
  
  $('#whmcsmoreinfobutton').click(function() {
    if (confirm("Leave lithiumhosting.com?")) {
      window.open('http://www.whmcs.com/members/aff.php?aff=999');
    } else {
      return false;
    }
  });
  
  $('#viewallsslbutton').click(function() {
    window.location='/ssl.html';
  });
  $('.plan-button-shared').click(function() {
    window.location='/shared.html';
  });
  $('.plan-button-reseller').click(function() {
    window.location='/reseller.html';
  });
  $('.plan-button-virtual').click(function() {
    window.location='/virtual.html';
  });
  $('.plan-button-shoutcast').click(function() {
    window.location='/shoutcast.html';
  });
  
  $('.whmcsaddon').hide();
  
  $.address.init(function(event) {
    if (event.value == '/') {
      event.value = '/shared';
    }
  }).change(function(event) {
    if (event.value == '/') {
      event.value = '/shared';
    }
    var selection = $('a[rel=address:' + event.value + ']');
    $('.activetab').addClass('inactivetab').removeClass('activetab');
    var clicked_button = selection.parent().attr('id');
    var div_to_show = clicked_button.replace('contenttopnav', 'content');
    $('#contenttopnav li').each(function() {
      if ($(this).attr('id') == clicked_button) {
        $('#' + clicked_button + ' a').removeClass('inactivetab').addClass('activetab');
      } else {
        $('#' + $(this).attr('id') + ' a').removeClass('activetab').addClass('inactivetab');;
      }
    });
    if (clicked_button == 'contenttopnav_shared') {
      $('.whmcsaddon').hide();
    }
    if (clicked_button == 'contenttopnav_reseller') {
      $('.whmcsaddon').show();
    }
    $('.landingcontent').hide();
    $('#' + div_to_show).show();
  });
});
