/*********************************************************
 *  JavaScript: Utilities
 *    General scripts used throughout the site
 *
 *  JDMLabs
 *  Copyright 2001-2009 Jason Moss. All rights reserved.
 *
 *  This site has been hand-developed by Jason Moss.
 *   -  www.jdmlabs.com           |  web
 *   -  jason.moss&#64;gmail.com  |  mail
 *   -  +1-403-850-1496           |  voice
*********************************************************/
function addLoadEvent(func) {
  if(typeof window.onload=="function") {
    var oldFunc = window.onload;
    window.onload = function() { oldFunc(); func(); }
  }
  else { window.onload = func; }
}
function addEvent(o, type, fn) { o.addEventListener(type, fn, false); }
function removeEvent(o, type, fn) { o.removeEventListener(type, fn, false); }

function AnchorsInputs() {
  if (!document.getElementsByTagName && !document.getAttribute && !document.setAttribute) { return; }
  var anchors = document.getElementsByTagName("a");
  for (var i=0;i<anchors.length;i++) {
    var a = anchors[i];
    a.onfocus = function() { this.blur(); }
    if (a.getAttribute('href') && a.getAttribute('rel')=='external') { a.setAttribute('target','_blank'); }
  }
}

$(document).ready(function() {
  $(".show-hide").click(function() {
    $(".extra-info").slideToggle("fast");
    $(this).toggleClass("active");
    return false;
  });
});

$(document).ready(function() {
  $("dd.tab").click(function () {
    $("dd.activated").removeClass("activated");
    $(this).addClass("activated");
    $(".tabbed-content-container").slideUp();
    var content_show = $(this).attr("name");
    $("#"+content_show).slideDown();
  });
});

$(document).ready(function () {
  $('a.staff-lounge-login-link').click(function (e) {
    e.preventDefault();
    $('#staff_lounge_login_form').modal({onOpen: modalOpen});
  });
});

function modalOpen(dialog) {
  dialog.overlay.fadeIn('fast', function () {
    dialog.container.fadeIn('fast', function () {
      dialog.data.hide().slideDown('fast');
    });
  });
}

addLoadEvent(AnchorsInputs);