/******************************************************************************
* 20100622 psbrogna create DOM TARGET attributes from document REL attributes *
* ref: http://articles.sitepoint.com/article/standards-compliant-world        *
******************************************************************************/
function postProcessLinks() { var a, h, i, j, L, p, s0, s1;  
  if ( document.getElementsByTagName ) { a= document.getElementsByTagName('a');
    p= document.forms[0].elements['basePath'].value;
    L= window.location.pathname.split('?')[0].toLowerCase();
    for ( i= 0; i< a.length; i++ )  
      with ( a[i] ) 
        if ( getAttribute('href') ) { h= getAttribute('href'); 
          switch ( getAttribute('rel') ) {
            case 'external': setAttribute('target', '_blank'); break;
            case 'internal':
              if ( p+h.toLowerCase()== L ) 
                setAttribute('class', (( getAttribute('class')
                ?getAttribute('class'):'' )+' bsubs_selected')
                .replace(/^ +/,''));
              s0= getAttribute('href');
              s1= '?C='+document.forms[0].elements['CID'].value;
              j= s0.indexOf('#');
              if ( j== -1 ) s0= s0+s1;
              else s0= s0.substr(0, j)+s1+s0.substr(j);
              setAttribute('href', s0); break;
            }
          }
  } 
}  

function myOnload() { postProcessLinks(); }


