// JavaScript Document
//Programmer Corina Acosta

function rel(){
	if(!document.getElementsByTagName) return false;
	var body_element = document.getElementsByTagName("body")[0];
	var links = body_element.getElementsByTagName("a");
	//alert(links[0]+"\n"+links[1]+"\n"+links[2]+"\n"+links[3]);
	//alert('Num of anchors: ' + links.length);
	for ( var i=0; i < links.length; i++) {
		if(links[i].getAttribute("rel") && links[i].getAttribute("href")) {
			links[i].onclick = function() {
				var theURL = this.getAttribute("href");
				var theREL = this.getAttribute("rel");
				var arr = theREL.split("|");
				var func = arr[0];  
				var name = arr[1];
				var width = arr[2];
				var height = arr[3];
				if(func == "popup"){
					window.open(theURL,name,"location=0,toolbar=0,directory=0,scrollbars=0,menubar=0,resizable=0,status=0,width="+width+",height="+height+"'");
				}
				return false;
			}//end of onclick event handler
		}	
	}//end for loop
}//end func rel

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(rel);
