// JavaScript Document for BRC website

	function addLoadEvent(func) 
	{
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') 
	  {
		window.onload = func;
	  } else 
	  {
		window.onload = function() 
		{
		  oldonload();
		  func();
		}
	  }
	}


	/*
	function makeSpeciesDistPopup(URL) {
		var genericPopup = window.open(URL, 'popup', 'width=480,height=520,scrollbars=yes,resizable=1,status=1,left=120,top=120,screenX=120,screenY=120');
		genericPopup.focus();
			if (genericPopup.opener == null) genericPopup.opener = self;
	}
	
	function makeSchemeDetailsPopup(URL) 
	{
		var genericPopup = window.open(URL, 'popup', 'width=480,height=450,scrollbars=yes,resizable=1,status=1,left=120,top=120,screenX=120,screenY=120');
		genericPopup.focus();
			if (genericPopup.opener == null) genericPopup.opener = self;
	}
	*/
	
	function makePopup(URL) {
		var genericPopup = window.open(URL, 'popup', 'width=600,height=520,scrollbars=yes,resizable=1,status=1,left=120,top=120,screenX=120,screenY=120');
		genericPopup.focus();
			if (genericPopup.opener == null) genericPopup.opener = self;
	}
	
	function makeBiggerPopup(URL) {
		var style = 'width=720,height=520,scrollbars,resizable,status'
		var top = (screen.height - 520)/2;
		if (top < 0) top = 0;
		style += ',top=' + top + ',screenY=' + top;
		var left = (screen.width - 720)/2;
		style += ',left=' + left + ',screenX=' + left;
		var genericPopup = window.open(URL,'popup', style); 
		genericPopup.focus();
		if (genericPopup.opener == null) genericPopup.opener = self;
	}
	
	function doPopups() 
	{
	  if (!document.getElementsByTagName){ return false; }
	  var links = document.getElementsByTagName("a");
	  for (var i=0; i < links.length; i++) 
	  {
		if (links[i].className.match("popup")) 
		{
		  links[i].onclick = function() 
		  {
			makePopup(this.href)
			return false;
		  }
		}
		if (links[i].className.match("biggerPopup")) 
		{
		  links[i].onclick = function() 
		  {
			makeBiggerPopup(this.href)
			return false;
		  }
		}
	  }
	}
	addLoadEvent(doPopups);
	
	

