// <![CDATA[
			
function prepareLinks() {
  if( document.getElementById && document.getElementsByTagName ) {
    if( document.getElementById('links') ) {
      
	  var external = document.getElementById('links');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
    if( document.getElementById('ad') ) {
      
	  var external = document.getElementById('ad');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
    if( document.getElementById('ret') ) {
      
	  var external = document.getElementById('ret');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
    if( document.getElementById('news_links') ) {
      
	  var external = document.getElementById('news_links');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
    if( document.getElementById('ret_banner') ) {
      
	  var external = document.getElementById('ret_banner');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
    if( document.getElementById('komodo') ) {
      
	  var external = document.getElementById('komodo');
      
	  var links = external.getElementsByTagName('a');
      
	  for( var i=0; i < links.length; i++ ){
        links[i].onclick = function(){
          return openLink(this);
        };
      }
    }
  }
}


/* Displays the registration */

function openLink(id) {
if (document.getElementById) {
	
	openWindow(id);
  		
	return false;
	
	} else {
  		return true;
 	}
}

function openWindow(id) {
    var width = screen.width;
    var height = screen.height;
    var left = "0px";
    var top = "0px";
	vUrl = id;
		
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",scrollbars=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes,left=" + left + ",top=" + top + 
        "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(vUrl, "subWind", windowFeatures);
}





/////////////////////////////////////////


var path_to_icon 		= 'img/main/ext_link.gif';
var link_alt_text 		= 'open link in new window';
var link_title_text 	= 'Open this link in new window';

function new_window_link() {
	if (!document.getElementById || !document.createTextNode || !document.domain);
	var section = document.getElementById('body_text');
	var l = section.getElementsByTagName('a');
	for (var i = 0; i < l.length; i++) {

		// just for off-site links
		if (l[i].getAttribute('href').indexOf("mailto") != -1)
		{
				// does not add to the link if it is a mailto
				// could be extended for javascript: if needed
		}
		else if ((l[i].href.split('/')[2].replace(/www\./, '') != document.domain.replace(/www\./, '')
			&& !l[i].getAttribute('target')
			&& !l[i].parentNode.id.match(/^copy/))) {


			// create new elements
			var nwl = document.createElement('a');
			var nwl_image = document.createElement('img');
			var space = document.createTextNode(' ');

			// setup image attributes
			nwl_image.setAttribute('src', path_to_icon);
			nwl_image.setAttribute('alt', link_alt_text);
			nwl_image.setAttribute('title', link_title_text);

			// set link attributes
			nwl.setAttribute('href', l[i].getAttribute('href'));
			nwl.setAttribute('target', '_blank');
			nwl.setAttribute('title', link_title_text);
			nwl.className = 'new_window_link';

			// append new elements
			nwl.appendChild(nwl_image);
			l[i].parentNode.insertBefore(space, l[i].nextSibling);
			l[i].parentNode.insertBefore(nwl, l[i].nextSibling.nextSibling);
		}
		
	}
}


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


addLoadEvent(prepareLinks);
addLoadEvent(new_window_link);
	
// ]]>