jQuery.noConflict();
$j = jQuery;
$j().ready(
  function()
  {
    navLocate();
    //bindTopNavAudio();
  }
);



//---------------------------------------------------------------------
//  bind top nav audio for rollovers
//---------------------------------------------------------------------
function bindTopNavAudio()
{
  $j('.hshorts a, #hlinks a:not(.home)').each(
    function()
    {
      var $this = $j(this);
      soundManager.createSound( $this.attr('audio'), '/_audio/'+$this.attr('audio')+'.mp3' );
      $this.hover(
        function()
        {
          soundManager.play( $j(this).attr('audio') );
        },
        function()
        {
          soundManager.stop( $j(this).attr('audio') );
        }
      )
    }
  );
}


//---------------------------------------------------------------------
//  add 'selected' class to the current top nav item
//---------------------------------------------------------------------
function navLocate()
{
  var ahref = window.location.href.split('/');
  var file  = ahref[3].split('?')[0];
  $j('#top-nav li a[href="'+file+'"]').addClass('selected');
}


//---------------------------------------------------------------------
//  dbug.log functionality
//---------------------------------------------------------------------
dbug = {
	firebug: false, debug: false, log: function(msg) {},
	enable: function() { if(this.firebug) this.debug = true; dbug.log = console.debug; dbug.log('enabling dbug');	},
	disable: function(){ if(this.firebug) this.debug = false; dbug.log = function(){}; }
}
if (typeof console != "undefined") { // safari, firebug
	if (typeof console.debug != "undefined") { // firebug
		dbug.firebug = true; 
    dbug.enable();
    //if( window.location.href.indexOf("debug=true")>0 ) dbug.enable();
	}
}

