// This code taken from 
//  http://www.brucelawson.co.uk/2005/opening-links-in-new-windows-in-xhtml-strict-2/
// to make sure that links that used to use target="_blank"(which is not Strict XHTML)
// now comply and also are accessible.

// NOTE - you must use the rel="external" attribute of the anchor tag for this to work.

/* NOTE - This script does not work with IE7 and GMAPEZ
   'isIE7' is set to true to referring page via following script:

<!–[if IE 7]>
<script>isIE7 = true;</script>
<![endif]–>

*/

if (isIE7 != true) { window.onload = externalLinks; } 

function externalLinks()
{
 var objCurrent, objReplacement;

 if (document.getElementsByTagName)
 {
  var objAnchors = document.getElementsByTagName('a');
  for (var iCounter=0; iCounter<objAnchors.length; iCounter++)
  {
   if (objAnchors[iCounter].getAttribute('href') && objAnchors[iCounter].getAttribute('rel') == 'external')
   {
    objAnchors[iCounter].onclick = function(event){return launchWindow(this, event);}
    objAnchors[iCounter].onkeypress = function(event){return launchWindow(this, event);}
    objAnchors[iCounter].title = (objAnchors[iCounter].title != "") ? objAnchors[iCounter].title+" (opens in a new window)" : "opens in a new window";
   }
  }
 }
}

function launchWindow(objAnchor, objEvent)
{
var iKeyCode;

if (objEvent && objEvent.type == 'keypress')
{
 if (objEvent.keyCode)
  iKeyCode = objEvent.keyCode;
 else if (objEvent.which)
  iKeyCode = objEvent.which;

 if (iKeyCode != 13 && iKeyCode != 32)
  return true;
}

return !window.open(objAnchor);
}