/*
-----------------------------------------------
Common JavaScript
Version: 14 October 2008
----------------------------------------------- */


/* Add Load Event
----------------------------------------------- */

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
	window.defaultStatus='Airwave Europe Limited';
	newWindowLinks();
});


/* New Window Links
----------------------------------------------- */

// Filetypes to open in new window
var filetypes = '.wmv|.pdf';

// Base URL of site
var baseUrl = document.domain;

// Find links and attach onclick handlers
function newWindowLinks() {
	var links = document.getElementsByTagName('a');
	for (var i = 0; links[i]; i++) {	
		var a = links[i];
		if (!a.href) continue;
		if ((!a.href.indexOf('http://') && !a.href.match('^http://([^.]+[.])?(' + baseUrl + ')')) || a.href.match(filetypes)) {
			a.onclick = openInNewWindow;
		}
	}
}
	
// Open link in new window unless modifier key is pressed
function openInNewWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	} else {
		var newWindow = window.open(this.getAttribute('href'));
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}

/* Jump Menu
----------------------------------------------- */
function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}