/* Gets all links on page and uses "rel" attribute of <a ..> to determine if pop up window req'd
rel attribute of form: rel="winType x y" i.e. rel="popUp 300 400 1 1 1 1 0 0" = rel="popUp width height scrollbars resizable menubar toolbar statur location" Note: 1=yes, 0=no 
called as: <a href="somePage.asp" rel="popUp 300 400 1 1 1 1 0 0" target="_blank">Some Page</a> */

// called by js below f'n; opens the js window
function openWin(url,attr,vX,vY,scrollbars,resizable,menubar,toolbar,status,location) {
	window.open(url,'newWin','width='+vX+',height='+vY+',scrollbars='+scrollbars+',resizable='+resizable+',menubar='+menubar+',toolbar='+toolbar+',status='+status+',location='+location);
}

window.onload = function() {
	//gets # of links on page (document.links is an array)
	var links = document.links.length
	//loops through all links on page
	for(var i=0; i<links; i++) {
		//sees if rel attribute contains "popUp" - otherwise not req'd to make a js popUp
		if (document.links[i].rel.indexOf("popUp") >=0) {
			//splits the rel attr.
			linkArray = document.links[i].rel.split(" ");
			/*creates the new href statement
			i.e. <a href="somePage.asp">Some Page</a> -->
			<a href="javascript:openWin('somePage.asp','popUp','300','400','1','1','0','0','0','0')">Some Page</a>*/
			var newLink = "javascript:openWin('"+document.links[i]+"',"+linkArray+")";
			document.links[i].href = newLink
			//sets the target attr to "" (otherwise if left as target="_blank", will mess up js window)
			document.links[i].target = "";
		}
	}
}
