	window.onload = fn_onload;

	function fn_onload (event) {

		fn_ahref();

	}

	function fn_ahref() {

		if (!document.getElementsByTagName) return;
		arr_nodes = document.getElementsByTagName('a');

		for (i = 0; i < arr_nodes.length; i++) {
			obj_node = arr_nodes[i];
			if (obj_node.getAttribute('href') && obj_node.getAttribute('rel') == 'external')
			obj_node.target = '_blank';
		}

	}

	// general-purpose popup
	function popup(URL, winwidth, winheight, scroll) {
		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars="+scroll+",location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}


	// popup containing HTML tag with single attribute (ie. <img src="graphic.gif">, and strips HTML away
	function popupStripHTML(URL, HTMLtag, winwidth, winheight, scroll) {

		var posA;

		// first strip away HTML from beginning and end of string
		posA = HTMLtag.indexOf("\"") + 1;
		HTMLtag = HTMLtag.substring(posA);		
		posA = HTMLtag.indexOf("\"");
		HTMLtag = HTMLtag.substring(0, posA);		

		// now replace / \ (and %5C Mozilla) used in pathnames with _FF_ and _BB_
		HTMLtag = HTMLtag.replace(/\//g, "_FF_");		
		HTMLtag = HTMLtag.replace(/\\/g, "_BB_");		
		HTMLtag = HTMLtag.replace(/%5C/g, "_BB_");		

		// now costruct the final URL
		URL = URL + "?qparam=" + HTMLtag;

		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars="+scroll+",location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}

	//  - trimming a string
	function trim(s)   {
		l=s.length; b=0; x=0;
		while (x<l&&b==0) { if (s.charAt(x)!=" ")  { b=1; } x++; }
		if (b==0) s="";  
		else { 
			b=0; s=s.substr(x-1); x=s.length-1;
			while(x>=0&&b==0) { if (s.charAt(x)!=" ")  { b=1; } x--; } 
			s=s.substr(0,x+2);
			}
		return s;
		}


