/* Avoid spam for email links */
function noSpam(user, domain, subj)
{
 locationstring = "mailto:" + user + "@" + domain;
 if (subj != "") {
  locationstring = locationstring + "?subject=" + subj 
 }
 window.location = locationstring;
}


/********************************************************
* function: opens all specified links in a parent window 
* cannot use inline attribute "target" for strict doctype
********************************************************/

function iframeLinks(){

	var anchors = document.getElementsByTagName("a");
	
	if (!document.getElementsByTagName) return;
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if ((anchor.getAttribute("href"))){
			anchor.target = "_parent";
		}
	}
	
	var divs = document.getElementsByTagName("div");
	for (var i=0; i<divs.length; i++) {
		var div = divs[i];
		if(div.getAttribute("class") == "edu-uiuc-webservices-pc-next"){

			var fullTxt = div.innerHTML;
			var first = fullTxt.substring(0, fullTxt.indexOf("target"));
			var last = fullTxt.substring(fullTxt.indexOf("href"), (fullTxt.indexOf("skinId")+10));
								
			div.innerHTML = first + "target='_self'" + last + "#top>next >></a>";
			
		}
		if(div.getAttribute("class") == "edu-uiuc-webservices-pc-previous"){
			var fullTxt = div.innerHTML;
			var first = fullTxt.substring(0, fullTxt.indexOf("target"));
			var last = fullTxt.substring(fullTxt.indexOf("href"), (fullTxt.indexOf("skinId")+10));
								
			div.innerHTML = first + "target='_self'" + last + "#top><< previous</a>";
		}
		
	}
}

window.onload = iframeLinks;
