// Break the browser window out of frames
	if (parent.frames.length > 0) {
			parent.location.href = location.href;
	}

// Funtion to open links with rel="external" specified in a new browser window
	function externalLinks() {
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
		}
	}

// JavaScript form validating function. Code should pass for use in valid XHTML Transitional/Strict or better applications
	function validate() {
	var fieldset;
	fieldset = document.getElementsByTagName('input')
		for (i=0; i<fieldset.length; i++) {
			if (fieldset[i].className == "required" && fieldset[i].value == '') {
				alert("Please fill in all required (*) fields.");
				fieldset[i].focus();
			return false;
			}
		}
	return true;
	}

// [+/-] Show/Hide JavaScript Function
	function expandcollapse (block) {
		div = document.getElementById(block);
		if (div.className=="visible") {
		 div.className="hidden";
	   }
	   else {
		div.className="visible";
	}
	}

// XHTML 1.0 Strict JavaScript image swap
	function swapImage(id,newSrc) {
		document.getElementById(id).src = newSrc;
		}

// Allows external links and certain file types to open in new browser windows
	function addLoadEvent(func) {
		var oldonload = window.onload; 
		if (typeof window.onload != 'function') {
			window.onload = func; 
		}
		else {
			window.onload = function() {
			if (oldonload) {
	            oldonload(); 
	            }
	         func(); 
	         }
	      }
	   }
	
	function linkControl() {
	   var thishost = window.location.host;
	   var filetype = ".pdf";
	   if (!document.getElementsByTagName) return false;
	   var links = document.getElementsByTagName("a");
	   for (var i = 0; i < links.length; i++) {
	      var link = links[i];
	      // select outgoing links which are not e-mail links
	      if ((link.host.indexOf(thishost) == - 1) && (link.href.indexOf('@') == - 1) ) {
	         link.onclick = function() {
	            window.open(this.href);
	            return false; 
	            }
	         }
	      // select links with the specified filetype
	      if (link.getAttribute("href").indexOf(filetype) != - 1) {
	         link.onclick = function() {
	            window.open(this.href); 
	            return false; 
	            }
	         }
	      }
	   }
	addLoadEvent(linkControl);