// Last modification:
var clib_version = 2011.1124;

//
// Javascript copyright 2003-2011 by Jay Krause.  All rights reserved.
//
//  clib.js - common library
//

var clib_fDebug = false;
var clib_fDebugInit = false;
var clib_fLocal = false;
var clib_urlSep;
var clib_website;
var clib_websiteUrl;
var clib_pageUrl,clib_subUrl,clib_chUrlSep,clib_pagePath;
var clib_host;
var clib_currentYear = null;
var clib_rgUrlParam = new Array();
var clib_homePrefix;
var clib_fNoCookies = true;
var clib_fCookieLog = false;
var clib_cookiePath = "/";

// initialized by clibx_init()
var clib_c;
var clib_imageDir = "clibimages";
var clib_imageLoc;
var clib_urlCautionSuffix = "caution.gif";
var clib_urlCaution;
var clib_urlQuestionSuffix = "question.gif";
var clib_urlQuestion;
var clib_urlBlankSuffix = "blank.gif";
var clib_urlBlank;

var clib_alertMsg2 = null;
var clib_alertImg2 = null;
var clib_fUseAlert = false;
var clib_alertx = 375;
var clib_alertx2 = 75;
var clib_rgPreLoad = new Array();
var clib_nrgPreLoad = 0;
var clib_alertDiv = 'div_clibAlert';
var clib_rgMonths = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var clibdb_members = '';
var clib_rgBlendDiv = new Array();
var clib_nrgBlendDiv = 0;
var clibx_blendDivSuf = '_clibBlendDiv';
var clibx_fUseIeFade = true;
var clibx_minMsTic = 25;

function clibx_cType() {
	var rg = new Array(
		 'version','fLocal','host','currentYear','fNoCookies','fCookieLog','cookiePath','imageLoc'
		,'website','websiteUrl','pagePath','pageUrl','subUrl','urlSep','chUrlSep'
		,'homePrefix','urlCaution','urlQuestion','urlBlank'
		);
	for (var i = 0; i < rg.length; i++) eval('this.' + rg[i] + ' = clib_' + rg[i]);
	}

if (eval('typeof clib_fDumpData') == 'undefined') var clib_fDumpData = false;
if (clib_fDumpData) clibdb_register('clib_rgPreLoad');

function clib_isFunction(a) { return (typeof a == 'function'); }
function clib_isObject(a) { return (((a && (typeof a == 'object'))) || clib_isFunction(a)); }
function clib_isArray(a) { return (clib_isObject(a) && (a.constructor == Array)); }
function clib_isImage(a) { return (clib_isObject(a) && (typeof a.complete != 'undefined') && (typeof a.src != 'undefined')); }
function clib_isNumber(a) { return (typeof a == 'number'); }
function clib_isNumeric(a) {
	if (typeof a == 'number') return true;
	if ((a == null) || (a == '') || (typeof a != 'string')) return false;
	var rgChars = "0123456789.";
	for (var i = 0; i < a.length; i++) if (rgChars.indexOf(a.charAt(i)) == -1) return false;
	return true;
   }
function clib_isString(a) { return (typeof a == 'string'); }
function clib_isBoolean(a) { return (typeof a == 'boolean'); }
function clib_isNonNullString(a) { return ((typeof a == 'string') && (a != '')); }
function clib_isNullString(a) { return ((typeof a == 'string') && (a == '')); }
function clib_isUndefined(a) { return (typeof a == 'undefined'); } 
function clib_isNull(a) { return ((typeof a == 'undefined') || (a == null)); } 

function clib_checkArg(a) { return (typeof a == 'undefined' ? null : a); } 
function clib_checkTopUrl() { if (window != top) top.location.href = location.href; }
function clib_gotoTopUrl(url) { top.location.href = url; }

var clibx_iObjectId = 1000;
function clib_newObjectId(base) { clibx_iObjectId++; return (base == null ? 'clibId' : base) + clibx_iObjectId; }

function clib_closeWindows() {
	if (clib_fLocal) alert('clib_closeWindows()');
	}

function clib_decrypt(s) {
clib_debugFunction(clib_fLocal);
	var key = 5;
	var r = '';
	for (var i = 1; i < s.length; i += 2) r += String.fromCharCode(key ^ s.charCodeAt(i));
	return r;
	}

function clib_reverseString(s) {
	if ((s == null) || (s == '')) return '';
	var r = '';
	for (var i = 0; i < s.length; i++) {
		var c = s.charCodeAt(i);
		r += ((c < 32) || (c >= 127) ? s.charAt(i) : String.fromCharCode(32 + 127 - c));
		}
	return r;
	}

function clib_randomInt(min,max) {
	return Math.round(Math.random()*(max-min),0) + min;
	}

function clibdb_register() {
	for (var i = 0; i < clibdb_register.arguments.length; i++) clibdb_members += (clibdb_members == '' ? '' : ',') + clibdb_register.arguments[i]; }

function clib_urlParamType(id,value) { this.members = 'id,value'; this.id = id; this.value = value; }

function clibx_init(url) {
	function initWebSiteName() {
		var url = document.location;
		url = clib_cleanUrl(url);
		var rgWebSuffix = new Array('.com', '.org', '.net');
		var nrgWebSuffix = rgWebSuffix.length;
		var rgParam = url.split('#');
		if (rgParam.length == 1) rgParam = url.split('?');
		var rgFolders = rgParam[0].split('/');
		clib_website = '';
		clib_homePrefix = '';
		clib_websiteUrl= '';
		clib_pagePath = '';
		var urlLocal = 'file:';
		clib_fLocal = (url.substr(0,urlLocal.length) == urlLocal);		// force to be string and see if its "file:..."
		clib_urlSep = clib_fLocal ? '#' : '?';
		var n = 0;
		for (var i = rgFolders.length - 1; i >= 0; i--) {
			for (var j = 0; j < rgWebSuffix.length; j++) {
				var web = rgWebSuffix[j].toLowerCase();
				var local = rgFolders[i].toLowerCase();
				if (local.length >= web.length) {
					if (web == local.substr(local.length-web.length,web.length)) {
						for (var k = i + 1; k < rgFolders.length - 1; k++) clib_pagePath += rgFolders[k] + '/';
						clib_website = local;
						clib_websiteUrl="http://" + clib_website + "/";
						if (clib_fLocal) {
							clib_homePrefix = '';
							if (n > 0) for (var l = 1; l < n; l++) clib_homePrefix += "../";
							}
						else clib_homePrefix = clib_websiteUrl;
						if (clib_fLocal) clib_host='local';
						else {
							var rgsite = new Array();
							rgsite = clib_website.split('.');
							clib_host = rgsite[rgsite.length-2].toLowerCase();
							}
						return;
						}
					}
				}
			n++;
			}
		return;
		}
	clib_debugFunction(clib_fLocal && (url != null));
	initWebSiteName();
	clib_imageLoc = clib_homePrefix + clib_imageDir + '/';
	clib_urlCaution = clib_imageLoc + clib_urlCautionSuffix;
	clib_urlQuestion = clib_imageLoc + clib_urlQuestionSuffix;
	clib_urlBlank = clib_imageLoc + clib_urlBlankSuffix;
	if (url == null) url = document.location;
	url = clib_cleanUrl(url);
	clib_pageUrl = clib_getUrlPrefix(url);
	clib_subUrl = clib_getUrlSuffix(url);
	clib_chUrlSep = null;
	if (clib_subUrl != null) {
		clib_chUrlSep = url.charAt(url.length - clib_subUrl.length - 1);
		var rg = clib_subUrl.split('&');
		for (var i = 0; i < rg.length; i++) {
			var id,value;
			var rgp = rg[i].split('=');
			if (rgp.length > 2) for (var j = 2; j < rgp.length; j++) rgp[1] += '=' + rgp[j];
			if (rgp.length < 2) { id = rg[i]; value = ''; }
			else { id = rgp[0]; value = rgp[1]; }
			clib_rgUrlParam[clib_rgUrlParam.length] = new clib_urlParamType(id,value);
			}
		}
	var td = new Date();
	clib_currentYear = td.getFullYear();
	clib_c = new clibx_cType();
	}

function clib_altFromHtml(html) {
	if (html == null) return '';
	if (typeof html != 'string') return '';
	var alt = html;
	var rgSearch = new Array(	'>',	'<br',	'<BR',	'<p',	'<P',	'<',	'"',		"'");
	var rgReplace = new Array(	'',		'\n',	'\n',	'\n',	'\n',	'',		'&quot;',	"'")
	for (var i = 0; i < rgSearch.length; i++) alt = clib_insertText(alt, rgSearch[i], rgReplace[i]);
	return alt;
	}

function clib_idCompare(a,b,fCase,fWhite) {
	if ((a == null) || (b == null)) return false;
	if (fCase == null) fCase = false;
	if (fWhite == null) fWhite = false;
	if (!fCase) {
		a = a.toLowerCase();
		b = b.toLowerCase();
		}
	if (fWhite) {
		a = clib_insertText(a,"%20"," ");
		b = clib_insertText(b,"%20"," ");
		}
	else {
		a = clib_insertText(a,"%20","");
		b = clib_insertText(b,"%20","");
		a = clib_insertText(a," ","");
		b = clib_insertText(b," ","");
		}
	return (a == b);
	}

function clib_getUrlParam(id) {
	for (var i = 0; i < clib_rgUrlParam.length; i++) if (clib_idCompare(clib_rgUrlParam[i].id,id)) return clib_rgUrlParam[i].value;
	return null;
	}

function clib_getUrlPrefix(url) {
	url = clib_cleanUrl(url);
	var rg = url.split('#');
	if (rg.length < 2) rg = url.split('?');
	if (rg.length > 1) url = rg[0];
	rg = url.split('/');
	if (rg.length > 1) return rg[rg.length-1];
	else return url;
	}

function clib_getUrlSuffix(url) {
	url = clib_cleanUrl(url);
	var ch = '#';
	var rg = url.split(ch);
	if (rg.length < 2) { ch = '?'; rg = url.split(ch); }
	if (rg.length > 1) {
		url = rg[1];
		for (var i = 2; i < rg.length; i++) url += ch + rg[i];
		return url;
		}
	else return null;
	}

function clib_cleanUrl(url) {
	if (url == null) return '';
	var x = url + ' ';
	url = x.substr(0,x.length-1);
	var len = url.length;
	var j = 0;
	var c = '';
	while (j < len) {
		var ch = url.charAt(j);
		var chLeft = len - j - 1;
		if (ch == '\\') ch = '/';
		else if ((ch == '%') && (chLeft >= 2)) if (url.substr(j,3) == '%20') {
			ch = ' ';
			j += 2;
			}
		c += ch;
		j++;
		}
	return c;
	}

function clib_loadSource(url) {
	var html = '<scr' + 'ipt language="JavaScript" type="text/javascript" src="';
	html += clib_unhideUrl(url);
	html += '"></sc' + 'ript>';
	clib_writeln(html);
	}

function clib_unhideUrl(url) {
	if (typeof url == 'undefined') return null;
	if (typeof url == 'string') {
		if (url.indexOf('~') < 0) return url;
		url = clib_insertText(url,'~|~','\/');
		url = clib_insertText(url,'~j~','.jpg');
		url = clib_insertText(url,'~g~','.gif');
		url = clib_insertText(url,'~h~','.html');
		url = clib_insertText(url,'~c~','.com');
		if (url.indexOf('~') < 0) return url;
		url = clib_insertText(url,'~p~','.pdf');
		url = clib_insertText(url,'~z~','.zip');
		url = clib_insertText(url,'~n~','.net');
		url = clib_insertText(url,'~o~','.org');
		url = clib_insertText(url,'~e~','.edu');
		url = clib_insertText(url,'~a~','@');
		url = clib_insertText(url,'~php~','.php');
		url = clib_insertText(url,'~js~','.js');
		url = clib_insertText(url,'~.~','../');
		}
	return url;
	}

//
// Notes:
//	- urls are full spec from root such as /foo/bar.jpg
//	- If leading '/' is ommitted it is assumed (a/b.jpg == /a/b.jpg)
//	- If urlParent is blank or null then it is assumed to be (clib_pagePath + clib_pageUrl)
//
function clib_normalizeUrl(url,urlParent) {
    var urlRet = '';
	if ((typeof urlParent != 'string') || (urlParent == '')) urlParent = clib_pagePath + clib_pageUrl;
	if ((typeof url != 'string') || (url == '')) return null;
	url = clib_unhideUrl(url);
	if (url.charAt(0) == '/') url = url.substr(1,url.length-1);
	if (urlParent.charAt(0) == '/') urlParent = urlParent.substr(1,urlParent.length-1);
	var rg = url.split('/');
	var rgParent = urlParent.split('/');
	if (rgParent.length == 1) return url;
	var html = 'rg.length = ' + rg.length + ' (';
	for (var i = 0; i < rg.length; i++) html += (i == 0 ? '' : ', ') + rg[i];
	html += ')<br>';
	html += 'rgParent.length = ' + rgParent.length + ' (';
	for (i = 0; i < rgParent.length; i++) html += (i == 0 ? '' : ', ') + rgParent[i];
	html += ')<br><br>';
	if (rg.length == 1) {
		for (i = 0; i < rgParent.length - 1; i++) urlRet += '../';
		urlRet += rg[0];
		return urlRet;
		}
	else if (rg[0] == rgParent[0]) {
		url = rg[1]; for (i = 2; i < rg.length; i++) url += '/' + rg[i];
		urlParent = rgParent[1]; for (i = 2; i < rgParent.length; i++) urlParent += '/' + rgParent[i];
		return clib_normalizeUrl(url,urlParent);
		}
	else {
    	for (i = 0; i < rgParent.length-1; i++) urlRet += '../';
    	urlRet += url;
	    return urlRet;
	    }
	}

function clib_charToNum(ch,r) {
	if (r == null) r = 10;
	ch = ch.charAt (0);
	var i;
	for (i = 0; i < 256; ++ i) {
		var h = i.toString (16);
		if (h . length == 1) h = "0" + h;
		h = "%" + h;
		h = unescape(h);
		if (h == ch) break;
		}
	if (r == 10) return i;
	return i.toString(r);
	}

function clib_numToChar(n) {
	return unescape('%' + n.toString(16));
	}

function clib_emailLink(user,dom,type,subj,cl,display) {
	if (display == null) display = user + '@' + dom + '.' + type;
	return '<a ' + (cl == null ? '' : 'class=' + cl) + ' href="mailto:' + user + '@' + dom + '.' + type + (subj == null ? '' : '?subject=' + subj) + '">' + display + '</a>';
	}

function clib_pNumber(c,a,e,n,fSlash,fDot) {
	if (typeof fSlash != 'boolean') fSlash = false;
	if (typeof fDot != 'boolean') fDot = false;
	if ((c == null) || (c == '')) c == ''; else c = '+' + c + ' ';
	a = (fSlash ? a + '/' : (fDot ? a + '.' : '(' + a + ') '));
	n = e + (fDot ? '.' : '-') + n;
	return c + a + n; 
	}

// clib_insertText("text~string", "~", "XXX")
// returns "textXXXstring"
//
function clib_insertText(t,s,p) {
	if (typeof t != 'string') return '';
	var rg = t.split(s);
	if (rg.length < 2) return t;
	var r = rg[0];
	for (var i = 1; i < rg.length; i++) r += p + rg[i];
	return r;
	}

// clib_insertParams('%3 %2 %1 %0 %1 %2 %3 %4 %5 %6','this','is','a','test')
// returns "test a is this is a test "
// t has up to 10 parameters [%0 .. %9]//
//
function clib_insertParams(t) {
	if ((t == null) || (t == '')) return t;
	var args = clib_insertParams.arguments;
	var nargs = args.length;
	var rgp = new Array();
	for (var i = 0; i < 10; i++) rgp[i] = '';
	for (i = 1; i < nargs; i++) if (args[i] != null) rgp[i-1] = args[i];
	var r = t;
	for (i = 0; i < 10; i++) {
		var s = '%' + i; 
		r = clib_insertText(r,s,rgp[i]);
		}	
	return r;
	}

function clib_copyText(t,type) {
	if (type == null) type = 'Text';
	var f = false;
	if (window.clipboardData) if (window.clipboardData.setData) { window.clipboardData.setData(type, t); f = true; }
	return f;
	}

function clib_imgPosX(objName) { return clib_objPosX(clib_getElementId(objName)); }
function clib_imgPosY(objName) { return clib_objPosY(clib_getElementId(objName)); }

function clib_objPosX(obj) {
	if ((obj == null) || (obj == '')) return null;
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
			}
		}
	else if (obj.x) curleft += obj.x;
	return curleft;
	}

function clib_objPosY(obj) {
	if ((obj == null) || (obj == '')) return null;
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
			}
		}
	else if (obj.y) curtop += obj.y;
	return curtop;
	}

function clib_wdType(xMin,xMax,yMin,yMax) { this.xMin = xMin; this.xMax = xMax; this.yMin = yMin; this.yMax = yMax; }
function clibx_newWindowDimType(x,y,w,h) { this.members = 'x,y,w,h'; this.x = x; this.y = y; this.w = w; this.h = h; }
function clib_screenDimType(w,h,st,sl,wx,wy,sx,sy) {
//	this.members = 'x,y,w,h,scrollX,scrollY,windowX,windowY,screenX,screenY';
	this.x = w; this.y = h; this.w = w; this.h = h;
	this.scrollX = sl; this.scrollY = st;
	this.windowX = wx; this.windowY = wy;
	this.screenX = sx; this.screenY = sy;
	}

function clib_screenDimensions(id) {
	var w,h,st,sl,wx,wy,sx,sy = 0;
	var did = (id == null ? document : id.document);
	var wid = (id == null ? window : id.window);

	if (wid.innerWidth != null) w = wid.innerWidth;
	else if ((did.body != null) && (did.body.clientWidth != null)) w = did.body.clientWidth;
	if (wid.innerHeight != null) h = wid.innerHeight;
	else if ((did.body != null) && (did.body.clientHeight != null)) h = did.body.clientHeight;

	if (wid.pageXOffset != null) sl = wid.pageXOffset;
	else if ((did.body != null) && (did.body.scrollLeft != null)) sl = did.body.scrollLeft;
	if (wid.pageYOffset != null) st = wid.pageYOffset;
	else if ((did.body != null) && (did.body.scrollTop != null)) st = did.body.scrollTop;

	if (wid.outerWidth != null) wx = wid.outerWidth;
	else if ((did.body != null) && (did.body.offsetWidth != null)) wx = did.body.offsetWidth;
	if (wid.outerHeight != null) wy = wid.outerHeight;
	else if ((did.body != null) && (did.body.offsetHeight != null)) wy = did.body.offsetHeight;

	if ((screen != null) && (screen.availWidth != null)) sx = screen.availWidth; else sx = wx;
	if ((screen != null) && (screen.availHeight != null)) sy = screen.availHeight; else sy = wy;

	return new clib_screenDimType(w,h,st,sl,wx,wy, sx,sy);
	}

function clib_windowDimensions(id) {
	var xMin,xMax,yMin,yMax;
	if (window.innerWidth == null) {	// IE 4+
		var did = (id == null ? document : id.document);
		xMin = did.body.scrollLeft;
		xMax = xMin + did.body.clientWidth;
		yMin = did.body.scrollTop;
		yMax = yMin + did.body.clientHeight;
		}
	else {								// NS 4+
		var wid = (id == null ? window : id.window);
		xMin = wid.pageXOffset;
		xMax = xMin + wid.innerWidth;
		yMin = wid.pageYOffset;
		yMax = yMin + wid.innerHeight;
		}
	return new clib_wdType(xMin,xMax,yMin,yMax);
	}

function clib_innerWidth() {return clib_screenDimensions().w; }
function clib_innerHeight() {return clib_screenDimensions().h; }
function clib_clientWidth() {return clib_screenDimensions().w; }
function clib_clientHeight() {return clib_screenDimensions().h; }

function clib_screenScrollX() { return clib_screenDimensions().scrollX; }
function clib_screenScrollY() { return clib_screenDimensions().scrollY; }
function clib_pageXOffset() {return clib_screenDimensions().scrollX; }
function clib_pageYOffset() {return clib_screenDimensions().scrollY; }
function clib_scrollLeft() {return clib_screenDimensions().scrollX; }
function clib_scrollTop() {return clib_screenDimensions().scrollY; }

function clib_windowX(id) { return clib_screenDimensions(id).windowX; }
function clib_windowY(id) { return clib_screenDimensions(id).windowY; }
function clib_outerWidth(id) {return clib_screenDimensions(id).windowX; }
function clib_outerHeight(id) {return clib_screenDimensions(id).windowY; }
function clib_offsetWidth(id) {return clib_screenDimensions(id).windowX; }
function clib_offsetHeight(id) {return clib_screenDimensions(id).windowY; }

function clib_screenX(id) { return clib_screenDimensions(id).screenX; }
function clib_screenY(id) { return clib_screenDimensions(id).screenY; }
function clib_screenAvailWidth(id) { return clib_screenDimensions(id).screenX; }
function clib_screenAvailHeight(id) { return clib_screenDimensions(id).screenY; }

function clib_newWindowDim(w,h) {
	var xMax = clib_screenX();
	var yMax = clib_screenY();
	var x,y;
	if (w == "*") { w = xMax; x = 0; }
	else {
		if (w == null) w = clib_windowX();
		else w = Math.max(200,Math.min(w,xMax-70)) + 60;
		x = Math.floor((xMax - w)/2) + 20;
		}
	if (h == "*") { h = yMax; y = 0; }
	else {
		if (h == null) h = clib_windowY();
		else h = Math.max(200,Math.min(h,yMax-90)) + 80;
		y = Math.floor((yMax - h)/2);
		}
	return new clibx_newWindowDimType(x,y,w,h);
	}

function clib_centerWindow(id,w,h) {
	var s = clib_screenDimensions();
	mW = Math.max(0,Math.floor((s.screenX - w)/2)-5);
	mH = Math.max(0,Math.floor((s.screenY - h)/3));
	id.moveTo(mW,mH);
	}

function clib_objDimensions(obj) {
	function clib_objDimType(l,t,w,h) {
		this.members = 'left,top,width,height';
		this.left = l;
		this.top = t;
		this.width = w;
		this.height = h;
		}
	if ((obj == null) || (obj == '')) return null;
	var rgDim = new Array(null,null,obj.width,obj.height);
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			rgDim[0] += obj.offsetLeft;
			rgDim[1] += obj.offsetTop;
			if ((rgDim[2] == null) || (rgDim[2] == '')) rgDim[2] = obj.width;
			if ((rgDim[2] == null) || (rgDim[3] == '')) rgDim[3] = obj.height;
			obj = obj.offsetParent;
			}
		}
	else if (obj.x) {
		rgDim[0] += obj.x;
		rgDim[1] += obj.y;
		}
	var d = new clib_objDimType(rgDim[0],rgDim[1],rgDim[2],rgDim[3]);
	return d;
	}

function clib_changeClass(id,className) {
	if (typeof id == 'string') id = clib_getElementId(id);
	if (id) {
		if (id.className) id.className=className;
		else return -1;
		}
	else return -2;
	return 0;
	}

function clib_validateEmail(email) {
	if ((email == null) || (email == '') || (email.length < 6)) return false;
	var rg = email.split('<');
	if (rg.length > 1) {
		email = rg[rg.length-1];
		rg = email.split('>');
		if (rg.length != 2) return false;
		email = rg[0];
		}
	rg = email.split('@');
	if (rg.length != 2) return false;
	for (var i = 0; i < rg.length; i++) if (rg[i].length < 1) return false;
	rg = email.split('.');
	if (rg.length < 2) return false;
	for (i = 0; i < rg.length; i++) if (rg[i].length < 1) return false;
	return true;
	}

function clib_preLoadType(url,caller) {
	this.members = 'url,caller,img';
	this.url = url;
	this.caller = caller;
	this.img = new Image();
	this.img.src = url;
	}

function clibx_preLoadOneImage(url,caller) {
	for (var i = 0; i < clib_nrgPreLoad; i++) if (clib_rgPreLoad[i].url == url) return;
	clib_rgPreLoad[clib_nrgPreLoad++] = new clib_preLoadType(url,caller);
	}

function clibx_preLoadImageList(urlList,caller) {
	if (typeof urlList != 'string') {
		clib_debugFunction(clib_fLocal, ('Not a string: ' + typeof url));
		return;
		}
	var rgl = urlList.split(',');
	for (var i = 0; i < rgl.length; i++) {
		var url = rgl[i];
		var rg = url.split('.');
		if (rg.length < 2) clib_debugFunction(clib_fLocal,('not a valid file: ' + url));
		else clibx_preLoadOneImage(url,caller);
		}
	}

function clib_preLoadImages() {
	var rgArgs = clib_preLoadImages.arguments;
	var caller = null;
	var i;
	if (!clib_isNull(clib_preLoadImages.caller) && !clib_isNull(clib_preLoadImages.caller.arguments)) {
		caller += clib_preLoadImages.caller;
		rg = caller.split('(');
		caller = rg[0].substr(12,rg[0].length-12) + '(';
		for (i = 0; i < clib_preLoadImages.caller.arguments.length; i++) {
			if (i > 0) caller += ', ';
			caller += clib_preLoadImages.caller.arguments[i];
			}
		caller += ')';
		}
	for (i = 0; i < rgArgs.length; i++) {
		if (clib_isString(rgArgs[i])) clibx_preLoadImageList(rgArgs[i],caller);
		else if (clib_isArray(rgArgs[i])) for (var j = 0; j < rgArgs[i].length; j++) clibx_preLoadImageList(rgArgs[i][j],caller);
		else clib_debugFunction(clib_fLocal,'invalid argument: ' + (typeof rgArgs[i]));
		}
	}

function clib_preloadImageHandler(url,load,error,abort) {
	clib_debugFunction(clib_fLocal);
	var x = new clib_imageType(url,load,error,abort);
	x.image.src = url;
	return x;
	}

function clib_imageType(url,load,error,abort,w,h) {
	this.members = 'url,image,status,w,h';
	this.url = url;
	this.w = w;
	this.h = h;
	this.image = new Image();
	this.status = null;
	if (load != null) {
		eval("this.image.loadHandler = function () { " + load + " }" );
		this.image.onload = this.image.loadHandler;
		}
	if (error != null) {
		eval("this.image.errorHandler = function () { " + error + " }");
		this.image.onerror = this.image.errorHandler;
		}
	if (abort != null) {
		eval("this.image.errorHandler = function () { " + abort + " }");
		this.image.onabort = this.image.errorHandler;
		}
	if ((abort == null) && (error != null)) this.image.onabort = this.image.errorHandler;
	}

var clibx_rgPreLoadArray = new Array();
var clibx_nrgPreLoadArray = 0;
function clibx_preLoadType(rgUrl,nrgUrl) {
	this.members = 'rgUrl,nrgUrl,irgUrl,rgLoad,nrgLoad';
	this.rgUrl = rgUrl;
	this.nrgUrl = nrgUrl;
	this.irgUrl = 0;
	this.rgLoad = new Array();
	this.nrgLoad = 0;
	}

function clib_preLoadImageArray(rgUrl,nrgUrl,nUrlInit) {
	if (nUrlInit == null) nUrlInit = 3;
	var irg = clibx_nrgPreLoadArray;
	clibx_rgPreLoadArray[clibx_nrgPreLoadArray++] = new clibx_preLoadType(rgUrl,nrgUrl);
	var x = clibx_rgPreLoadArray[irg];
	var handler = 'clibx_nextPreLoadUrl(' + irg + ',' + ')';
	for (var i = 0; ((i < nUrlInit) && (i < nrgUrl)); i++) {
		var shandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',0)';
		var ehandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',1)';
		var ahandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',2)';
		x.rgLoad[x.nrgLoad] = new clib_imageType(x.rgUrl[x.irgUrl],shandler,ehandler,ahandler);
		x.rgLoad[x.nrgLoad++].image.src = x.rgUrl[x.irgUrl++];
		}
	}

function clibx_preLoadHandler(irg,irgLoad,status) {
	var x = clibx_rgPreLoadArray[irg];
	if (clib_fLocal) x.rgLoad[irgLoad].status = status;
	else x.rgLoad[irgLoad] = null;
	setTimeout('clibx_nextPreLoadUrl(' + irg + ')',20);
	}

function clibx_nextPreLoadUrl(irg) {
	var x = clibx_rgPreLoadArray[irg];
	if (x.nrgLoad < x.nrgUrl) {
		var shandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',0)';
		var ehandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',1)';
		var ahandler = 'clibx_preLoadHandler(' + irg + ',' + x.nrgLoad + ',2)';
		x.rgLoad[x.nrgLoad] = new clib_imageType(x.rgUrl[x.irgUrl],shandler,ehandler,ahandler);
		x.rgLoad[x.nrgLoad++].image.src = x.rgUrl[x.irgUrl++];
		}
	}

function clib_innerHTML(div,html) {
	clib_checkHTML(html);
	var id = clib_getElementId(div);
	if (id == null) return true;
	id.innerHTML = html;
	return false;
	}

function clib_writeln(html,div,fAutoDiv) {
	clib_checkHTML(html);
	if ((fAutoDiv == null) || (div == null)) fAutoDiv = false;
	if (fAutoDiv) {
		if (clib_isElementId(div)) clib_innerHTML(div,html);
		else document.writeln('<div id=' + div + '>' + html + '</div>');
		}
	else {
		if (div == null) document.write(html);
		else clib_innerHTML(div,html);
		}
	}

function clib_checkHTML(html) { if (typeof clibdb_checkHTML == 'function') clibdb_checkHTML(html); }

function clib_placeDiv(div, x, y, z, fVisible) {
	function px(n) {
		if (typeof n == 'undefined') return null;
		if (typeof n == 'number') return n + 'px';
		if (typeof n == 'string') clib_debugFunction(n.charAt(n.length-1) != 'x');
		return n;
		}
	x = px(x);
	y = px(y);
	var id = clib_getElementId(div);
	if (id == null) return true;
	if (fVisible != null) id.style.visibility=(fVisible ? "visible" : "hidden");
	if (x != null) id.style.left = x;
	if (y != null) id.style.top = y;
	if (z != null) id.style.zIndex = z;
	return false;
	}

function clib_centerDiv(id,w,h,z) {
	if (typeof z == 'undefined') z = null;
	var xW,yW,xO,yO;
	clibx_wAlert = w;
	clibx_hAlert = h;

	if (window.innerWidth == null) {	// IE 4+
		xW = document.body.clientWidth;
		xO = document.body.scrollLeft;
		yW = document.body.clientHeight;
		yO = document.body.scrollTop; 
		}
	else {								// NS 4+
		xW = window.innerWidth;
		xO = window.pageXOffset;
		yW = window.innerHeight;
		yO = window.pageYOffset;
		}
	var x = Math.max(20,Math.floor((xW-w)/2) + xO); 
	var y = Math.max(20,Math.floor((yW-h-100)/2) + yO);
	var f = clib_placeDiv(id,x,y,z,true);
	return { x:x, y:y, fFail:f }
	}

function clib_clipDiv(div,x,y,w,h) {
	var id = clib_getElementId(div);
	if ((id == null) || (x == null) || (y == null) || (w == null) || (h == null)) return; 
	else id.style.clip='rect(' + y + 'px ' + (x+w) + 'px ' + (y+h) + 'px ' + x + 'px)'
	}

// change HTML if function changes!

var clib_getId_html  = "function getId(name){ if ((name == null) || (name == '')) return null; var o = null;\n";
	clib_getId_html += "  if (document.getElementById) { o = eval('document.getElementById(" + '"' + "' + name + '" + '"' + ")'); if (o != null) return o; }\n";
	clib_getId_html += "  if (document.all) { o = eval('document.all.' + name); if (o != null) return o; }\n";
	clib_getId_html += "  if (document.images) { o = eval('document.images.' + name); if (o != null) return o; }\n";
	clib_getId_html += "  return null; }\n";

function clib_isElementId(name) {
	var o = clib_getElementId(name);
	return !(o == null);
	}

function clib_getElementId(name){
	if ((name == null) || (name == '')) return null;
	var o = null;
	if (document.getElementById) {
		o = eval('document.getElementById("' + name + '")');
		if (o != null) return o;
		}
	if (document.all) {
		o = eval('document.all.' + name);
		if (o != null) return o;
		}
	if (document.images) {
		o = eval('document.images.' + name);
		if (o != null) return o;
		}
	return null;
	}

function clib_xidType(name) { this.members = 'name,num'; this.name = name; this.num = 1000; }
var clib_rgxid = new Array();
clib_rgxid[0] = new clib_xidType('clib');
var clib_nrgxid = 1;
var clib_lastElementId = null;
function clib_newElementId(name) {	
	if (name == null) name = 'clib';
	for (var i = 0; i < clib_nrgxid; i++) if (clib_rgxid[i].name == name) break;
	if (i == clib_nrgxid) clib_rgxid[clib_nrgxid++] = new clib_xidType(name);
	clib_rgxid[i].num++;
	var id = 'id_' + name + '_' + clib_rgxid[i].num;
	clib_lastElementId = id;
	return id;
	}

function clib_fFadeObject(name) {
	var id = clib_getElementId(name);
	if ((id != null) && (id.filters) && (id.filters.blendTrans)) return true;
	return false;
	}

function clib_imageHtml(idImg,url,w,h,border,alt,imgClass,imgStyle,imgExtras,divClass,divStyle,aUrl,aTarget,aClass,aStyle) {
	var html = '';
	clib_rgBlendDiv[clib_nrgBlendDiv++] = new clibx_blendImgType(idImg,url);
	var d = clib_rgBlendDiv[clib_nrgBlendDiv-1];
	html += '<div id="' + d.idDiv + '"' + (divClass == null ? '' : ' class="' + divClass + '"');
	html += ' style="background-image:url(' + clib_urlBlank + '); background-repeat:no-repeat; width:' + w + 'px; height:' +h + 'px;';
	html += (divStyle == null ? '' : divStyle) + '">';
	if (aUrl != null) {
		html += '<a href="' + aUrl + '"';
		if (aTarget != null) html += ' target=' + aTarget;
		if (aClass != null) html += ' class=' + aClass;
		if (aStyle != null) html += ' style="' + aStyle + '"';
		html += '>';
		}
	html += '<img id="' + idImg + '" src="' + url + '"';
	if (imgStyle == null) imgStyle = '';
	imgStyle += 'filter:alpha(opacity=100); -moz-opacity:100; opacity:100; filter:blendTrans(duration=1.5);';
	if (w != null) html += ' width="' + w + '"';
	if (h != null) html += ' height="' + h + '"';
	if (border != null) html += ' border="' + border + '"';
	if (imgClass != null) html += ' class="' + imgClass + '"';
	if (imgStyle != null) html += ' style="' + imgStyle + '"';	
	if (alt != null) html += ' title="' + alt + '"';
	if (imgExtras != null) html += ' ' + imgExtras;
	html += '>';
	if (aUrl != null) html += '</a>';
	html += '</div>';
	return html;
	}

function clibx_blendImgType(idImg,url) {
	this.members = 'idImg,idDiv,url,urlLast,fFading,idTimeout,timeoutTic,nSec,opacity,opacityTic';
	this.idImg = idImg;
	this.idDiv = idImg + clibx_blendDivSuf;
	this.url = url;
	this.urlLast = null;
	this.fFading = false;
	this.idTimeout = null;
	this.timeoutTic = null;
	this.nSec = null;
	this.opacity = null;
	this.opacityTic = null;
	}

function clib_swapImage(idImg,url,nSec,w,h) {
	function clibx_fBlendDiv() {
		for (var i = 0; i < clib_nrgBlendDiv; i++) if (clib_rgBlendDiv[i].idImg == idImg) {
			hn = i;
			d = clib_rgBlendDiv[hn];
			return true;
			}
		return false;
		}
	var fIeFade = false;
	var fMzFade = false;
	var d = null;
	var hn = null;
	var id = clib_getElementId(idImg);
	var fBlendDiv = clibx_fBlendDiv();
	var idDiv = (fBlendDiv ? clib_getElementId(d.idDiv) : null);
	if ((id == null) || (url == null)) { clib_debugFunction(clib_fLocal,'null id/url'); return true; }
	var fChangedSize = false;
	if (w != null) if (w != id.width) { id.width = w; if (fBlendDiv) idDiv.style.width = w + 'px'; fChangedSize = true; }
	if (h != null) if (h != id.height) { id.height = h; if (fBlendDiv) idDiv.style.height = h + 'px'; fChangedSize = true; }
	if (fBlendDiv && (d.fFading || (d.idTimeout != null))) {
		clearTimeout(d.idTimeout);
		d.idTimeout = null;
		d.fFading = false;
		if ((nSec == null) || (nSec == 0)) clib_imageOpacity(idImg,100);
		}
	if ((nSec != null) && (nSec > 0)) {
		if (id.filters) if (id.filters.blendTrans) fIeFade = clibx_fUseIeFade;
		fMzFade = (!fIeFade && fBlendDiv);
		}
	if (fIeFade) {
		var fFadeOK = (id.filters.blendTrans.status == 0);
		if (fFadeOK) id.filters[0].apply();
		id.src = url;
		if (fFadeOK) { id.filters.blendTrans.duration = nSec; id.filters[0].play(); }
		}
	else if (fMzFade) {
		idDiv.style.backgroundImage = 'url(' + d.url + ')';		// 1. set div.background to old image
		clib_imageOpacity(idImg,0);								// 2. set img.opacity to 0
		d.opacity = 0;
		id.src = url;											// 3. set img.src to new image
		d.timeoutTic = Math.max(clibx_minMsTic,nSec * 10);		// 4. set timers to fade image over nSec time
		var nTics = (nSec * 1000) / d.timeoutTic;
		d.opacityTic = Math.max(1,Math.floor(100/nTics));
		d.fFading = true;
		d.nSec = nSec;
		d.idTimeout = setTimeout('clibx_fadeImage(' + hn + ')',d.timeoutTic);
		}
	else id.src = url;
	if (d != null) {
		d.urlLast = d.url;
		d.url = url;
		}
	return false;
	}

function clibx_fadeImage(hn) {
	if ((typeof hn != 'number') || (hn >= clib_nrgBlendDiv) || (hn < 0)) { clib_debugFunction(clib_fLocal); return; }
	var d = clib_rgBlendDiv[hn];
	if (!d.fFading) { clib_debugFunction(clib_fLocal, 'not fading: ' + hn); return; }
	d.idTimeout = null;
	d.opacity += d.opacityTic;
	if (d.opacity >= 99) d.opacity = 100;
	clib_imageOpacity(d.idImg,d.opacity);
	if (d.opacity < 100) d.idTimeout = setTimeout('clibx_fadeImage(' + hn + ')',d.timeoutTic);
	else {
		d.fFading = false;
		var idDiv = clib_getElementId(d.idDiv);
		idDiv.style.backgroundImage = 'url(' + d.url + ')';
		}
	}

function clib_imageOpacity(idImg,opacity) {
	var id = clib_getElementId(idImg);
	if ((id == null) || (typeof opacity != 'number')) return true;
	var object = id.style;
	object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	}

var clib_rgSlideShow = new Array();
var clib_nrgSlideShow = 0;

function clib_slideShowType(id,nrg,interval,fade,fRandom,fReverse,callback,wLast,hLast) {
	this.members = 'id,interval,fade,fRandom,fReverse,fLoading,nShown,idTimeout,fPause,callback,wLast,hLast,imgBlank,fShowingBlank,pResize,status,nrg,irg,rgImg,rgirgImg';
	this.id = id;
	this.interval = interval;
	this.fade = (fade == null ? 0 : fade);
	this.fRandom = fRandom;
	this.fReverse = fReverse;
	this.fLoading = false;
	this.nShown = 0;
	this.idTimeout = null;
	this.fPause = false;
	this.callback = callback;
	this.wLast = wLast;
	this.hLast = hLast;
	this.imgBlank = null;
	this.fShowingBlank = false;
	this.pResize = 1.0;
	this.status = null;
	this.nrg = nrg;
	this.irg = 0;
	this.rgImg = new Array();
	this.rgirgImg = new Array();
	}

function clib_slideShowShuffle(is,fSkipFirst) {
	function swap(i,j) {
		var tempi = rg[i];
		var tempj = rg[j];
		rg[i] = tempj;
		rg[j] = tempi;
		}
	if (fSkipFirst == null) fSkipFirst = false;
	var s = clib_rgSlideShow[is];
	var rg = clib_rgSlideShow[is].rgirgImg;
	var i = s.nrg;
	if ( i == 0 ) return;
	if (fSkipFirst) {
		swap(rg.length-1,0);
		i--;
		}
	while ( --i ) {
		var j = Math.floor( Math.random() * ( i + 1 ) );
		swap(i,j);
		}
	if (fSkipFirst) swap(rg.length-1,0);
	}

function clib_slideShow(id,rgUrl,nrgUrl,interval,fade,fRandom,fReverse,callback,wInit,hInit,imgBlank) {
	if (fRandom == null) fRandom = false;
	if (fReverse == null) fReverse = false;
	if (typeof callback == 'undefined') callback = null;
	var hn = clib_nrgSlideShow++;
	clib_rgSlideShow[hn] = new clib_slideShowType(id,nrgUrl,interval,fade,fRandom,fReverse,callback,wInit,hInit,imgBlank);
	var s = clib_rgSlideShow[hn];
	if ((wInit == null) && clib_isObject(rgUrl[0])) wInit = rgUrl[0].w;
	if ((hInit == null) && clib_isObject(rgUrl[0])) hInit = rgUrl[0].h;
	s.wLast = wInit;
	s.hLast = hInit;
	if (clib_isString(imgBlank)) {
		s.imgBlank = new Image();
		s.imgBlank.src = imgBlank;
		}
	for (var i = 0; i < nrgUrl; i++) {
		var url = null;
		var w = null;
		var h = null;
		if (clib_isObject(rgUrl[i])) {
			url = rgUrl[i].url;
			w = rgUrl[i].w;
			h = rgUrl[i].h;
			}
		else url = rgUrl[i];
		var x = 'clib_rgSlideShow[' + hn + '].rgImg[' + i + '].status = ';
		s.rgImg[i] = new clib_imageType(url,x + 'true', x + 'false', x + 'false',w,h);
		s.rgImg[i].image.src = url;
		s.rgirgImg[i] = i;
		}
	if (fRandom) clib_slideShowShuffle(hn,true);
	s.idTimeout = setTimeout('clib_doSlideShow(' + hn + ')',interval);
	return hn;
	}

function clib_doSlideShow(hn,irg) {
	if ((hn == null) || (hn < 0) || (hn >= clib_rgSlideShow.length)) return false;
	var s = clib_rgSlideShow[hn];
	var log = '';
	s.fLoading = true;
	if (!clib_isNumber(irg)) irg = s.irg + (s.fReverse ? -1 : 1);	
	if (s.idTimeout != null) { clearTimeout(s.idTimeout); s.idTimeout = null; }
	for (var j = 0; j < s.nrg; j++) {			// go through array looking for a loaded picture, skipping errors
		irg = irg + j;
		if (irg >= s.nrg) irg = irg - s.nrg;
		else if (irg < 0) irg = irg + s.nrg;
		log += '\nchecking irg=' + irg;
		var status = s.rgImg[s.rgirgImg[irg]].status;
		if (status == null) {
			if (s.rgImg[s.rgirgImg[irg]].image.complete) {
				status, s.rgImg[s.rgirgImg[irg]].status = true;
				}
			else if (!s.fRandom) {								// if not fRandom do nothing and wait for it to load
				s.idTimeout = setTimeout('clib_doSlideShow(' + hn + ')',100);
				if (s.callback != null) eval(s.callback);
				s.status = 'waiting for ' + s.rgImg[s.rgirgImg[irg]].url + ' [irg=' + irg + ']' + log;
				return;
				}
			}
		if (status == true) {					// image is ready
			var time = s.fade;
			var msNextPic = s.interval;
			var img = s.rgImg[s.rgirgImg[irg]];
			if (s.fShowingBlank) {				// last image was blank
				irg = s.irg;
				time = time/2;
				s.wLast = img.w;
				s.hLast = img.h;
				s.fShowingBlank = false;
				}
			var url = img.url;
			var w = img.w;
			var h = img.h;
			if ((time > 0) && ((img.w != s.wLast) || (img.h != s.hLast))) {	// next image is a different size
				time = time/2;
				if (s.imgBlank != null) url = s.imgBlank.src;
				msNextPic = Math.floor(time * 1000 + 50);
				w = s.wLast;
				h = s.hLast;
				s.fShowingBlank = true;
				}
			clib_swapImage(s.id,url,time,w == null ? null : Math.floor(w * s.pResize),h == null ? null : Math.floor(h * s.pResize));
			s.wLast = w;
			s.hLast = h;		
			if (!s.fShowingBlank) s.nShown++;
			s.fLoading = false;
			s.irg = irg;
			if (s.fRandom) if (s.nShown % s.nrg == 0) clib_slideShowShuffle(hn);
			if (!s.fPause) {
				s.idTimeout = setTimeout('clib_doSlideShow(' + hn + ')',msNextPic);
				}
			if (s.callback != null) eval(s.callback);
			s.status = (s.fPause ? 'paused ' : '') + 'showing ' +img.url + ' [irg=' + s.rgirgImg[irg] + ']' + log;
			return;
			}
		// else if (status == false) {}			// try next pic because this had error or was not ready and fRandom is set
		}
	if (!s.fPause) {
		s.idTimeout = setTimeout('clib_doSlideShow(' + hn + ')',s.interval);
		}
	if (s.callback != null) eval(s.callback);
	s.status = 'waiting for an image' + ' [irg=' + irg + ']' + log;
	return;
	}

function clib_slideShowControl(hn,fPause,interval,fade,fRandom,fReverse,pResize) {
	if ((hn == null) || (hn < 0) || (hn >= clib_rgSlideShow.length)) return false;
	var s = clib_rgSlideShow[hn];
	if (interval != null) s.interval = interval;
	if (fade != null) s.fade = fade;
	if (fRandom != null) s.fRandom = fRandom;
	if (fReverse != null) s.fReverse = fReverse;
	if (pResize != null) s.pResize = pResize;
	if ((fPause != null) && (fPause != s.fPause)) {
		s.fPause = fPause;
		if (fPause) if (s.idTimeout!= null) { clearTimeout(s.idTimeout); s.idTimeout = null; return;}
		clib_doSlideShow(hn);
		}
	}

function clibx_sirType(name) {
	this.members = 'name,url';
	this.name = name;
	this.url = null;
	}
var clibx_rgSir = new Array();
var clibx_nrgSir = 0;

function clib_swapImageRandom(nameList,fileList,nSec) {
	function irgSir(name) {
		for (var i = 0; i < clibx_nrgSir; i++) if (clibx_rgSir[i].name == name) return i;
		clibx_rgSir[clibx_nrgSir++] = new clibx_sirType(name);
		return (clibx_nrgSir - 1);
		}
	var rgn = nameList.split(",");
	var rgf = fileList.split(",");
	if ((rgn.length <= 1) && (rgf.length <= 1)) return clib_swapImage(nameList,fileList,nSec);
	var iname = Math.floor(Math.random()*rgn.length);
	var name = rgn[iname];
	var iurl = Math.floor(Math.random()*rgf.length);
	var url = rgf[iurl];
	var last = clibx_rgSir[irgSir(name)];
	if ((rgf.length > 1) && (last.url == url)) {
		iurl++;
		if (iurl >= rgf.length) iurl = 0;
		url = rgf[iurl];
		}
	last.url = url;
	clib_swapImage(name,url,nSec);
	}

function clib_mouseoverLinkHTML(name,url,classN,classHL) {
	url = clib_unhideUrl(url);
	var id = clib_newElementId();
	var html = '<a onmouseover="' + "clib_changeClass('" + id + "','" + classHL + "')" + '" ';
	html += 'onmouseout="' + "clib_changeClass('" + id + "','" + classN + "')" + '" ';
	html += 'href="' + url + '"><p id=' + id + ' class=' + classN + '>' + name + '</p></a>';
	return html;
	}

function clib_mouseoverImageHTML(url, imgN,imgHL, align, w,h, classN,classHL, onclick,onover,onout, alt,target) {
	url = clib_unhideUrl(url);
	imgN = clib_unhideUrl(imgN);
	imgHL = clib_unhideUrl(imgHL);
	var fLink = (url != null);
	var fClass = ((classN != null) && (classN != ''));
	var fSwapClass = (fClass && ((classHL != null) && (classHL != '')));
	var fSwapImg = ((imgHL != null) && (imgHL != imgN));
	var id = clib_newElementId();
	var html = '';
	if (fLink) {
		html += '<a href="' + url + '"';
		if (target != null) html += ' target="' + target + '"';
		html += '>';
		}
	html += '<img id=' + id;
	if (fClass) html += ' class=' + classN;
	html += ' src="' + imgN + '"' + ( w!= null ? ' width=' + w : '' ) + ( h!= null ? ' height=' + h : '' );
	if ((onover != null) || fSwapClass || fSwapImg) {
		html += ' onmouseover="';
		if (onover != null) html += onover + ';';
		if (fSwapClass) html += "clib_changeClass('" + id + "','" + classHL + "');";
		if (fSwapImg) html += "clib_swapImageRandom('" + id + "','" + imgHL + "');";
		html += '"';
		}
	if ((onout != null) || fSwapClass || fSwapImg) {
		html += ' onmouseout="';
		if (onout != null) html += onout + ';';
		if (fSwapClass) html += "clib_changeClass('" + id + "','" + classN + "');";
		if (fSwapImg) html += "clib_swapImage('" + id + "','" + imgN + "');";
		html += '" ';
		}
	if (onclick != null) html += ' onclick="' + onclick + '"';
	if (align != null) html += ' align=' + align;
	if (alt != null) html += ' title="' + alt + '"';
	html += ' border=0>';
	if (fLink) html += '</a>';
	return html;
	}

function clib_openWin(url,windowName,params) {
	url = clib_unhideUrl(url);
	if (clib_fLocal) clib_debugFunction(true);
	return clib_newWindow(url,windowName,params);
	}

function clib_newWindow(url,windowName,params) {
	url = clib_unhideUrl(url);
	var id;
	if (windowName == null) windowName = "_new";
	var openString = 'id=wind' + 'ow.op' + 'en(';
	if (params==null) openString += 'url,windowName)';
	else openString += 'url,windowName,params)';
	eval(openString);
	id.focus();
	return id;
	}

// popup magic ***************************************************************************************************
//

var clibx_rgWindowId = new Array();
var clibx_nrgWindowId = 0;
var clibx_iWindowName = 0;

function clib_popupImage(url,urlz,wWin,hWin,title,bgColor) {
	url = clib_unhideUrl(url);
	urlz = clib_unhideUrl(urlz);
	if (clib_isNull(title)) title = url;
	if (clib_isNull(bgColor)) bgColor = "white";
	var s = clibx_getPopupWindowInfo(wWin,hWin,null);
	var html = '<table border=0 cellpadding=0 cellspacing=0 width="100%" height="80%"><tr><td align=center valign=middle>';
	if (urlz != null) html += '<a href="' + urlz + '" target=_blank>';
	html += '<img src="' + url + '" title="' + title + '" border=0>';
	if (urlz != null) html += '</a><br>(click on image to zoom)';
	html += '</td></tr></table>';
	html = clibx_getPopupHtml(title,null,' bgcolor=' + bgColor,html,s.fFullScreen);
	var id = clib_newWindow("",s.name,s.params);
	clibx_rgWindowId[clibx_nrgWindowId++] = id;
	if (s.fNeedResize) {
		id.moveTo(s.wLoc,s.hLoc);
		id.resizeTo(s.wWin,s.hWin);
		id.document.write(html);
		id.moveTo(s.wLoc,s.hLoc);
		}
	else id.document.write(html);
	id.focus();
	return id;
	}

function clib_popupPage(url,wWin,hWin,title,name) {
	url = clib_unhideUrl(url);
	if (clib_isNull(title)) title = url;
	var s = clibx_getPopupWindowInfo(wWin,hWin,name);
	var id = clib_newWindow(url,s.name,s.params);
	clibx_rgWindowId[clibx_nrgWindowId++] = id;
	if (s.fNeedResize) {
		id.moveTo(s.wLoc,s.hLoc);
		id.resizeTo(s.wWin,s.hWin);
		id.moveTo(s.wLoc,s.hLoc);
		}
	id.focus();
	return id;
	}

function clib_popupHtml(html,wWin,hWin,params,name) {
	if (clib_isNull(html)) html = '<html><body><h1>no html</h1></body></html>';
	var s = clibx_getPopupWindowInfo(wWin,hWin,name);
	if (params == null) params = s.params;
	var id = clib_newWindow("",s.name,params);
	clibx_rgWindowId[clibx_nrgWindowId++] = id;
	if (s.fNeedResize) {
		id.moveTo(s.wLoc,s.hLoc);
		id.resizeTo(s.wWin,s.hWin);
		id.document.write(html);
		id.moveTo(s.wLoc,s.hLoc);
		}
	else id.document.write(html);
	id.focus();
	return id;
	}

function clibx_getPopupHtml(title,head,bodyP,bodyH,fFullScreen) {
	var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n';
	html += '<html>\n<head>\n<title>' + title + '</title>\n';
	html += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n';
	html += '<meta name="Author" content="' + clibx_getFunctionName(clibx_getPopupHtml.caller) + '()">\n';
	if (head != null) html += head + '\n';
	if (fFullScreen) {
		html += '<sty' + 'le>\n';
		html += '.closeButton { cursor:pointer; font-size:10px; color:black; background-color:white; border-type:inset; border-width:3px; border-color:gray; margin:0px; }\n';
		html += '</style>\n';
		}
	html += '</head>\n<body' + (bodyP == null ? '' : ' ' + bodyP) + '>\n';
	if (fFullScreen) {
		html += '<table border=0 cellpadding=0 cellspacing=0 width="100%">';
		html += '<tr><td align=right><button class=closeButton onclick="window.close()">CLOSE</button></td></tr></table>';
		}
	if (bodyH != null) html += bodyH;
	html += '\n</body>\n</html>\n';
	return html;
	}

function clibx_popupWindowInfoType(wWin,hWin,wLoc,hLoc,fFullScreen,fNeedResize,name,params) {
	this.members = 'wWin,hWin,wLoc,hLoc,fFullScreen,fNeedResize,name,params';
	this.wWin = wWin;
	this.hWin = hWin;
	this.wLoc = wLoc;
	this.hLoc = hLoc;
	this.fFullScreen = fFullScreen;
	this.fNeedResize = fNeedResize;
	this.name = name;
	this.params = params;
	}

function clibx_getPopupWindowInfo(wWin,hWin,name) {
	var fFullScreenOK=false;
	var xMax = clib_screenX();
	var yMax = clib_screenY();
	var wLoc,hLoc;
	if (wWin == "*") { wWin = xMax; wLoc = 0; }
	else {
		if (wWin == null) wWin = clib_windowX();
		else wWin = Math.max(200,Math.min(wWin,xMax-70)) + 60;
		wLoc = Math.floor((xMax - wWin)/2) + 20;
		}
	if (hWin == "*") { hWin = yMax; hLoc = 0; }
	else {
		if (hWin == null) hWin = clib_windowY();
		else hWin = Math.max(200,Math.min(hWin,yMax-90)) + 80;
		hLoc = Math.floor((yMax - hWin)/2);
		}
	var fFullScreen = (fFullScreenOK && (wWin == xMax) && (hWin == yMax));
	var fNeedResize = (!fFullScreen && (wWin == xMax) && (hWin == yMax));
	var params = '';
	if (fFullScreen) params += 'fullscreen=yes';
	else {
		params += 'width=' + wWin + ', height=' + hWin + ', top=' + hLoc + ', left=' + wLoc;
		params += ', titlebar=no, status=no, location=no, menu=yes, toolbar=no, dependent=yes, scrollbars=yes, resizable=yes';
		}
	if ((typeof name != 'string') || (name == '')) name = '_new_' + clibx_iWindowName++;
	return new clibx_popupWindowInfoType(wWin,hWin,wLoc,hLoc,fFullScreen,fNeedResize,name,params);
	}

function clib_closeAllPopups() {
	for (var i = 0; i < clibx_nrgWindowId; i++) clibx_rgWindowId[i].close();
	}

function clib_showConfirm(msg,callback) {
	if (callback == null) return window.confirm(msg);
	else if (!clib_fUseAlert) eval(callback + '(' + confirm(msg) + ')');
	else clib_showAlert(msg,null, null,null, true, callback);
	}

function clib_focus(name) {
	var id=clib_getElementId(name);
	if (id != null) id.focus();
	}

function clib_showPicWithLink(t,w,h,link,fCenter) {
	if (fCenter == null) fCenter = false;
	var xid;
	var s = clib_newWindowDim(w,h);
	var params = 'width=' + s.w + ',height=' + s.h + ',scrollbars=yes,resizable=yes';
	if (link == null) {
		xid=clib_newWindow(t,'_pic',params);
		if (fCenter) xid.moveTo(s.x,s.y);
		xid.resizeTo(s.w,s.h);
		}
	else {
		xid=clib_newWindow("",'_pic',"replace," + params);
		if (fCenter) xid.moveTo(s.x,s.y);
		xid.resizeTo(s.w,s.h);
		var html = '<HTML><HEAD><TITLE>' + t + '</TITLE></HEAD><BODY>\n';
		html += '<center><a href="' + link + '"><img src="' + t + '" border=0></a></center>\n';
		html += '</BODY></HTML>\n';
		xid.document.write(html);
		}
	xid.focus();
	return xid;
	}

function clib_openWinWithHtml(name,w,h,html) {
	var xid;
	var s = clib_newWindowDim(w,h);
	var params = 'width=' + s.w + ',height=' + s.h + ',scrollbars=yes,resizable=yes';
	xid=clib_newWindow("",name,"replace," + params);
	xid.document.write(html);
	xid.moveTo(s.x,s.y);
	xid.resizeTo(s.w,s.h);
	xid.focus();
	return xid;
	}

var clib_spUrl = null;
var clib_spW = null;
var clib_spH = null;

function clib_showPicUrl() {
	if (clib_spUrl == null) return;
	clib_showPicWithLink(clib_spUrl,clib_spW,clib_spH,null,true);
	clib_spUrl = null;
	clib_spW = null;
	clib_spH = null;
	}

function clib_showPic(img,msg,wImg,hImg,url,wUrl,hUrl,onClose,tableClass,onPrev,urlPrev,onNext,urlNext,onUrl) {
	img = clib_unhideUrl(img);
	if (img == null) return;
	if (!clib_fUseAlert) return clib_showPicWithLink(img,wImg,hImg);
	if (msg == null) msg = '&nbsp;';
	if (wImg == null) wImg = 600;
	if (hImg == null) hImg = 400;
	var fPrevNext = ((onNext != null) || (onPrev != null));
	var fgDismiss = (!fPrevNext && (url == null));
	clib_spUrl = url;
	clib_spW = wUrl;
	clib_spH = hUrl;
	var html = '';
	if (fgDismiss) html += '<a onClick="clib_hideAlert()" href="javascript:clib_hideAlert()" style="cursor:pointer; text-decoration:none">';
	html += '<table align="center"';
	if (clib_isString(tableClass)) html += ' class=' + tableClass;
	else html += ' style="border-style:double; border-color:#CCCCCC; border-width:6px; background-color:#CCCCCC"';
	html += ' border=0 width=' + wImg + '>';
	html += '<tr><th width="5%">&nbsp;</th><th width="10%">';
	if (onPrev != null) {
		if (urlPrev != null) html += '<img src="' + urlPrev + '" onclick="' + onPrev + '" border=0 style="cursor:pointer;">';
		else html += '<button onclick="' + onPrev + '" style="cursor:pointer;font-size:10px;font-weight:normal;">prev</button>';
		}
	html += '</th><th width="70%" align=center><font color="#000000">' + msg + '</font></th><th width="10%">';
	if (onNext != null) {
		if (urlNext != null) html += '<img src="' + urlNext + '" onclick="' + onNext + '" border=0 style="cursor:pointer;">';
		else html += '<button onclick="' + onNext + '" style="cursor:pointer;font-size:10px;font-weight:normal;">next</button>';
		}
	html += '</th><th align="center" width="5%">';
	if (!fgDismiss) html += '<a onClick="clib_hideAlert()" href="javascript:clib_hideAlert()" style="cursor:pointer;text-decoration:none;">';
	html += '<button style="cursor:pointer;color:white;background-color:#D82C38;font-size:8px;font-weight:bold;">X</button>';
	if (!fgDismiss) html += '</a>';
	html += '</th></tr>';
	html += '<tr><td colspan=5 align="center">';
	if (fPrevNext && (url != null)) html += '<a onClick="clib_hideAlert()" href="javascript:clib_hideAlert()" style="cursor:pointer;text-decoration:none;">';
	html += '<img src="' + img + '" border=0 width=' + wImg + ' height=' + hImg + ' style="cursor:';
	if (url == null) html += 'default">';
	else html += 'pointer" onclick="' + (onUrl == null ? 'clib_showPicUrl()' : onUrl) + '">';
	if (fPrevNext && (url != null)) html += '</a>';
	html += '</td></tr></table>';
	if (fgDismiss) html += '</a>';
	clib_innerHTML(clib_alertDiv,html);
	clibx_onAlertClose = onClose;
	clibx_placeAlert(wImg,hImg);
	}

function clibx_placeAlert(w,h,z) {
	if (z == null) z = 999;
	clibx_wAlert = w;
	clibx_hAlert = h;
	var s = clib_centerDiv(clib_alertDiv,w,h,z);
	clibx_xAlert = s.x;
	clibx_yAlert = s.y;
	if (s.fFail) {
		clib_fUseAlert = false;
		clibx_fAlert = false;
		}
	else setTimeout("clibx_fAlert=true",10);
	clib_focus(clib_alertDiv);
	}

var clibx_onAlertClose = null;
var clibx_fAlert = false;
var clibx_xAlert = null;
var clibx_yAlert = null;
var clibx_wAlert = null;
var clibx_hAlert = null;
var clibx_callback = null;
var clibx_fYesNo = null;
var clibx_fCallback = null;

function clib_showAlertStyleType () {
	this.members = 'aEnclosure,tEnclosure,sMessage,button';
	this.aEnclosure = "cursor:pointer; text-decoration:none";
	this.tEnclosure = "";
	this.sMessage = "";
	this.button = "cursor:pointer;width:40px;font-size:xx-small;background-color:silver;color:black;border:3px outset";
	}
var clib_showAlertStyle = new clib_showAlertStyleType ();

function clib_showAlert(msg1,msg2,img1,img2,fYesNo,callback) {
	if (msg1 == null) return;
	else if (msg1 == "") return;
	var s = clib_showAlertStyle;
	if (fYesNo == null) fYesNo = false;
	if (img1==null) img1 = (fYesNo ? clib_urlQuestion : clib_urlCaution);
	if (img2==null) img2 = (fYesNo ? clib_urlQuestion : clib_urlCaution);
	clibx_fYesNo = fYesNo;
	clibx_callback = callback;
	clibx_fCallback = null;
	if (clib_fUseAlert) {
		var x,y,xO,yO;
		var html = '';
		html += '<a onClick="clib_hideAlert();" href="javascript:clib_hideAlert()" style="' + s.aEnclosure + '">\n';
		html += '<table border=0 cellpadding=0 cellspacing=0 align=center><tr><td>';
		html += '<img id=clib_a_topleft border=0 width=1 height=1 src="' + clib_urlBlank + '"></td></tr><tr><td>';
		html += '<table align="center" width="' + clib_alertx + '"' + (s.tEnclosure == "" ? ' bgcolor="#CCCCCC" border=1' : '" style="' + s.tEnclosure + '"') + '>';
		html += '<tr><td align="center" valign="middle">\n';
		html += '<table border="0" align=center width="90%"><tr><td align="left" valign="middle"><font color="#000000"><span style="' + s.sMessage + '">\n\n';
		html += clib_convertAlertText(msg1,true);
		html += '\n\n</span></font></td></tr></table>';
		html += '</td><td align=center valign="middle" width="' + clib_alertx2 + '">';
		html += '<br><img src="' + img1 + '" border=0 onclick="clib_hideAlert()" style="cursor:pointer"><br><br>';
		if (fYesNo) {
			html += '<button style="' + s.button + '" onclick="clibx_fCallback = true;">Yes</button><br><br>';
			html += '<button style="' + s.button + '" onclick="clibx_fCallback = false;">No</button><br>&nbsp;';
			}
		else {
			html += '<button style="' + s.button + '" onclick="clib_hideAlert()">OK</button><br>&nbsp;';
			}
		html += '</td></tr></table>\n';
		html += '</td></tr><tr><td align=right>';
		html += '<img align=right id=clib_a_bottomright border=0 width=1 height=1 src="' + clib_urlBlank + '">';
		html += '</td></tr></table></a>\n';
		clib_innerHTML(clib_alertDiv,html);
		var tl = clib_objDimensions(clib_getElementId('clib_a_topleft'));
		var br = clib_objDimensions(clib_getElementId('clib_a_bottomright'));
		var wAlertBox = clib_alertx;
		var hAlertBox = 200;
		function checkNums(tl,br) {
			if ((tl == null) || (br == null)) return false;
			if ( isNaN(tl.left) || isNaN(tl.top) || isNaN(br.left) || isNaN(br.top) ) return false;
			return true;
			}
		if (checkNums(tl,br)) {
			wAlertBox = Math.max(wAlertBox,br.left-tl.left);
			hAlertBox = Math.max(hAlertBox,br.top-tl.top);
			}

		clibx_placeAlert(wAlertBox,hAlertBox);
		if (clib_fUseAlert) {		// might have been set false due to error
			if (msg2 != null) {
				clib_alertMsg2 = msg2;
				clib_alertImg2 = img2;
				}
			}
		}
	if (!clib_fUseAlert) {
		var m = clib_convertAlertText(msg1,false);
		if (m == "") return;
		alert(m);
		focus();
		m = clib_convertAlertText(msg2,false);
		if (m == "") return;
		alert(m);
		focus();
		if (clib_fDebug) clib_fUseAlert=!clib_fUseAlert;
		}
	}

function clib_convertAlertText(sb,fHtml) {
	var m = "";
	if (sb == null) return m;
	if (sb == "") return m;
	if (typeof sb == 'number') sb += '';
	var iStart = 0;
	if (sb.charAt(iStart) == '!') {
		if (!fHtml) return m;
		else iStart++;
		}
	for (var i = iStart; i < sb.length; i++) {
		if (sb.charAt(i) == '~') {
			if (fHtml) m += '<br>';
			else m += '\n';
			}
		else if ((!fHtml) && (i + 3 < sb.length) && (sb.charAt(i) == '<') && (sb.charAt(i+1) == 'b') && (sb.charAt(i+2) == 'r') && (sb.charAt(i+3) == '>')) {
			m += '\n';
			i += 3;
			}
		else m += sb.charAt(i);
		}
	return m;
	}

function clib_hideAlert(fReturn) {
	if (!clibx_fAlert) return;
	if (fReturn == null) fReturn = false;
	clibx_fAlert = false;
	if (clibx_fYesNo) {
		clibx_fYesNo = false;
		eval(clibx_callback + '(' + (fReturn ? true : clibx_fCallback) + ')');
		clibx_callback = null;
		clibx_fCallback = null;
		}
	if (clibx_onAlertClose != null) eval(clibx_onAlertClose);
	clibx_onAlertClose = null;
	if (clib_fUseAlert) {
		clib_placeDiv(clib_alertDiv,0,0,0,false);
		if (clib_alertMsg2 != null) clib_showAlert(clib_alertMsg2,null,clib_alertImg2,null);
		clib_alertMsg2 = null;
		}
	}

function clib_nbsp(str) {
	if ((str == null) || (str == '')) return str;
	var rgStr = str.split(' ');
	if (rgStr.length <= 1) return str;
	var nbspStr = rgStr[0];
	for (var i = 1; i < rgStr.length; i++) nbspStr += '&nbsp;' + rgStr[i];
	return nbspStr;
	}

function clib_initCookies(fLog) {
	if (fLog == null) fLog = false;
	clib_fCookieLog = fLog;
	clib_fNoCookies = false;
	var i,j,tok,loc;
	if ((i = document.cookie.toLowerCase().indexOf('aspsessionid')) != -1) {
		j = document.cookie.indexOf('=',i);
		tok = document.cookie.substr(i,(j-i));
		clib_setCookie(tok,0);
		}
	if (!fLog) return;
	loc = "!" + window.parent.document.location; loc = loc.substr(1); loc=loc.toLowerCase();
	i = loc.indexOf(clib_website);
	if (i == -1) { if (loc.length == 0) loc = "badLocation"; }
	else {
		loc = loc.substr(i + clib_website.length);
		if (loc.length < 2) loc = clib_website;
		}
	if (loc == clib_website) loc = '/index.html';
	n = parseInt(clib_getCookie(loc),10);
	if (isNaN(n)) n=1;
	else n++;
	clib_setCookie(loc,n);
	}

function clib_logCookie(logEvent,text) {
	if (clib_fNoCookies || !clib_fCookieLog) return;
	var x = clib_getCookie(logEvent);
	if (x == null) x = "";
	x = x + '/' + text;
	clib_setCookie(logEvent,x,'/');
	}


function clib_getCookie(id) {
	if (clib_fNoCookies) return null;
	var offset,end;
	var val=null;
	var search = id + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			val = unescape(document.cookie.substring(offset, end));
			return val;
			}
		}
	return val;
	}

function clib_deleteCookie(name, path) {
	if (clib_fNoCookies) return;
	if (path==null) path = "/";
	var param = name + "=; expires=-10; path=" + escape(path);
	document.cookie = param;
	}

function clib_setCookie(name, value, path) {
	if (clib_fNoCookies) return;
	if (path==null) path = "/";
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 1000*60*60*24*365);
	var param =  name + "=" + escape(value) + "; expires=" + expire.toGMTString();
	if (path != "") param += "; path=" + escape(path);
	document.cookie = param;
	}

function clib_initDivs() {
	clib_fUseAlert = true;
	var html = '<div id="' + clib_alertDiv + '"';
	html += ' style="position:absolute;top:15;left:15;text-align:left;color:gray;border-color:gray;height:0;width:0;visibility:hidden;"';
	html += '>&nbsp;</div>';
	document.write(html);
	}

function clib_getMonthName(d) {
	if (d == null) d = new Date();
	return clib_rgMonths[d.getMonth()];
	}

function clib_daysUntil(d) {
	var todayDate = new Date();
	var eventDate = new Date(d);
	if (( todayDate.getMonth() == eventDate.getMonth() ) && ( todayDate.getYear() == eventDate.getYear() ))
		return eventDate.getDate() - todayDate.getDate();
	todayDate = new Date( (todayDate.getMonth() + 1) + '/' + (todayDate.getDate()) + '/' + todayDate.getFullYear());
	var msDay = 1000 * 60 * 60 * 24;
	var dToday = todayDate.getTime() / msDay;
	var dEvent = eventDate.getTime() / msDay;
	return Math.ceil(dEvent - dToday);
	}

function clib_debugList() {
	var args = clib_debugList.arguments;
	var nargs = args.length;
	var msg = '(';
	for (var i = 0; i < nargs; i++) {
		if (i > 0) msg += ',';
		msg += args[i];
		}
	msg += ')';
	var id = clib_getElementId('debugdiv');
	if (id == null) alert(msg);
	else clib_innerHTML('debugdiv',msg);
	}

function clibx_getFunctionName(f) {
	if (clib_isNull(f)) return null;
	var txt = f + ' ';
	var rg = txt.split('(');
	if (rg.length > 0) txt = rg[0]; else return null;
	rg = txt.split('function ');
	if (rg.length > 0) return rg[1]; else return txt;
	}

var clib_htmlDebugLog = '';

function clib_debugLog(msg) {
	clib_htmlDebugLog += msg + '<br>';
	clib_innerHTML('debugdiv',clib_htmlDebugLog);
	}

function clib_debugFunction(t,xtraMsg,maxDepth) {
	function clibx_param(p) {
		if (p == null) return 'null';
		if (typeof p == 'boolean') return '' + p;
		if (typeof p == 'string') return '"' + p + '"';
		if (clib_isArray(p)) return 'Array[' +p.length+ ']';
		if (typeof p == 'object') return '[Object]';
		if (typeof p == 'function') return '[Function]'
		return p;
		}
	if (maxDepth == null) maxDepth = 10;
	var fLog = false;
	var f = false;
	if (t == 'log') {
		if (typeof clibdb_log == 'undefined') return;
		f = true;
		fLog = true;
		}
	else if (typeof t == 'boolean') {
		f = t;
		}
	if (!f && !clib_fDebug) return;
	var rgF = new Array();
	var nrgF = 0;
	var msg = '';
	if (xtraMsg != null) msg += xtraMsg + '\n\n';
	msg += 'Debug Function\n';
	var fn = clib_debugFunction.caller;
	if (fn == null) msg += '    [Top Level] --->\n';
	else {
		var c = clibx_getFunctionName(fn);
		var fFirst = true;
		var i;
		while ((c != null) && (maxDepth-- > 0)) {
			rgF[nrgF] = c + '(';
			for (i = 0; i < fn.arguments.length; i++) {
				if (i > 0) {
					rgF[nrgF] += ', ';
					}
				rgF[nrgF] += clibx_param(fn.arguments[i]);
				}
			rgF[nrgF] += ')';
			fn = fn.caller;
			c = clibx_getFunctionName(fn);
			fFirst = false;
			nrgF++;
			}
		if (c != null) rgF[nrgF++] = 'MAX DEPTH';
		for (i = nrgF-1; i >= 0; i--) msg += '    ' + rgF[i] + ' --->\n';
		}
	msg += '    clib_debugFunction(' + t + (xtraMsg == null ? '' : ',[msg]') + ')';
	if (fLog) clibdb_log(msg);
	else {
		var id = clib_getElementId('debugdiv');
		if (id == null) alert(msg);
		else clib_debugLog(msg);
		}
	}

clibx_init();

