
// from http://ejohn.org/projects/flexible-javascript-events/
function addEvent( obj, type, fn ) { 
  if ( obj.attachEvent ) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent( "on"+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
    
}

// from http://ejohn.org/projects/flexible-javascript-events/
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}


function econvert(s) {
return s.replace(/%7E/g,'~').replace(/%28/g,'(').replace(/%29/g,')').replace(/%20/g,' ').replace(/_dot_| dot |_\._|\(\.\)/gi, '.').replace(/_at_|~at~/gi, '@');}

function AEHit() {
  $('span.aeh').each(function() { 
        this.innerHTML = econvert(this.innerHTML);
  });
}

function highlightcurrenturls() {
  var ul=$('#menu');
  var _base_url = location.href.split(/[\?\#]/)[0];
  if (_base_url.charAt(_base_url.length-1)=='/')
      _base_url = _base_url.substring(0, _base_url.length-1);
  var _root_url = 'http://www.issuetrackerproduct.com';
  var _in_root = _base_url == _root_url;
  $('a', $('#menu')).each(function() {
     if ((_base_url.indexOf(this.href) > -1 && !_in_root && this.href != _root_url+'/') ||
         (_in_root && this.href==_root_url+'/')) {
       $(this).addClass("inurl");
     }
  });
}

$(function() {
  AEHit();
  highlightcurrenturls();
});

